We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a722358 commit 36b4949Copy full SHA for 36b4949
compiler/src/dotty/tools/dotc/transform/init/Objects.scala
@@ -908,7 +908,10 @@ class Objects(using Context @constructorOnly):
908
Bottom
909
}
910
911
- /** Handle new expression `new p.C(args)`.
+ /**
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
915
*
916
* @param outer The value for `p`.
917
* @param klass The symbol of the class `C`.
tests/init-global/pos/cache-constructor.scala
@@ -6,4 +6,3 @@ object A:
6
val b2 = new Bar()
7
val b3 = new Bar()
8
b3.f = 1
9
-
0 commit comments