Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceInner.fir.kt
T
Dmitriy Novozhilov 02e327277e [FIR] Report VAL_REASSIGNMENT on assign to non-local vals
In this commit reporting on member properties in init section of class
  is not supported (see KT-55528)

^KT-55493 Fixed
2022-12-20 08:12:09 +00:00

22 lines
827 B
Kotlin
Vendored

class Outer {
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val outerProp: String<!>
inner class Inner(inner: Inner, outer: Outer) {
val innerProp: String
init {
outerProp // use of outerProp is ok because we're suppose that Outer instance should be initialized
this@Outer.outerProp
this@Outer.<!VAL_REASSIGNMENT!>outerProp<!> = "1"
<!VAL_REASSIGNMENT!>outerProp<!> = "2" // do not repeat the same diagnostic with this receiver of outer class
outer.<!VAL_REASSIGNMENT!>outerProp<!> = "3"
innerProp = "4" + inner.innerProp
this@Inner.innerProp = "5"
innerProp = "6" // do not repeat the same diagnostic with this receiver
this@Inner.innerProp = "7"
inner.innerProp = "8"
}
}
}