Lift return out: do not report for zero returns
Also, do not highlight (but suggest fix) for exactly one return Related to KT-14900
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// HIGHLIGHT: GENERIC_ERROR_OR_WARNING
|
||||
|
||||
fun foo(): Int {
|
||||
loop@ while (true) {
|
||||
<caret>when (1) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// HIGHLIGHT: GENERIC_ERROR_OR_WARNING
|
||||
|
||||
fun foo(): Int {
|
||||
loop@ while (true) {
|
||||
return when (1) {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// HIGHLIGHT: INFORMATION
|
||||
|
||||
fun foo(arg: Int): Int {
|
||||
<caret>when (arg) {
|
||||
0 -> return 0
|
||||
else -> throw Exception()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// HIGHLIGHT: INFORMATION
|
||||
|
||||
fun foo(arg: Int): Int {
|
||||
return when (arg) {
|
||||
0 -> 0
|
||||
else -> throw Exception()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// PROBLEM: none
|
||||
|
||||
fun foo(): Int {
|
||||
<caret>when {
|
||||
else -> throw Exception()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user