Fix last if-statement in block codegen
#KT-3203 Fixed
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
fun testIf() {
|
||||
val condition = true
|
||||
val result = if (condition) {
|
||||
val hello: String? = "hello"
|
||||
if (hello == null) {
|
||||
false
|
||||
}
|
||||
else {
|
||||
true
|
||||
}
|
||||
}
|
||||
else true
|
||||
if (!result) throw AssertionError("result is false")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
testIf()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
fun check1() {
|
||||
val result = if (true) {
|
||||
if (true) 1 else 2
|
||||
}
|
||||
else 3
|
||||
if (result != 1) throw AssertionError("result: $result")
|
||||
}
|
||||
|
||||
fun check2() {
|
||||
val result = if (true)
|
||||
if (true) 1 else 2
|
||||
else 3
|
||||
if (result != 1) throw AssertionError("result: $result")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
check1()
|
||||
check2()
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user