blob: c1740a4c5d482b2994f80318b913347edb28e29c [file]
// IGNORE_BACKEND: JS_IR, JS_IR_ES6, WASM_JS, WASM_WASI
// IGNORE_NATIVE: optimizationMode=DEBUG
// IGNORE_NATIVE: optimizationMode=NO
// IGNORE_KLIB_RUNTIME_ERRORS_WITH_CUSTOM_FIRST_STAGE: Native:*
// IGNORE_KLIB_RUNTIME_ERRORS_WITH_CUSTOM_SECOND_STAGE: Native:2.4
@Suppress("UNCHECKED_CAST")
fun <T> f() = 1L as T
fun box(): String {
val x: Int = f()!! // T = Int?, but the cast succeeds because it's immediately upcasted to Number
return if (x == 1) "OK" else "fail: $x"
}