UnreachableCode.getUnreachableTextRanges always returns at least one range #KT-14158 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-10-20 15:17:41 +03:00
parent 4fc135709e
commit bfaa9cf56f
6 changed files with 30 additions and 2 deletions
+3
View File
@@ -0,0 +1,3 @@
$TESTDATA_DIR$/returnAsWhenKey.kt
-d
$TEMP_DIR$
+7
View File
@@ -0,0 +1,7 @@
// KT-14158: NoSuchElementException while compiling...
fun foo(): Int {
when (true) {
return 0 -> return 1
}
}
+7
View File
@@ -0,0 +1,7 @@
compiler/testData/cli/jvm/returnAsWhenKey.kt:5:17: warning: unreachable code
return 0 -> return 1
^
compiler/testData/cli/jvm/returnAsWhenKey.kt:5:21: warning: unreachable code
return 0 -> return 1
^
OK
@@ -16,7 +16,7 @@ fun fff(): Int {
var d = 3
when(d) {
4 -> <!UNUSED_EXPRESSION!>21<!>
return 2 -> <!UNREACHABLE_CODE!>return 47<!>
return 2<!UNREACHABLE_CODE!><!> -> <!UNREACHABLE_CODE!>return 47<!>
<!UNREACHABLE_CODE!>bar() -> 45<!>
<!UNREACHABLE_CODE!>444 -> true<!>
}