FIR: check assignments and references to members in constructors
I.e. emit VAL_REASSIGNMENT on repeated assignments to `this.something`, UNINITIALIZED_VARIABLE on reads of it before any assignment if there is no initializer, and CAPTURED_MEMBER_VAL_INITIALIZATION on assignments inside non-called-in-place functions and named classes. ^KT-55528 Fixed
This commit is contained in:
+3
-3
@@ -27,7 +27,7 @@ fun gav() {
|
||||
class B {
|
||||
init {
|
||||
// Error! See KT-10445
|
||||
x = ""
|
||||
<!CAPTURED_VAL_INITIALIZATION!>x<!> = ""
|
||||
}
|
||||
}
|
||||
// Error! See KT-10042
|
||||
@@ -36,7 +36,7 @@ fun gav() {
|
||||
class C(val s: String) {
|
||||
constructor(): this("") {
|
||||
// Error!
|
||||
y = s
|
||||
<!CAPTURED_VAL_INITIALIZATION!>y<!> = s
|
||||
}
|
||||
}
|
||||
<!UNINITIALIZED_VARIABLE!>y<!>.length
|
||||
@@ -77,7 +77,7 @@ class My {
|
||||
class Your {
|
||||
init {
|
||||
// Error! See KT-10445
|
||||
x = ""
|
||||
<!CAPTURED_VAL_INITIALIZATION!>x<!> = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user