Replace return with 'if'/'when': don't drop return label
#KT-30414 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
9a2178d96b
commit
39016594b1
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
fun main() {
|
||||
run label@{
|
||||
<caret>return@label if (true) {
|
||||
42
|
||||
} else {
|
||||
42
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
fun main() {
|
||||
run label@{
|
||||
<caret>if (true) {
|
||||
return@label 42
|
||||
} else {
|
||||
return@label 42
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
fun main() {
|
||||
run label@{
|
||||
<caret>return@label when {
|
||||
true ->
|
||||
42
|
||||
else -> 42
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
fun main() {
|
||||
run label@{
|
||||
<caret>when {
|
||||
true ->
|
||||
return@label 42
|
||||
else -> return@label 42
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user