FIR: Report CAPTURED_VAL_INITIALIZATION if initialization is done
outside of constructor. In other words, when EXACTLY_ONCE lambda initializes non-static final field of a class, the lambda has to be inlined, otherwise, backend generated separate function of separate class for the lambda, which lead to exception at runtime. #KT-64854 Fixed #KT-59906 Fixed
This commit is contained in:
committed by
Space Team
parent
5dec87eba8
commit
1c4023fda5
+1
-1
@@ -86,7 +86,7 @@ class DefiniteInitializationInInitSection {
|
||||
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val y: Int<!>
|
||||
|
||||
init {
|
||||
myRun { x = 42 }
|
||||
myRun { <!CAPTURED_VAL_INITIALIZATION!>x<!> = 42 }
|
||||
unknownRun { <!CAPTURED_MEMBER_VAL_INITIALIZATION!>y<!> = 239 }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user