JVM_IR fold safe calls and elvises
This commit is contained in:
committed by
teamcityserver
parent
7370d096ee
commit
9325660f06
@@ -0,0 +1,8 @@
|
||||
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")
|
||||
Reference in New Issue
Block a user