38319c55a8
From user point of view it's an improvement in compilation message. From technical point of view it's an introduction of new compilation diagnostic. Review: https://jetbrains.team/p/kt/reviews/9967 I'm going to deprecate `open val` case in the next few commits KT-57553. But it is always possible to suggest using `final` for `open val` case.
28 lines
555 B
Kotlin
Vendored
28 lines
555 B
Kotlin
Vendored
abstract class My(val v: Int) {
|
|
// Ok: variable is just abstract
|
|
abstract var x: Int
|
|
|
|
<!MUST_BE_INITIALIZED_OR_FINAL_OR_ABSTRACT!>open var y: Int<!>
|
|
|
|
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>open var z: Int<!>
|
|
|
|
// Ok: initializer available
|
|
open var w: Int = v
|
|
set(arg) { field = arg }
|
|
|
|
// Ok: no backing field, no initializer possible
|
|
open var u: Int
|
|
get() = w
|
|
set(arg) { w = 2 * arg }
|
|
|
|
constructor(): this(0) {
|
|
z = v
|
|
}
|
|
|
|
init {
|
|
x = 1
|
|
y = 2
|
|
u = 3
|
|
}
|
|
}
|