Files
kotlin-fork/compiler/testData/diagnostics/tests/cast/AsNothing.kt
T
2021-11-12 15:20:44 +03:00

15 lines
323 B
Kotlin
Vendored

// FIR_IDENTICAL
// Nothing can be cast to Nothing
fun foo(x: String) {
x <!CAST_NEVER_SUCCEEDS!>as<!> Nothing
}
fun gav(y: String?) {
y <!CAST_NEVER_SUCCEEDS!>as<!> Nothing
}
// Only nullable can be cast to Nothing?
fun bar(x: String, y: String?) {
x <!CAST_NEVER_SUCCEEDS!>as<!> Nothing?
y as Nothing?
}