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 -> {
|
||||
|
||||
Vendored
+6
-3
@@ -1,7 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
<caret>val a = create()
|
||||
use(a, a)
|
||||
foo()
|
||||
run {
|
||||
val a = create()
|
||||
use(a, a)
|
||||
foo()
|
||||
}
|
||||
}
|
||||
|
||||
fun create(): String = ""
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
when<caret> (val a = create()) {
|
||||
else -> {
|
||||
|
||||
Vendored
+6
-3
@@ -1,7 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
<caret>val a = create()
|
||||
use("")
|
||||
foo()
|
||||
run {
|
||||
val a = create()
|
||||
use("")
|
||||
foo()
|
||||
}
|
||||
}
|
||||
|
||||
fun create(): String = ""
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
when<caret> (val a = 42) {
|
||||
else -> {
|
||||
|
||||
Vendored
+2
-1
@@ -1,5 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
<caret>use("")
|
||||
use("")
|
||||
foo()
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
when<caret> (val a = create()) {
|
||||
else -> {
|
||||
|
||||
Vendored
+6
-2
@@ -1,6 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
<caret>use(create())
|
||||
foo()
|
||||
run {
|
||||
val a = create()
|
||||
use(a)
|
||||
foo()
|
||||
}
|
||||
}
|
||||
|
||||
fun create(): String = ""
|
||||
|
||||
Reference in New Issue
Block a user