Use generic invokeFunction() instead of ad-hoc one for in-range conditions in when

This commit is contained in:
Andrey Breslav
2012-08-22 17:07:52 +04:00
parent 08e3da6769
commit 0cc27c0176
3 changed files with 26 additions and 12 deletions
@@ -0,0 +1,8 @@
fun Int.contains(i : Int) = true
fun box(): String {
when (1) {
in 2 -> return "OK"
else -> return "fail"
}
}