ConstantConditionIfInspection.replaceWithBranch shouldn't remove subjectVariable with side effects
Relates to #KT-30975
This commit is contained in:
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
when<caret> (val a = create()) {
|
||||
else -> use(a, a)
|
||||
|
||||
Vendored
+5
-2
@@ -1,6 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
<caret>val a = create()
|
||||
use(a, a)
|
||||
run {
|
||||
val a = create()
|
||||
use(a, a)
|
||||
}
|
||||
}
|
||||
|
||||
fun create(): String = ""
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
when<caret> (val a = create()) {
|
||||
else -> use("")
|
||||
|
||||
Vendored
+5
-2
@@ -1,6 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
<caret>val a = create()
|
||||
use("")
|
||||
run {
|
||||
val a = create()
|
||||
use("")
|
||||
}
|
||||
}
|
||||
|
||||
fun create(): String = ""
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
fun test() {
|
||||
<caret>use("")
|
||||
use("")
|
||||
}
|
||||
|
||||
fun use(s: String) {}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
when<caret> (val a = create()) {
|
||||
else -> use(a)
|
||||
|
||||
Vendored
+5
-1
@@ -1,5 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
<caret>use(create())
|
||||
run {
|
||||
val a = create()
|
||||
use(a)
|
||||
}
|
||||
}
|
||||
|
||||
fun create(): String = ""
|
||||
|
||||
+4
-1
@@ -1,6 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
val x = <caret>use(create())
|
||||
val x = run {
|
||||
val a = create()
|
||||
use(a)
|
||||
}
|
||||
}
|
||||
|
||||
fun create(): String = ""
|
||||
|
||||
Reference in New Issue
Block a user