Quick Fixes: Implement "Create label" quick fix
#KT-8855 Fixed
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
// "Create label foo@" "true"
|
||||
|
||||
fun test() {
|
||||
while (true) {
|
||||
break@<caret>foo
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create label foo@" "true"
|
||||
|
||||
fun test() {
|
||||
foo@ while (true) {
|
||||
<caret>break@foo
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create label foo@" "true"
|
||||
|
||||
fun test() {
|
||||
while (true) {
|
||||
while (true) {
|
||||
break@<caret>foo
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Create label foo@" "true"
|
||||
|
||||
fun test() {
|
||||
foo@ while (true) {
|
||||
while (true) {
|
||||
<caret> break@foo
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Create label foo@" "false"
|
||||
// ERROR: The label '@foo' does not denote a loop
|
||||
// ERROR: Unresolved reference: @foo
|
||||
|
||||
fun bar(f: () -> Unit) { }
|
||||
|
||||
fun test() {
|
||||
while (true) {
|
||||
bar { break@<caret>foo }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create label foo@" "false"
|
||||
// ACTION: Convert to expression body
|
||||
// ERROR: The label '@foo' does not denote a loop
|
||||
// ERROR: Unresolved reference: @foo
|
||||
|
||||
fun test() {
|
||||
break@<caret>foo
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create label foo@" "true"
|
||||
|
||||
fun test() {
|
||||
while (true) {
|
||||
continue@<caret>foo
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create label foo@" "true"
|
||||
|
||||
fun test() {
|
||||
foo@ while (true) {
|
||||
<caret>continue@foo
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Create label foo@" "false"
|
||||
// ACTION: Convert to expression body
|
||||
// ERROR: The label '@foo' does not denote a loop
|
||||
// ERROR: Unresolved reference: @foo
|
||||
|
||||
fun test() {
|
||||
continue@<caret>foo
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create label foo@" "true"
|
||||
|
||||
inline fun Int.bar(f: (Int) -> Unit) { }
|
||||
|
||||
fun test() {
|
||||
1.bar { if (it == 2) return@<caret>foo }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create label foo@" "true"
|
||||
|
||||
inline fun Int.bar(f: (Int) -> Unit) { }
|
||||
|
||||
fun test() {
|
||||
1.bar foo@ { if (it == 2) return@<caret>foo }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create label foo@" "true"
|
||||
|
||||
inline fun Int.bar(f: (Int) -> Unit) { }
|
||||
|
||||
fun test() {
|
||||
1.bar { 2.bar { if (it == 2) return@<caret>foo } }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create label foo@" "true"
|
||||
|
||||
inline fun Int.bar(f: (Int) -> Unit) { }
|
||||
|
||||
fun test() {
|
||||
1.bar foo@ { 2.bar { if (it == 2) return@<caret>foo } }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Create label foo@" "false"
|
||||
// ACTION: Convert to expression body
|
||||
// ERROR: Unresolved reference: @foo
|
||||
|
||||
fun test(): Int {
|
||||
return@<caret>foo 1
|
||||
}
|
||||
Reference in New Issue
Block a user