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:
Vendored
+5
-6
@@ -10,7 +10,7 @@ class Some {
|
||||
|
||||
init {
|
||||
x = "ok"
|
||||
x = "error"
|
||||
<!VAL_REASSIGNMENT!>x<!> = "error"
|
||||
<!VAL_REASSIGNMENT!>z<!> = "error"
|
||||
}
|
||||
|
||||
@@ -24,17 +24,16 @@ class Some {
|
||||
|
||||
val b: String = 123.run {
|
||||
// now this@run is an Int, so these are on this@Some
|
||||
x = "error"
|
||||
<!VAL_REASSIGNMENT!>x<!> = "error"
|
||||
y = "ok"
|
||||
y = "error"
|
||||
<!VAL_REASSIGNMENT!>y<!> = "error"
|
||||
<!VAL_REASSIGNMENT!>z<!> = "error"
|
||||
"there"
|
||||
}
|
||||
|
||||
init {
|
||||
x = "error"
|
||||
y = "error"
|
||||
<!VAL_REASSIGNMENT!>x<!> = "error"
|
||||
<!VAL_REASSIGNMENT!>y<!> = "error"
|
||||
<!VAL_REASSIGNMENT!>z<!> = "error"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user