c42dd0848e
class C {
val x: Int
init {
// valid ways to initialize:
x = 1
this@C.x = 1
// invalid:
someOtherC.x = 1
run { /*this@run.*/x = 1 }
val self = this
self.x = 1
}
}
11 lines
259 B
Kotlin
Vendored
11 lines
259 B
Kotlin
Vendored
class A(val next: A? = null) {
|
|
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val x: String<!>
|
|
init {
|
|
next?.<!VAL_REASSIGNMENT!>x<!> = "a"
|
|
}
|
|
}
|
|
|
|
class B(val next: B? = null) {
|
|
var x: String = next?.x ?: "default" // it's ok to use `x` of next
|
|
}
|