Lift return out: report also on 'return' keywords #KT-27173 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-10-25 06:24:01 +03:00
committed by Mikhail Glukhikh
parent f771ed5dd8
commit 3e6007e3d3
13 changed files with 120 additions and 8 deletions
@@ -0,0 +1,7 @@
// HIGHLIGHT: INFORMATION
fun test(n: Int): String {
if (n == 1)
<caret>return "one"
else
return "two"
}
@@ -0,0 +1,7 @@
// HIGHLIGHT: INFORMATION
fun test(n: Int): String {
<caret>return if (n == 1)
"one"
else
"two"
}
@@ -0,0 +1,7 @@
// HIGHLIGHT: INFORMATION
fun test(n: Int): String {
if (n == 1)
return "one"
else
<caret>return "two"
}
@@ -0,0 +1,7 @@
// HIGHLIGHT: INFORMATION
fun test(n: Int): String {
<caret>return if (n == 1)
"one"
else
"two"
}
@@ -0,0 +1,8 @@
// HIGHLIGHT: INFORMATION
fun test(): String {
try {
<caret>return "success"
} catch (e: Exception) {
throw e
}
}
@@ -0,0 +1,8 @@
// HIGHLIGHT: INFORMATION
fun test(): String {
<caret>return try {
"success"
} catch (e: Exception) {
throw e
}
}
@@ -0,0 +1,7 @@
// HIGHLIGHT: INFORMATION
fun test(n: Int): String {
when (n) {
1 -> <caret>return "one"
else -> return "two"
}
}
@@ -0,0 +1,7 @@
// HIGHLIGHT: INFORMATION
fun test(n: Int): String {
<caret>return when (n) {
1 -> "one"
else -> "two"
}
}
@@ -0,0 +1,7 @@
// HIGHLIGHT: INFORMATION
fun test(n: Int): String {
when (n) {
1 -> return "one"
else -> <caret>return "two"
}
}
@@ -0,0 +1,7 @@
// HIGHLIGHT: INFORMATION
fun test(n: Int): String {
<caret>return when (n) {
1 -> "one"
else -> "two"
}
}