FIR checker: report val reassignment

This commit is contained in:
Jinseong Jeon
2021-02-19 00:51:16 -08:00
committed by Dmitriy Novozhilov
parent b128577508
commit f1fa290d49
66 changed files with 386 additions and 309 deletions
@@ -135,7 +135,7 @@ FILE: CanBeValChecker.kt
}
lval b: R|kotlin/String|
R|<local>/bool| = Boolean(false)
R|<local>/b| = Boolean(false)
}
public final fun cycles(): R|kotlin/Unit| {
lvar a: R|kotlin/Int| = Int(10)
@@ -105,9 +105,9 @@ fun foo() {
<!VARIABLE_NEVER_READ{LT}!><!CAN_BE_VAL!>var<!> <!VARIABLE_NEVER_READ{PSI}!>a<!>: Int<!>
val bool = true
if (bool) <!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 4 else <!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 42
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>b<!>: String<!>
<!VARIABLE_NEVER_READ{LT}!>val <!VARIABLE_NEVER_READ{PSI}!>b<!>: String<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>bool<!> = false
<!ASSIGNED_VALUE_IS_NEVER_READ!>b<!> = false
}
fun cycles() {
@@ -19,7 +19,7 @@ fun myRun(block: () -> Unit) {
fun test_1() {
val x: Int
inlineRun {
x = 1
<!VAL_REASSIGNMENT!>x<!> = 1
}
x.inc()
}
@@ -27,7 +27,7 @@ fun test_1() {
fun test_2() {
val x: Int
myRun {
x = 1
<!VAL_REASSIGNMENT!>x<!> = 1
}
x.inc()
}
@@ -19,7 +19,7 @@ fun myRun(block: () -> Unit) {
fun test_1() {
val x: Int
inlineRun {
x = 1
<!VAL_REASSIGNMENT!>x<!> = 1
}
<!UNINITIALIZED_VARIABLE!>x<!>.inc()
}
@@ -27,7 +27,7 @@ fun test_1() {
fun test_2() {
val x: Int
myRun {
x = 1
<!VAL_REASSIGNMENT!>x<!> = 1
}
<!UNINITIALIZED_VARIABLE!>x<!>.inc()
}