Files
kotlin-fork/compiler/testData/diagnostics/tests/IsExpressions.kt
T
Dmitry Neverov cd24adac32 Detect redundant 'is' check
#KT-14187 Fixed
2017-05-15 11:24:35 +03:00

26 lines
460 B
Kotlin
Vendored

// FILE: KotlinFile.kt
fun test() {
if (<!USELESS_IS_CHECK!>1 is Int<!>) {
if (1 is <!INCOMPATIBLE_TYPES!>Boolean<!>) {
}
}
A.create() is A
<!USELESS_IS_CHECK!>A.create() is A?<!>
<!UNRESOLVED_REFERENCE!>unresolved<!> is A
<!UNRESOLVED_REFERENCE!>unresolved<!> is A?
val x = foo()
x as String
<!USELESS_IS_CHECK!>x is String<!>
}
fun foo(): Any = ""
// FILE: A.java
class A {
static A create() { return null; }
}