Files
kotlin/compiler/testData/codegen/bytecodeText/nullCheckOptimization/ifNullEqualsNullInline.kt
Alexander Udalov f5ff3d2fa9 Remove directives that have no effect from bytecode text tests
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
2018-12-20 12:53:24 +01:00

18 lines
267 B
Kotlin
Vendored

// FILE: test.kt
fun test1() {
val n = null
val u1 = n.elvis { "X1" }
val u2 = "X2".elvis { "X3" }
}
// @TestKt.class:
// 0 IFNULL
// 0 IFNONNULL
// 1 X1
// 1 X2
// 0 X3
// FILE: inline.kt
inline fun <T : Any> T?.elvis(rhs: () -> T): T = this ?: rhs()