KT-60954 [Analysis API] Unwrap variable assignments in KtFirReferenceShortener
To get to the proper qualified expression, we need to unwrap the outer `FirVariableAssignment` if we deal with the property access inside of assignment expressions ^KT-60954 Fixed
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
// FILE: main.kt
|
||||
package test
|
||||
|
||||
fun usage() {
|
||||
<expr>dependency.foo = 20</expr>
|
||||
}
|
||||
|
||||
// FILE: dependency.kt
|
||||
package dependency
|
||||
|
||||
var foo: Int = 10
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Before shortening: dependency.foo = 20
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] dependency.foo
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] dependency.foo
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// FILE: main.kt
|
||||
package test
|
||||
|
||||
fun usage() {
|
||||
<expr>dependency.foo += 20</expr>
|
||||
}
|
||||
|
||||
// FILE: dependency.kt
|
||||
package dependency
|
||||
|
||||
val foo: Foo = Foo()
|
||||
|
||||
class Foo {
|
||||
operator fun plusAssign(i: Int) {}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Before shortening: dependency.foo += 20
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] dependency.foo
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] dependency.foo
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// FILE: main.kt
|
||||
package test
|
||||
|
||||
fun usage() {
|
||||
<expr>dependency.foo += 20</expr>
|
||||
}
|
||||
|
||||
// FILE: dependency.kt
|
||||
package dependency
|
||||
|
||||
var foo: Foo = Foo()
|
||||
|
||||
class Foo {
|
||||
operator fun plus(i: Int): Foo = this
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Before shortening: dependency.foo += 20
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] dependency.foo
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] dependency.foo
|
||||
Reference in New Issue
Block a user