Add quick-fix to "Unlabeled return inside lambda" inspection #KT-27007 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-10-05 13:21:48 +09:00
committed by Mikhail Glukhikh
parent d7b885159e
commit 725cb88f41
7 changed files with 57 additions and 18 deletions
@@ -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
}
@@ -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
}
@@ -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
}