Files
kotlin-fork/compiler/testData/codegen/box/safeCall/safeCallWithElvisFolding.kt
T
2021-09-29 19:14:36 +03:00

9 lines
257 B
Kotlin
Vendored

fun String.foo(): String? = null
fun test(a: String?, b: String?, c: String) =
a ?: b?.foo() ?: c
// = (a ?: b?.boo()) ?: c
// Here 'b?.foo()' returns null, which may break elvis semantics if we fold it carelessly.
fun box() = test(null, "abc", "OK")