FIR checker: Report VAL_OR_VAR_ON_*_PARAMETER.
This commit is contained in:
committed by
teamcityserver
parent
71c5c9f6c5
commit
af99ad0736
-13
@@ -1,13 +0,0 @@
|
||||
fun f() {
|
||||
try {
|
||||
} catch (val e: Exception) {
|
||||
}
|
||||
|
||||
try {
|
||||
} catch (var e: Exception) {
|
||||
}
|
||||
|
||||
try {
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun f() {
|
||||
try {
|
||||
} catch (<!VAL_OR_VAR_ON_CATCH_PARAMETER!>val<!> e: Exception) {
|
||||
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
class Pair {
|
||||
operator fun component1(): Int = null!!
|
||||
operator fun component2(): Int = null!!
|
||||
}
|
||||
|
||||
class Coll {
|
||||
operator fun iterator(): It = It()
|
||||
}
|
||||
|
||||
class It {
|
||||
operator fun next() = Pair()
|
||||
operator fun hasNext() = false
|
||||
}
|
||||
|
||||
|
||||
fun f() {
|
||||
for (val i in 1..4) {
|
||||
|
||||
}
|
||||
|
||||
for (var i in 1..4) {
|
||||
|
||||
}
|
||||
|
||||
for (val (i,j) in Coll()) {
|
||||
|
||||
}
|
||||
|
||||
for (var (i,j) in Coll()) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class Pair {
|
||||
operator fun component1(): Int = null!!
|
||||
operator fun component2(): Int = null!!
|
||||
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
// KT-2667 Support multi-declarations in for-loops in control flow analysis
|
||||
package d
|
||||
|
||||
class A {
|
||||
operator fun component1() = 1
|
||||
operator fun component2() = 2
|
||||
operator fun component3() = 3
|
||||
}
|
||||
|
||||
fun foo(list: List<A>) {
|
||||
for (var (c1, c2, c3) in list) {
|
||||
<!VAL_REASSIGNMENT!>c1<!> = 1
|
||||
c3 + 1
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// KT-2667 Support multi-declarations in for-loops in control flow analysis
|
||||
package d
|
||||
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
fun f(
|
||||
val a: Int,
|
||||
var b: Int,
|
||||
c: Int,
|
||||
<!MULTIPLE_VARARG_PARAMETERS!>vararg<!> var d: Int,
|
||||
<!MULTIPLE_VARARG_PARAMETERS!>vararg<!> val e: Int,
|
||||
<!MULTIPLE_VARARG_PARAMETERS!>vararg<!> f: Int
|
||||
) {
|
||||
|
||||
|
||||
a + b + c + d[0] + e[0] + f[0] // to avoid 'unused parameter'
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun f(
|
||||
<!VAL_OR_VAR_ON_FUN_PARAMETER!>val<!> a: Int,
|
||||
<!VAL_OR_VAR_ON_FUN_PARAMETER!>var<!> b: Int,
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
class A {
|
||||
constructor(
|
||||
val x: Int, y: Int,
|
||||
var z: Int,
|
||||
<!VAL_OR_VAR_ON_SECONDARY_CONSTRUCTOR_PARAMETER!>val<!> x: Int, y: Int,
|
||||
<!VAL_OR_VAR_ON_SECONDARY_CONSTRUCTOR_PARAMETER!>var<!> z: Int,
|
||||
public a: Int)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user