mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
All bytecode text tests are run with stdlib in the classpath and only for JVM backend, therefore directives WITH_RUNTIME, TARGET_BACKEND, IGNORE_BACKEND are not needed
17 lines
324 B
Kotlin
Vendored
17 lines
324 B
Kotlin
Vendored
// FILE: test.kt
|
|
|
|
fun test1(): String {
|
|
val u = Unit
|
|
return u.mapNullable({ "X1" }, { "X2" })
|
|
}
|
|
|
|
// @TestKt.class:
|
|
// 0 IFNULL
|
|
// 0 IFNONNULL
|
|
// 1 X1
|
|
// 0 X2
|
|
|
|
// FILE: inline.kt
|
|
inline fun <T : Any, R> T?.mapNullable(ifNotNull: (T) -> R, ifNull: () -> R): R =
|
|
if (this == null) ifNull() else ifNotNull(this)
|