FIR checker: warn useless as and is
This commit is contained in:
committed by
TeamCityServer
parent
19d939c36e
commit
e2dc21da90
@@ -1,5 +1,5 @@
|
||||
fun f(a: Array<out Number>) = a.isArrayOf<Int>()
|
||||
|
||||
fun f1(a: Array<out Number>) = a is Array<*>
|
||||
fun f1(a: Array<out Number>) = <!USELESS_IS_CHECK!>a is Array<*><!>
|
||||
|
||||
fun f2(a: Array<out Number>) = a is Array<Int>
|
||||
fun f2(a: Array<out Number>) = a is Array<Int>
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ fun branchedAndNestedWithNativeOperators(x: Any?, y: Any?) {
|
||||
equalsTrue(isInt(y) && isString(y)) // y is Int, String
|
||||
)
|
||||
&&
|
||||
(1 == 2 || y is Int || isString(y))
|
||||
(1 == 2 || <!USELESS_IS_CHECK!>y is Int<!> || isString(y))
|
||||
)
|
||||
x.length
|
||||
y.length
|
||||
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect
|
||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
|
||||
|
||||
import kotlin.contracts.*
|
||||
|
||||
fun f3(value: String?) {
|
||||
if (!value.isNullOrEmpty() is Boolean) {
|
||||
value<!UNSAFE_CALL!>.<!>length
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect
|
||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
|
||||
|
||||
Reference in New Issue
Block a user