Introduce "Redundant return label" inspection #KT-25270 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-08-06 18:44:27 +03:00
committed by Mikhail Glukhikh
parent b91f30ab15
commit 2dcbf6aa34
19 changed files with 193 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.RedundantReturnLabelInspection
@@ -0,0 +1,9 @@
// PROBLEM: none
fun foo(f: (String?) -> Int) {}
fun test() {
foo(fun(it: String?): Int {
if (it != null) return@foo<caret> 1
return 0
})
}
@@ -0,0 +1,3 @@
fun test() {
return@test<caret>
}
@@ -0,0 +1,3 @@
fun test() {
return
}
@@ -0,0 +1,6 @@
fun test(s: String?): Int {
if (s != null) {
return@test<caret> 1
}
return 0
}
@@ -0,0 +1,6 @@
fun test(s: String?): Int {
if (s != null) {
return 1
}
return 0
}
@@ -0,0 +1,9 @@
// PROBLEM: none
fun foo(f: (String?) -> Int) {}
fun test() {
foo {
if (it != null) return@foo<caret> 1
0
}
}