Sign in
◑
Theme
pigweed
/
third_party
/
github
/
JetBrains
/
kotlin
/
9fe0f055c5c4e6ededc6378ef6df3f28ee841978
/
.
/
compiler
/
testData
/
codegen
/
box
/
casts
/
objectToPrimitiveWithAssertion.kt
blob: 1ef8e0033e4e0afa6da7941dff4825e2f80e3109 [
file
]
// IGNORE_BACKEND: JS, JS_IR, WASM
@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"
}