Add quick-fix to "Unlabeled return inside lambda" inspection #KT-27007 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
d7b885159e
commit
725cb88f41
+6
-4
@@ -1,7 +1,9 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
listOf(1).forEach {
|
||||
if (it == 10) <caret>return@forEach
|
||||
inline fun foo(f: () -> Unit) {}
|
||||
|
||||
fun test(): Int {
|
||||
foo {
|
||||
<caret>return@test 0
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// PROBLEM: none
|
||||
// DISABLE-ERRORS
|
||||
fun foo(f: () -> Unit) {}
|
||||
|
||||
fun test(): Int {
|
||||
foo {
|
||||
return<caret> 0
|
||||
}
|
||||
return 1
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
// FIX: none
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
listOf(1).forEach {
|
||||
if (it == 10) <caret>return
|
||||
inline fun foo(f: () -> Unit) {}
|
||||
|
||||
fun test(): Int {
|
||||
foo {
|
||||
return<caret> 0
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
inline fun foo(f: () -> Unit) {}
|
||||
|
||||
fun test(): Int {
|
||||
foo {
|
||||
return@test 0
|
||||
}
|
||||
return 1
|
||||
}
|
||||
+8
-6
@@ -1,9 +1,11 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
listOf(1).forEach {
|
||||
fun foo() {
|
||||
if (it == 10) <caret>return
|
||||
inline fun foo(f: () -> Unit) {}
|
||||
|
||||
fun test(): Int {
|
||||
foo {
|
||||
fun bar() {
|
||||
return<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1
|
||||
}
|
||||
Reference in New Issue
Block a user