KT-41298 "Remove redundant 'with' call" intention works incorrectly with non-local returns and single-expression functions (#3713)

* Remove redundant 'with' call: remove redundant 'return' keyword

#KT-41298 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-09-25 19:48:31 +09:00
committed by GitHub
parent 8a58ada4cd
commit a2f70dfc3d
6 changed files with 47 additions and 3 deletions
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(): Int = <caret>with("") {
println()
return 42
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(): Int {
println()
return 42
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun foo(s: String): Int =
<caret>with("s") {
return 42
}
@@ -0,0 +1,3 @@
// WITH_RUNTIME
fun foo(s: String): Int =
42