-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15488 from dotty-staging/fix-15459
Fix #15459: Display uninitialized fields in promotion error
- Loading branch information
Showing
7 changed files
with
59 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
-- Error: tests/init/neg/default-this.scala:9:8 ------------------------------------------------------------------------ | ||
9 | compare() // error | ||
| ^^^^^^^ | ||
| Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak. 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 ] | ||
| ^^^^^^^ | ||
| Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak. | ||
| 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 ] | ||
| ^^^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- Error: tests/init/neg/i15459.scala:3:10 ----------------------------------------------------------------------------- | ||
3 | println(this) // error | ||
| ^^^^ | ||
| Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak. | ||
| 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 ] | ||
| ^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Sup: | ||
val a = 10 | ||
println(this) // error | ||
|
||
class Sub extends Sup: | ||
val b = 20 | ||
|
||
override def toString() = "a = " + a + ", b = " + b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
-- Error: tests/init/neg/inlined-method.scala:8:45 --------------------------------------------------------------------- | ||
8 | scala.runtime.Scala3RunTime.assertFailed(message) // error | ||
| ^^^^^^^ | ||
| Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak. 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 ] | ||
| ^^^^^^^ | ||
| Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak. | ||
| 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 ] | ||
| ^^^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters