Closed
Description
Minimized code
// compile with -Ycheck-init
object Wrap1 {
class E
object E {
final val A = E()
val $values = Array(A)
}
}
object Wrap2 {
class E
object E {
final val A = E()
val ref = A
}
}
Output
-- Warning: initcheck.scala:5:23 ----------------------------------
5 | val $values = Array(A)
| ^
|Promoting the value under initialization to fully-initialized. Calling trace:
| -> val $values = Array(A) [ initcheck.scala:5 ]
1 warning found
Expectation
I thought that directly referencing the value should have the same behaviour as passing it to an array constructor