Introduce quick-fix adding label to 'return' in closures #KT-16851 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
2f7ab1c0c1
commit
56d712a02a
@@ -0,0 +1,17 @@
|
||||
// "Change to 'return@forEach'" "true"
|
||||
// ACTION: Change to 'return@foo'
|
||||
// ACTION: Introduce local variable
|
||||
// ERROR: The integer literal does not conform to the expected type Unit
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(f:()->Int){}
|
||||
|
||||
fun bar() {
|
||||
|
||||
foo {
|
||||
listOf(1).forEach {
|
||||
return<caret> 1
|
||||
}
|
||||
return@foo 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// "Change to 'return@forEach'" "true"
|
||||
// ACTION: Change to 'return@foo'
|
||||
// ACTION: Introduce local variable
|
||||
// ERROR: The integer literal does not conform to the expected type Unit
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(f:()->Int){}
|
||||
|
||||
fun bar() {
|
||||
|
||||
foo {
|
||||
listOf(1).forEach {
|
||||
return@forEach 1
|
||||
}
|
||||
return@foo 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Change to 'return@foo'" "true"
|
||||
// ACTION: Change to 'return@forEach'
|
||||
// ACTION: Introduce local variable
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(f:()->Int){}
|
||||
|
||||
fun bar() {
|
||||
|
||||
foo {
|
||||
listOf(1).forEach {
|
||||
return<caret> 1
|
||||
}
|
||||
return@foo 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// "Change to 'return@foo'" "true"
|
||||
// ACTION: Change to 'return@forEach'
|
||||
// ACTION: Introduce local variable
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(f:()->Int){}
|
||||
|
||||
fun bar() {
|
||||
|
||||
foo {
|
||||
listOf(1).forEach {
|
||||
return@foo 1
|
||||
}
|
||||
return@foo 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Change to 'return@init'" "false"
|
||||
// ACTION: Introduce local variable
|
||||
// ERROR: 'return' is not allowed here
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo {
|
||||
init {
|
||||
return<caret> 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Change to 'return@foo'" "true"
|
||||
|
||||
fun foo(f:()->Int){}
|
||||
|
||||
fun bar() {
|
||||
foo {
|
||||
return<caret> 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Change to 'return@foo'" "true"
|
||||
|
||||
fun foo(f:()->Int){}
|
||||
|
||||
fun bar() {
|
||||
foo {
|
||||
return@foo 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user