Files
kotlin/compiler/testData/codegen/box/inlineClasses/elvisWithInlineClassAndNullConstant.kt
2019-11-19 11:00:09 +03:00

17 lines
316 B
Kotlin
Vendored

// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND_FIR: JVM_IR
inline class UInt(private val data: Int) {
fun result(): String = if (data == 1) "OK" else "fail"
}
fun f(): UInt {
val unull = UInt(1) ?: null
return nonNull(unull)
}
fun nonNull(u: UInt?) = u!!
fun box(): String {
return f().result()
}