Introduce Variable: Do not replace assignment left-hand sides
#KT-14240 Fixed
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
class Foo(var bar: IntArray)
|
||||
|
||||
fun test() {
|
||||
val foo = Foo(IntArray(1) { 1 })
|
||||
println(<selection>foo.bar</selection>)
|
||||
foo.bar[0] = foo.bar[0] + 1
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
class Foo(var bar: IntArray)
|
||||
|
||||
fun test() {
|
||||
val foo = Foo(IntArray(1) { 1 })
|
||||
val message = foo.bar
|
||||
println(message)
|
||||
message[0] = message[0] + 1
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
class Foo(var bar: Int)
|
||||
|
||||
fun test() {
|
||||
val foo = Foo(1)
|
||||
println(foo.bar)
|
||||
<selection>foo.bar</selection> = foo.bar + 1
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Cannot perform refactoring without an expression
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
class Foo(var bar: Bar)
|
||||
class Bar(var baz: Int)
|
||||
|
||||
fun test() {
|
||||
val foo = Foo(Bar(1))
|
||||
println(<selection>foo.bar</selection>)
|
||||
foo.bar.baz = foo.bar.baz + 1
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
class Foo(var bar: Bar)
|
||||
class Bar(var baz: Int)
|
||||
|
||||
fun test() {
|
||||
val foo = Foo(Bar(1))
|
||||
val message = foo.bar
|
||||
println(message)
|
||||
message.baz = message.baz + 1
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
class Foo(var bar: Int)
|
||||
|
||||
fun test() {
|
||||
val foo = Foo(1)
|
||||
println(<selection>foo.bar</selection>)
|
||||
foo.bar = foo.bar + 1
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
class Foo(var bar: Int)
|
||||
|
||||
fun test() {
|
||||
val foo = Foo(1)
|
||||
val message = foo.bar
|
||||
println(message)
|
||||
foo.bar = message + 1
|
||||
}
|
||||
Reference in New Issue
Block a user