Skip to content

Commit b5d8531

Browse files
committed
Add comment to code
1 parent 4cdfa54 commit b5d8531

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/transform/init/Objects.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,6 +1179,7 @@ object Objects:
11791179
if sym.is(Flags.Package) then
11801180
Bottom
11811181
else if sym.isStaticObject && sym != klass then
1182+
// The typer may use ThisType to refer to an object outside its definition.
11821183
if elideObjectAccess then
11831184
ObjectRef(sym.moduleClass.asClass)
11841185
else
@@ -1404,15 +1405,15 @@ object Objects:
14041405
def errorMutateOtherStaticObject(currentObj: ClassSymbol, otherObj: ClassSymbol)(using Trace, Context) =
14051406
val msg =
14061407
s"Mutating ${otherObj.show} during initialization of ${currentObj.show}.\n" +
1407-
"Mutating other static objects during the initialization of one static object is discouraged. " +
1408+
"Mutating other static objects during the initialization of one static object is forbidden. " +
14081409
"Calling trace:\n" + Trace.show
14091410

14101411
report.warning(msg, Trace.position)
14111412

14121413
def errorReadOtherStaticObject(currentObj: ClassSymbol, otherObj: ClassSymbol)(using Trace, Context) =
14131414
val msg =
14141415
"Reading mutable state of " + otherObj.show + " during initialization of " + currentObj.show + ".\n" +
1415-
"Reading mutable state of other static objects is discouraged as it breaks initialization-time irrelevance. " +
1416+
"Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. " +
14161417
"Calling trace: " + Trace.show
14171418

14181419
report.warning(msg, Trace.position)

0 commit comments

Comments
 (0)