FIR checker: warn useless as and is
This commit is contained in:
committed by
TeamCityServer
parent
19d939c36e
commit
e2dc21da90
@@ -13,6 +13,6 @@ interface B
|
||||
|
||||
fun test_2(x: Any?) {
|
||||
if (x is A && x is B) {
|
||||
x is A
|
||||
<!USELESS_IS_CHECK!>x is A<!>
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ fun test_1(e: A) {
|
||||
|
||||
val d = when (e) {
|
||||
is E -> 1
|
||||
is A -> 2
|
||||
<!USELESS_IS_CHECK!>is A<!> -> 2
|
||||
}.plus(0)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
fun foo() = if (true) 1 else 0
|
||||
|
||||
fun bar(arg: Any?) = when (arg) {
|
||||
is Int -> arg as Int
|
||||
is Int -> arg <!USELESS_CAST!>as Int<!>
|
||||
else -> 42
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ class Some
|
||||
fun foo(): () -> Boolean {
|
||||
val s = Some()
|
||||
if (true) {
|
||||
return { if (s is Some) true else false }
|
||||
return { if (<!USELESS_IS_CHECK!>s is Some<!>) true else false }
|
||||
} else {
|
||||
return { true }
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -14,7 +14,7 @@ class Case1() {
|
||||
|
||||
this.yield("") //UNRESOLVED_REFERENCE
|
||||
|
||||
this as SequenceScope<String>
|
||||
this <!USELESS_CAST!>as SequenceScope<String><!>
|
||||
|
||||
yield("") // resolved to SequenceScope.yield
|
||||
|
||||
@@ -31,10 +31,10 @@ fun case2() {
|
||||
|
||||
this.yield("") //UNRESOLVED_REFERENCE
|
||||
|
||||
this as SequenceScope<String>
|
||||
this <!USELESS_CAST!>as SequenceScope<String><!>
|
||||
|
||||
yield("") // UNRESOLVED_REFERENCE
|
||||
|
||||
this.yield("") // UNRESOLVED_REFERENCE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user