Fix last if-statement in block codegen

#KT-3203 Fixed
This commit is contained in:
Alexander Udalov
2013-01-09 20:27:13 +04:00
parent 293b272a22
commit 4cebd3f75b
4 changed files with 56 additions and 11 deletions
@@ -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"
}