If to when: more accurate comment handling #KT-12649 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-06-08 17:05:45 +03:00
parent d2bf4cbfa0
commit 9470308fe7
5 changed files with 43 additions and 5 deletions
@@ -1,6 +1,6 @@
fun foo(arg: Int): Int {
when (arg) {
0 -> return 0 // 1
else -> return -1 // 2
}
else -> return -1
} // 2
}
@@ -0,0 +1,16 @@
fun toInt(s: Number): Int {
<caret>if (s is Int) {
foo()
}
else {
return -1
}
// code below will be lost!
bar()
// before return
return s
}
fun foo() {}
fun bar() {}
@@ -0,0 +1,14 @@
fun toInt(s: Number): Int {
when (s) {
is Int -> foo()
else -> return -1
}
// code below will be lost!
bar()
// before return
return s
}
fun foo() {}
fun bar() {}