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 #14646 from Xavientois/show-context-for-inline-saf…
…e-init Add context to safe-init warnings for inlined methods
- Loading branch information
Showing
3 changed files
with
15 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Error: tests/init/neg/inlined-method.scala:8:45 --------------------------------------------------------------------- | ||
8 | scala.runtime.Scala3RunTime.assertFailed(message) // error | ||
| ^^^^^^^ | ||
|Cannot prove that the value is fully initialized. Only initialized values may be used as arguments. Calling trace: | ||
| -> Assertion.failAssert(this) [ inlined-method.scala:2 ] |
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 InlineError { | ||
Assertion.failAssert(this) | ||
val v = 2; | ||
} | ||
|
||
object Assertion: | ||
transparent inline def failAssert(inline message: => Any): Unit = | ||
scala.runtime.Scala3RunTime.assertFailed(message) // error |