Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_before.fir.kt
T
pyos 99e51f6940 FIR: check assignments and references to members in constructors
I.e. emit VAL_REASSIGNMENT on repeated assignments to `this.something`,
UNINITIALIZED_VARIABLE on reads of it before any assignment if there is
no initializer, and CAPTURED_MEMBER_VAL_INITIALIZATION on assignments
inside non-called-in-place functions and named classes.

^KT-55528 Fixed
2023-01-26 13:12:13 +00:00

19 lines
367 B
Kotlin
Vendored

// !LANGUAGE: -ReadDeserializedContracts -UseCallsInPlaceEffect
// See KT-17479
class Test {
val str: String
init {
run {
this@Test.str = "A"
}
run {
// Not sure do we need diagnostic also here
this@Test.<!VAL_REASSIGNMENT!>str<!> = "B"
}
<!VAL_REASSIGNMENT!>str<!> = "C"
}
}