FIR checker: report val reassignment
This commit is contained in:
committed by
Dmitriy Novozhilov
parent
b128577508
commit
f1fa290d49
+1
-1
@@ -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) {
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -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 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user