Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceThisLabel.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

13 lines
372 B
Kotlin
Vendored

class A(val next: A? = null) {
val x: String
init {
next?.<!VAL_REASSIGNMENT!>x<!> = "a"
this@A.x = "b"
this.<!VAL_REASSIGNMENT!>x<!> = "c"
<!VAL_REASSIGNMENT!>x<!> = "d" // don't repeat the same diagnostic again with this receiver
this@A.<!VAL_REASSIGNMENT!>x<!> = "e"
next?.<!VAL_REASSIGNMENT!>x<!> = "f"
}
}