Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/smartcastToNothingAfterCheckingForNull.kt
T
2020-06-23 11:34:19 +03:00

29 lines
478 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: B.java
public abstract class B<T> implements A<T> {}
// FILE: test.kt
interface A<T> {
val content: T
}
fun f(x: Any?) {}
fun f(x: Byte) {}
fun f(x: Char) {}
fun g(i: Int) {}
fun g(x: B<Int>) {
val y = x.content
if (y == null) {
f(<!DEBUG_INFO_CONSTANT!>y<!>)
<!NONE_APPLICABLE!>g<!>(<!DEBUG_INFO_CONSTANT!>y<!>)
}
if (y is Nothing?) {
f(y)
<!NONE_APPLICABLE!>g<!>(y)
}
}