mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 15:53:37 +00:00
36 lines
596 B
Kotlin
Vendored
36 lines
596 B
Kotlin
Vendored
// !LANGUAGE: +InlineClasses
|
|
|
|
// FILE: utils.kt
|
|
|
|
inline class UInt(val value: Int)
|
|
|
|
// FILE: test.kt
|
|
|
|
fun test(x: UInt?) {
|
|
x?.myLet { // unbox
|
|
takeUInt(it)
|
|
takeUInt(x) // unbox
|
|
}
|
|
|
|
x?.myLet { // unbox
|
|
takeNullableUInt(it) // box
|
|
takeNullableUInt(x)
|
|
}
|
|
|
|
x!!.myLet { // unbox
|
|
takeUInt(it)
|
|
takeUInt(x) // unbox
|
|
}
|
|
}
|
|
|
|
fun takeUInt(y: UInt) {}
|
|
fun takeNullableUInt(y: UInt?) {}
|
|
|
|
inline fun <T> T.myLet(f: (T) -> Unit) = f(this)
|
|
|
|
// @TestKt.class:
|
|
// 1 INVOKESTATIC UInt\.box
|
|
// 5 INVOKEVIRTUAL UInt.unbox
|
|
|
|
// 0 intValue
|
|
// 0 valueOf |