Files
kotlin-fork/compiler/testData/ir/irText/classes/initVar.kt.txt
T
Nikita Bobko d9d4dee582 [FIR] fix false negative MUST_BE_INITIALIZED for deferred init + custom setter case
^KT-58346 Fixed
Review: https://jetbrains.team/p/kt/reviews/9967

BTW this commit accidentaly and partially fixes KT-57553 for K2, because
of a cleaner K2 architecture. I will unify MUST_BE_INITIALIZED behaviour
in K1 and K2 in the next commits
2023-05-23 14:12:28 +03:00

62 lines
701 B
Kotlin
Vendored

class TestInitVarFromParameter {
constructor(x: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
var x: Int
field = x
get
set
}
class TestInitVarInClass {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
var x: Int
field = 0
get
set
}
class TestInitVarInInitBlock {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
var x: Int
get
set
init {
<this>.<set-x>(<set-?> = 0)
}
}
class TestInitVarWithCustomSetter {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
var x: Int
field = 0
get
set(value: Int) {
<this>.#x = value
}
}