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
@@ -26,7 +26,7 @@ fun case1() {
fun case2() {
val x: Boolean = false
try {
x = (throw Exception()) || true //VAL_REASSIGNMENT should be
<!VAL_REASSIGNMENT!>x<!> = (throw Exception()) || true //VAL_REASSIGNMENT should be
} catch (e: Exception) {
}
}
@@ -9,12 +9,12 @@
fun case1() {
val x : Any
x = "0"
x = 1
x = 2.0
<!VAL_REASSIGNMENT!>x<!> = 1
<!VAL_REASSIGNMENT!>x<!> = 2.0
val y : Any = 0
y = "0"
y = 1.0
<!VAL_REASSIGNMENT!>y<!> = "0"
<!VAL_REASSIGNMENT!>y<!> = 1.0
}
/*
@@ -23,8 +23,8 @@ fun case1() {
*/
fun case2() {
val x : Any
mutableListOf(0).forEach({ x = it })
mutableListOf(0).forEach({ <!VAL_REASSIGNMENT!>x<!> = it })
val y : Any = 1
mutableListOf(1).forEach({ y = it })
mutableListOf(1).forEach({ <!VAL_REASSIGNMENT!>y<!> = it })
}