You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--Warning: initcheck.scala:5:23----------------------------------5|val$values=Array(A)
|^|Promoting the value under initialization to fully-initialized. Callingtrace:
|->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
The text was updated successfully, but these errors were encountered:
This is a bug, because E() returns a fully constructed object in the context of initializing object E. Now it is fixed in #9665 .
I thought that directly referencing the value should have the same behaviour as passing it to an array constructor
There is a subtle difference here. Use a partially constructed value to initialize another field is OK, the fields of the object are not used. In contrast, using a partially constructed object as method argument is dangerous (as non-initialized fields might be accessed elsewhere). As it's not a good initialization practice, the checker issue a warning for such cases.
Uh oh!
There was an error while loading. Please reload this page.
Minimized code
Output
Expectation
I thought that directly referencing the value should have the same behaviour as passing it to an array constructor
The text was updated successfully, but these errors were encountered: