-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Reword error messages in initialization checker to be more user friendly. #17030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
da1b028
585409a
4cc629e
6f22980
36298a2
603822e
8af1b29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
-- Error: tests/init/neg/closureLeak.scala:11:14 ----------------------------------------------------------------------- | ||
11 | l.foreach(a => a.addX(this)) // error | ||
| ^^^^^^^^^^^^^^^^^ | ||
| Cannot prove the method argument is hot. Only hot values are safe to leak. | ||
| Found = Fun { this = ThisRef[class Outer], owner = class Outer }. Calling trace: | ||
| -> class Outer { [ closureLeak.scala:1 ] | ||
| ^ | ||
| -> l.foreach(a => a.addX(this)) // error [ closureLeak.scala:11 ] | ||
| ^^^^^^^^^^^^^^^^^ | ||
|Could not verify that the method argument is transitively initialized (Hot). It was found to be a function { this = the original object of type "class Outer" that started this trace, owner = class Outer }. Only transitively initialized arguments may be passed to methods outside the analyzed initialization region. Calling trace: | ||
|-> class Outer { [ closureLeak.scala:1 ] | ||
| ^ | ||
|-> l.foreach(a => a.addX(this)) // error [ closureLeak.scala:11 ] | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
| Promoting the value to hot (transitively initialized) failed due to the following problem: | ||
| Cannot prove the method argument is hot. Only hot values are safe to leak. | ||
| Found = ThisRef[class Outer]. | ||
| Non initialized field(s): value p. Promotion trace: | ||
| -> l.foreach(a => a.addX(this)) // error [ closureLeak.scala:11 ] | ||
| ^^^^ | ||
|Promoting the value to transitively initialized (Hot) failed due to the following problem: | ||
|Could not verify that the method argument is transitively initialized (Hot). It was found to be the original object of type "class Outer" that started this trace. Only transitively initialized arguments may be passed to methods outside the analyzed initialization region. | ||
|Non initialized field(s): value p. Promotion trace: | ||
|-> l.foreach(a => a.addX(this)) // error [ closureLeak.scala:11 ] | ||
| ^^^^ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
-- Error: tests/init/neg/default-this.scala:9:8 ------------------------------------------------------------------------ | ||
9 | compare() // error | ||
| ^^^^^^^ | ||
| Cannot prove the method argument is hot. Only hot values are safe to leak. | ||
| Found = ThisRef[class B]. | ||
| Non initialized field(s): value result. Calling trace: | ||
| -> class B extends A { [ default-this.scala:6 ] | ||
| ^ | ||
| -> val result = updateThenCompare(5) [ default-this.scala:11 ] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| -> def updateThenCompare(c: Int): Boolean = { [ default-this.scala:7 ] | ||
| ^ | ||
| -> compare() // error [ default-this.scala:9 ] | ||
| ^^^^^^^ | ||
|Could not verify that the method argument is transitively initialized (Hot). It was found to be the original object of type "class B" that started this trace. Only transitively initialized arguments may be passed to methods outside the analyzed initialization region. | ||
|
||
|Non initialized field(s): value result. Calling trace: | ||
|-> class B extends A { [ default-this.scala:6 ] | ||
| ^ | ||
|-> val result = updateThenCompare(5) [ default-this.scala:11 ] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|-> def updateThenCompare(c: Int): Boolean = { [ default-this.scala:7 ] | ||
| ^ | ||
|-> compare() // error [ default-this.scala:9 ] | ||
| ^^^^^^^ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
-- Error: tests/init/neg/i15459.scala:3:10 ----------------------------------------------------------------------------- | ||
3 | println(this) // error | ||
| ^^^^ | ||
| Cannot prove the method argument is hot. Only hot values are safe to leak. | ||
| Found = ThisRef[class Sub]. | ||
| Non initialized field(s): value b. Calling trace: | ||
| -> class Sub extends Sup: [ i15459.scala:5 ] | ||
| ^ | ||
| -> class Sup: [ i15459.scala:1 ] | ||
| ^ | ||
| -> println(this) // error [ i15459.scala:3 ] | ||
| ^^^^ | ||
|Could not verify that the method argument is transitively initialized (Hot). It was found to be the original object of type "class Sub" that started this trace. Only transitively initialized arguments may be passed to methods outside the analyzed initialization region. | ||
|Non initialized field(s): value b. Calling trace: | ||
|-> class Sub extends Sup: [ i15459.scala:5 ] | ||
| ^ | ||
|-> class Sup: [ i15459.scala:1 ] | ||
| ^ | ||
|-> println(this) // error [ i15459.scala:3 ] | ||
| ^^^^ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
-- Error: tests/init/neg/inherit-non-hot.scala:6:32 -------------------------------------------------------------------- | ||
6 | if b == null then b = new B(this) // error | ||
| ^^^^^^^^^^^^^^^ | ||
| The RHS of reassignment must be hot. Found = Warm[class B] { outer = Hot, args = (Cold) }. Calling trace: | ||
| -> class C extends A { [ inherit-non-hot.scala:15 ] | ||
| ^ | ||
| -> val bAgain = toB.getBAgain [ inherit-non-hot.scala:16 ] | ||
| ^^^ | ||
| -> def toB: B = [ inherit-non-hot.scala:5 ] | ||
| ^ | ||
| -> if b == null then b = new B(this) // error [ inherit-non-hot.scala:6 ] | ||
| ^^^^^^^^^^^^^^^ | ||
|The RHS of reassignment must be transitively initialized (Hot). It was found to be an initialized (Warm) object of type class B{ outer = a transitively initialized (Hot) object, args = (an uninitialized (Cold) object) }. Calling trace: | ||
q-ata marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|-> class C extends A { [ inherit-non-hot.scala:15 ] | ||
| ^ | ||
|-> val bAgain = toB.getBAgain [ inherit-non-hot.scala:16 ] | ||
| ^^^ | ||
|-> def toB: B = [ inherit-non-hot.scala:5 ] | ||
| ^ | ||
|-> if b == null then b = new B(this) // error [ inherit-non-hot.scala:6 ] | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
| Promoting the value to hot (transitively initialized) failed due to the following problem: | ||
| Cannot prove that the field value a is hot. Found = Cold. Promotion trace: | ||
| -> class B(a: A) { [ inherit-non-hot.scala:10 ] | ||
| ^^^^ | ||
|Promoting the value to transitively initialized (Hot) failed due to the following problem: | ||
|Could not verify that the field value a is transitively initialized (Hot). It was found to be an uninitialized (Cold) object. Promotion trace: | ||
|-> class B(a: A) { [ inherit-non-hot.scala:10 ] | ||
| ^^^^ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
-- Error: tests/init/neg/inlined-method.scala:8:45 --------------------------------------------------------------------- | ||
8 | scala.runtime.Scala3RunTime.assertFailed(message) // error | ||
| ^^^^^^^ | ||
| Cannot prove the method argument is hot. Only hot values are safe to leak. | ||
| Found = ThisRef[class InlineError]. | ||
| Non initialized field(s): value v. Calling trace: | ||
| -> class InlineError { [ inlined-method.scala:1 ] | ||
| ^ | ||
| -> Assertion.failAssert(this) [ inlined-method.scala:2 ] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| -> scala.runtime.Scala3RunTime.assertFailed(message) // error [ inlined-method.scala:8 ] | ||
| ^^^^^^^ | ||
|Could not verify that the method argument is transitively initialized (Hot). It was found to be the original object of type "class InlineError" that started this trace. Only transitively initialized arguments may be passed to methods outside the analyzed initialization region. | ||
|Non initialized field(s): value v. Calling trace: | ||
|-> class InlineError { [ inlined-method.scala:1 ] | ||
| ^ | ||
|-> Assertion.failAssert(this) [ inlined-method.scala:2 ] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|-> scala.runtime.Scala3RunTime.assertFailed(message) // error [ inlined-method.scala:8 ] | ||
| ^^^^^^^ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
-- Error: tests/init/neg/inner-first.scala:3:12 ------------------------------------------------------------------------ | ||
3 | println(this) // error | ||
| ^^^^ | ||
| Cannot prove the method argument is hot. Only hot values are safe to leak. | ||
| Found = ThisRef[class B]. | ||
| Non initialized field(s): value n. Calling trace: | ||
| -> class B: [ inner-first.scala:2 ] | ||
| ^ | ||
| -> println(this) // error [ inner-first.scala:3 ] | ||
| ^^^^ | ||
|Could not verify that the method argument is transitively initialized (Hot). It was found to be the original object of type "class B" that started this trace. Only transitively initialized arguments may be passed to methods outside the analyzed initialization region. | ||
|Non initialized field(s): value n. Calling trace: | ||
|-> class B: [ inner-first.scala:2 ] | ||
| ^ | ||
|-> println(this) // error [ inner-first.scala:3 ] | ||
| ^^^^ |
Uh oh!
There was an error while loading. Please reload this page.