Fix of getCorrespondingLoop for complex loop / try-finally trees #KT-8246 Fixed
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
fun foo() {
|
||||
outer@while (true) {
|
||||
try {
|
||||
while (true) {
|
||||
<!UNREACHABLE_CODE!>continue@outer<!>
|
||||
}
|
||||
} finally {
|
||||
break
|
||||
}
|
||||
}
|
||||
"OK".hashCode()
|
||||
}
|
||||
|
||||
fun bar(): String {
|
||||
outer@while (true) {
|
||||
try {
|
||||
while (true) {
|
||||
<!UNREACHABLE_CODE!>continue@outer<!>
|
||||
}
|
||||
} finally {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public fun bar(): kotlin.String
|
||||
public fun foo(): kotlin.Unit
|
||||
@@ -0,0 +1,86 @@
|
||||
fun test() {
|
||||
while (true) {
|
||||
fun local1() {
|
||||
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>break<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
while (true) {
|
||||
<!UNUSED_LAMBDA_EXPRESSION!>{
|
||||
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue<!>
|
||||
}<!>
|
||||
}
|
||||
}
|
||||
|
||||
fun test3() {
|
||||
while (true) {
|
||||
class LocalClass {
|
||||
init {
|
||||
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue<!>
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>break<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test4() {
|
||||
while (true) {
|
||||
object: Any() {
|
||||
init {
|
||||
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>break<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test5() {
|
||||
while (true) {
|
||||
class LocalClass(val x: Int) {
|
||||
constructor() : this(42) {
|
||||
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>break<!>
|
||||
}
|
||||
constructor(y: Double) : this(y.toInt()) {
|
||||
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test6() {
|
||||
while (true) {
|
||||
class LocalClass(val x: Int) {
|
||||
init {
|
||||
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>break<!>
|
||||
}
|
||||
init {
|
||||
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test7() {
|
||||
while (true) {
|
||||
class LocalClass {
|
||||
val x: Int = if (true) {
|
||||
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>break<!>
|
||||
}
|
||||
else {
|
||||
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test8() {
|
||||
while (true) {
|
||||
class LocalClass(val x: Int) {
|
||||
constructor() : this(if (true) { 42 } else { <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>break<!> })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
public fun test2(): kotlin.Unit
|
||||
public fun test3(): kotlin.Unit
|
||||
public fun test4(): kotlin.Unit
|
||||
public fun test5(): kotlin.Unit
|
||||
public fun test6(): kotlin.Unit
|
||||
public fun test7(): kotlin.Unit
|
||||
public fun test8(): kotlin.Unit
|
||||
Reference in New Issue
Block a user