Skip to content

Commit f8659a9

Browse files
EnzeXingWojciechMazur
EnzeXing
authored andcommitted
Address comment
[Cherry-picked 36b4949]
1 parent eae6a33 commit f8659a9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: compiler/src/dotty/tools/dotc/transform/init/Objects.scala

+4-1
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,10 @@ class Objects(using Context @constructorOnly):
908908
Bottom
909909
}
910910

911-
/** Handle new expression `new p.C(args)`.
911+
/**
912+
* Handle new expression `new p.C(args)`.
913+
* The actual instance might be cached without running the constructor.
914+
* See tests/init-global/pos/cache-constructor.scala
912915
*
913916
* @param outer The value for `p`.
914917
* @param klass The symbol of the class `C`.

Diff for: tests/init-global/pos/cache-constructor.scala

-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ object A:
66
val b2 = new Bar()
77
val b3 = new Bar()
88
b3.f = 1
9-

0 commit comments

Comments
 (0)