Closed
Description
Compiler version
main
Minimized code
def leak(a: Any) = ???
class Sup {
val a = ???
leak(this)
}
class Sub extends Sup {
val b = ???
}
Output
-- Warning: Sup.scala:5:9 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5 | leak(this)
| ^^^^
| Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak. Calling trace:
| -> class Sub extends Sup { [ Sup.scala:8 ]
| ^
| -> class Sup { [ Sup.scala:3 ]
| ^
| -> leak(this) [ Sup.scala:5 ]
| ^^^^
Expectation
The warning would be more helpful if it could list the fields (in this case b
) that are not initialized and the subclasses (in this case Sub
) that they're in.