Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 55fcf06

Browse files
Tweak per review
1 parent 7d8be19 commit 55fcf06

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

‎compiler/src/dotty/tools/dotc/ast/Desugar.scala‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,7 +1858,7 @@ object desugar {
18581858
/** Assuming `src` contains top-level definition, returns the name that should
18591859
* be using for the package object that will wrap them.
18601860
*/
1861-
def packageObjectName(src: SourceFile, srcPos: SrcPos)(usingContext): TermName =
1861+
def packageObjectName(src: SourceFile): TermName =
18621862
val fileName = src.file.name
18631863
val sourceName = fileName.take(fileName.lastIndexOf('.'))
18641864
(sourceName ++ str.TOPLEVEL_SUFFIX).toTermName
@@ -1889,7 +1889,7 @@ object desugar {
18891889
val (nestedStats, topStats) = pdef.stats.partition(inPackageObject)
18901890
if (nestedStats.isEmpty) pdef
18911891
else {
1892-
val name = packageObjectName(ctx.source, pdef.srcPos)
1892+
val name = packageObjectName(ctx.source)
18931893
val grouped =
18941894
ModuleDef(name, Template(emptyConstructor, Nil, Nil, EmptyValDef, nestedStats))
18951895
.withMods(Modifiers(Synthetic))

‎compiler/src/dotty/tools/dotc/reporting/ErrorMessageID.scala‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ enum ErrorMessageID(val isActive: Boolean = true) extends java.lang.Enum[ErrorMe
235235
case CannotInstantiateQuotedTypeVarID // errorNumber: 219
236236
case DefaultShadowsGivenID // errorNumber: 220
237237
case RecurseWithDefaultID // errorNumber: 221
238-
case EncodedPackageNameID // 222
238+
case EncodedPackageNameID // errorNumber: 222
239239

240240
def errorNumber = ordinal - 1
241241

‎compiler/src/dotty/tools/dotc/reporting/messages.scala‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3754,10 +3754,10 @@ final class EncodedPackageName(name: Name)(using Context) extends SyntaxMsg(Enco
37543754
override protected def msg(using Context): String =
37553755
i"The package name `$name` will be encoded on the classpath, and can lead to undefined behaviour."
37563756
override protected def explain(using Context): String =
3757-
i"""Tooling may not cope with directories whose names do not match their package name.
3758-
|For example, `p-q` is encoded as `p$$minusq` and written that way to the file system.
3757+
i"""Tools may not handle directories whose names differ from their corresponding package names.
3758+
|For example, `p-q` is encoded as `p$$minusq` when written to the file system.
37593759
|
3760-
|Package objects have names derived from their file names, so that names such as
3761-
|`myfile.test.scala` and `myfile-test.scala` will result in encoded names for package objects.
3760+
|Package objects derive their names from the file names, so files such as `myfile.test.scala`
3761+
|or `myfile-test.scala` can produce encoded names for the generated package objects.
37623762
|
3763-
|The name `$name` is encoded to `${name.encode}`."""
3763+
|In this case, the name `$name` is encoded as `${name.encode}`."""

‎compiler/src/dotty/tools/dotc/typer/Typer.scala‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3477,7 +3477,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
34773477
inContext(ctx.packageContext(tree, pkg)) {
34783478
// If it exists, complete the class containing the top-level definitions
34793479
// before typing any statement in the package to avoid cycles as in i13669.scala
3480-
val packageObjectName = desugar.packageObjectName(ctx.source, tree.srcPos)
3480+
val packageObjectName = desugar.packageObjectName(ctx.source)
34813481
val topLevelClassSymbol = pkg.moduleClass.info.decls.lookup(packageObjectName.moduleClassName)
34823482
topLevelClassSymbol.ensureCompleted()
34833483
var stats1 = typedStats(tree.stats, pkg.moduleClass)._1
@@ -3890,8 +3890,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
38903890
def typedStats(stats: List[untpd.Tree], exprOwner: Symbol)(using Context): (List[Tree], Context) = {
38913891
val buf = new mutable.ListBuffer[Tree]
38923892
var enumContexts: SimpleIdentityMap[Symbol, Context] = SimpleIdentityMap.empty
3893-
// A map from `enum` symbols to the contexts enclosing their definitions
38943893
val initialNotNullInfos = ctx.notNullInfos
3894+
// A map from `enum` symbols to the contexts enclosing their definitions
38953895
@tailrec def traverse(stats: List[untpd.Tree])(using Context): (List[Tree], Context) = stats match {
38963896
case (imp: untpd.Import) :: rest =>
38973897
val imp1 = typed(imp)

‎tests/neg/i22670.check‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
|--------------------------------------------------------------------------------------------------------------------
1111
| Explanation (enabled by `-explain`)
1212
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13-
| Tooling may not cope with directories whose names do not match their package name.
14-
| For example, `p-q` is encoded as `p$minusq` and written that way to the file system.
13+
| Tools may not handle directories whose names differ from their corresponding package names.
14+
| For example, `p-q` is encoded as `p$minusq` when written to the file system.
1515
|
16-
| Package objects have names derived from their file names, so that names such as
17-
| `myfile.test.scala` and `myfile-test.scala` will result in encoded names for package objects.
16+
| Package objects derive their names from the file names, so files such as `myfile.test.scala`
17+
| or `myfile-test.scala` can produce encoded names for the generated package objects.
1818
|
19-
| The name `i22670-macro$package` is encoded to `i22670$minusmacro$package`.
19+
| In this case, the name `i22670-macro$package` is encoded as `i22670$minusmacro$package`.
2020
--------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /