Files
kotlin-fork/compiler/testData/codegen/box/casts/castGenericNull.kt
T
2020-11-09 16:04:43 +03:00

16 lines
270 B
Kotlin
Vendored

// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: EXCEPTIONS_NOT_IMPLEMENTED
fun <T> castToString(t: T) {
t as String
}
fun box(): String {
try {
castToString<Any?>(null)
} catch (e: Exception) {
return "OK"
}
return "Fail"
}