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

21 lines
393 B
Kotlin
Vendored

//KT-897 Don't allow assignment to a property before it is defined
package kt897
class A() {
init {
<!INITIALIZATION_BEFORE_DECLARATION!>i<!> = 11
}
val i : Int? = null // must be an error
init {
<!INITIALIZATION_BEFORE_DECLARATION!>j<!> = 1
}
var j : Int = 2
init {
<!INITIALIZATION_BEFORE_DECLARATION!>k<!> = 3
}
val k : Int
}