File tree Expand file tree Collapse file tree 17 files changed +57
-48
lines changed
compiler/src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 17 files changed +57
-48
lines changed Original file line number Diff line number Diff line change @@ -82,11 +82,11 @@ object Errors:
8282
8383 case class AccessCold (field : Symbol , trace : Seq [Tree ]) extends Error :
8484 def show (using Context ): String =
85- " Access field " + field.show + " on a value with a cold object." + stacktrace()
85+ " Access field " + field.show + " on a cold object." + stacktrace()
8686
8787 case class CallCold (meth : Symbol , trace : Seq [Tree ]) extends Error :
8888 def show (using Context ): String =
89- " Call method " + meth.show + " on a value with an cold object." + stacktrace()
89+ " Call method " + meth.show + " on a cold object." + stacktrace()
9090
9191 case class CallUnknown (meth : Symbol , trace : Seq [Tree ]) extends Error :
9292 def show (using Context ): String =
Original file line number Diff line number Diff line change @@ -1231,7 +1231,7 @@ object Semantic:
12311231 /** Utility definition used for better error-reporting of argument errors */
12321232 case class ArgInfo (value : Value , trace : Trace ):
12331233 def promote : Contextual [Unit ] = withTrace(trace) {
1234- value.promote(" Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak. \n Found = " + value.show + " . " )
1234+ value.promote(" Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak.\n Found = " + value.show + " . " )
12351235 }
12361236
12371237 /** Evaluate an expression with the given value for `this` in a given class `klass`
Original file line number Diff line number Diff line change 11-- Error: tests/init/neg/closureLeak.scala:11:14 -----------------------------------------------------------------------
2211 | l.foreach(a => a.addX(this)) // error
33 | ^^^^^^^^^^^^^^^^^
4- | Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak. Calling trace:
5- | -> class Outer { [ closureLeak.scala:1 ]
6- | ^
7- | -> l.foreach(a => a.addX(this)) // error [ closureLeak.scala:11 ]
8- | ^^^^^^^^^^^^^^^^^
4+ | Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak.
5+ | Found = Fun { this = ThisRef[class Outer], owner = class Outer }. Calling trace:
6+ | -> class Outer { [ closureLeak.scala:1 ]
7+ | ^
8+ | -> l.foreach(a => a.addX(this)) // error [ closureLeak.scala:11 ]
9+ | ^^^^^^^^^^^^^^^^^
910 |
10- | Promoting the value to fully initialized failed due to the following problem:
11- | Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak.
12- | Non initialized field(s): value p. Calling trace:
13- | -> l.foreach(a => a.addX(this)) // error [ closureLeak.scala:11 ]
14- | ^^^^
11+ | Promoting the value to fully initialized failed due to the following problem:
12+ | Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak.
13+ | Found = ThisRef[class Outer].
14+ | Non initialized field(s): value p. Calling trace:
15+ | -> l.foreach(a => a.addX(this)) // error [ closureLeak.scala:11 ]
16+ | ^^^^
Original file line number Diff line number Diff line change 88 | ^^^^^^^
99 |
1010 | It leads to the following error during object initialization:
11- | Access field on a value with an unknown initialization status . Calling trace:
11+ | Access field value x on a cold object . Calling trace:
1212 | -> case class B(a: A) { [ cycle-structure.scala:7 ]
1313 | ^
1414 | -> val x1 = a.x [ cycle-structure.scala:8 ]
2323 | ^^^^^^^
2424 |
2525 | It leads to the following error during object initialization:
26- | Access field on a value with an unknown initialization status . Calling trace:
26+ | Access field value x on a cold object . Calling trace:
2727 | -> case class A(b: B) { [ cycle-structure.scala:1 ]
2828 | ^
2929 | -> val x1 = b.x [ cycle-structure.scala:2 ]
Original file line number Diff line number Diff line change 229 | compare() // error
33 | ^^^^^^^
44 | Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak.
5+ | Found = ThisRef[class B].
56 | Non initialized field(s): value result. Calling trace:
67 | -> class B extends A { [ default-this.scala:6 ]
78 | ^
Original file line number Diff line number Diff line change 88 | ^^^^^^^^^^^
99 |
1010 | It leads to the following error during object initialization:
11- | Access field on a value with an unknown initialization status . Calling trace:
11+ | Access field value m on a cold object . Calling trace:
1212 | -> class B(a: A): [ i15363.scala:7 ]
1313 | ^
1414 | -> val x = a.m [ i15363.scala:8 ]
Original file line number Diff line number Diff line change 223 | println(this) // error
33 | ^^^^
44 | Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak.
5+ | Found = ThisRef[class Sub].
56 | Non initialized field(s): value b. Calling trace:
67 | -> class Sub extends Sup: [ i15459.scala:5 ]
78 | ^
Original file line number Diff line number Diff line change 1212 | ^^^^^^^^^^^^^^^
1313 |
1414 |Promoting the value to fully initialized failed due to the following problem:
15- |Cannot prove that the field val a is fully initialized.
15+ |Cannot prove that the field value a is fully initialized. Found = Cold.
Original file line number Diff line number Diff line change 228 | scala.runtime.Scala3RunTime.assertFailed(message) // error
33 | ^^^^^^^
44 | Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak.
5+ | Found = ThisRef[class InlineError].
56 | Non initialized field(s): value v. Calling trace:
67 | -> class InlineError { [ inlined-method.scala:1 ]
78 | ^
Original file line number Diff line number Diff line change 223 | println(this) // error
33 | ^^^^
44 | Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak.
5+ | Found = ThisRef[class B].
56 | Non initialized field(s): value n. Calling trace:
67 | -> class B: [ inner-first.scala:2 ]
78 | ^
You can’t perform that action at this time.
0 commit comments