KT-11710 "Replace 'if' with elvis operator": incorrect code generated for 'if' expression
#KT-11710 Fixed
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(a: String?, b: String): String {
|
||||
val x = if (true) a else b
|
||||
<caret>if (x == null) throw Exception()
|
||||
return x
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(a: String?, b: String): String {
|
||||
val x = (if (true) a else b) ?: throw Exception()
|
||||
return x
|
||||
}
|
||||
Reference in New Issue
Block a user