backend: fix minor bug in evaluateWhen

Also add the corresponding test 'when9'.
This commit is contained in:
Svyatoslav Scherbina
2017-01-20 18:40:24 +07:00
committed by SvyatoslavScherbina
parent 0958d32605
commit 1f7738e052
3 changed files with 22 additions and 2 deletions
+5
View File
@@ -330,6 +330,11 @@ task when8(type: RunKonanTest) {
goldValue = "true\n"
}
task when9(type: RunKonanTest) {
goldValue = "Ok\n"
source = "codegen/branching/when9.kt"
}
task when_through(type: RunKonanTest) {
source = "codegen/branching/when_through.kt"
}
@@ -0,0 +1,10 @@
fun main(args: Array<String>) {
foo(0)
println("Ok")
}
fun foo(x: Int) {
when (x) {
0 -> 0
}
}