If to when: more accurate comment handling #KT-12649 Fixed
This commit is contained in:
+2
-2
@@ -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() {}
|
||||
Reference in New Issue
Block a user