Files
kotlin-fork/compiler/testData/codegen/box/inlineClasses/checkCastToInlineClass.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

21 lines
472 B
Kotlin
Vendored

// WITH_STDLIB
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
@kotlin.jvm.JvmInline
value class UInt(val s: Int)
fun test(a1: Any, a2: UInt?, a3: Any?, a4: Any?): Int {
val b1 = a1 as UInt
val b2 = a2 as UInt
val b3 = (a3 as UInt?) as UInt
val b4 = (a4 as? UInt) as UInt
return b1.s + b2.s + b3.s + b4.s
}
fun box(): String {
val u1 = UInt(1)
val u2 = UInt(2)
if (test(u1, u2, u1, u2) != 6) return "fail"
return "OK"
}