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
@@ -4,7 +4,7 @@
// TESTCASE NUMBER: 1
fun case_1() {
val value_1: Int
funWithAtLeastOnceCallsInPlace { value_1 = 10 }
funWithAtLeastOnceCallsInPlace { <!VAL_REASSIGNMENT!>value_1<!> = 10 }
value_1.inc()
}
@@ -18,7 +18,7 @@ fun case_2() {
// TESTCASE NUMBER: 3
fun case_3() {
val value_1: Int
funWithUnknownCallsInPlace { value_1 = 10 }
funWithUnknownCallsInPlace { <!VAL_REASSIGNMENT!>value_1<!> = 10 }
<!UNINITIALIZED_VARIABLE!>value_1<!>.inc()
}
@@ -52,7 +52,7 @@ class case_5 {
fun case_6() {
val value_1: Int
for (i in 0..1)
funWithExactlyOnceCallsInPlace { value_1 = 10 }
funWithExactlyOnceCallsInPlace { <!VAL_REASSIGNMENT!>value_1<!> = 10 }
<!UNINITIALIZED_VARIABLE!>value_1<!>.dec()
}
@@ -6,7 +6,7 @@ fun case_1() {
val value_1: Int
funWithAtLeastOnceCallsInPlace {
funWithAtMostOnceCallsInPlace {
value_1 = 1
<!VAL_REASSIGNMENT!>value_1<!> = 1
funWithExactlyOnceCallsInPlace {
value_1.inc()
}
@@ -121,7 +121,7 @@ fun case_8() {
funWithExactlyOnceCallsInPlace outer@ {
funWithAtMostOnceCallsInPlace {
funWithUnknownCallsInPlace {
x = 42
<!VAL_REASSIGNMENT!>x<!> = 42
}
return@outer
}
@@ -79,7 +79,7 @@ fun case_5() {
value_1.inc()
}
funWithUnknownCallsInPlace {
value_1 = 1
<!VAL_REASSIGNMENT!>value_1<!> = 1
}
<!UNINITIALIZED_VARIABLE!>value_1<!>.dec()
}
@@ -155,7 +155,7 @@ fun case_10() {
val x: Int
funWithExactlyOnceCallsInPlace outer@ {
funWithAtLeastOnceCallsInPlace {
x = 42
<!VAL_REASSIGNMENT!>x<!> = 42
return@outer
}
}