KT-769, KT-773 wrong compilation of when

This commit is contained in:
Alex Tkachman
2011-12-07 20:34:48 +02:00
parent c76463256b
commit 43885f0955
4 changed files with 61 additions and 7 deletions
@@ -0,0 +1,11 @@
namespace w_range
fun box() : String {
var i = 0
when (i) {
1 => i--
else => { i = 2 }
}
System.out?.println(i)
return "OK"
}
@@ -0,0 +1,25 @@
namespace demo2
fun print(o : Any?) {}
fun test(i : Int) {
var monthString : String? = "<empty>"
when (i) {
1 => {
print(1)
print(2)
print(3)
print(4)
print(5)
}
else => {
monthString = "Invalid month"
}
}
print(monthString)
}
fun box() : String {
for (i in 1..12) test(i)
return "OK"
}