KTIJ-25232 [FIR IDE] Do not shorten properties with non-trivial receiver

If property call receiver is something real (like another property or a
function call), then it should not be shortened because the semantics
might change

^KTIJ-25232 Fixed
This commit is contained in:
Roman Golyshev
2023-04-13 14:39:38 +02:00
committed by teamcity
parent 4ad16d5cf6
commit f662908440
7 changed files with 74 additions and 0 deletions
@@ -0,0 +1,15 @@
// FILE: main.kt
package foo
class Foo {
val self = this
fun selfFun(): Foo = this
<expr>
fun check() {
self.self
selfFun().self
}
</expr>
}
@@ -0,0 +1,8 @@
Before shortening: fun check() {
self.self
selfFun().self
}
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,15 @@
// FILE: main.kt
package foo
object Foo {
val self = this
fun selfFun(): Foo = this
<expr>
fun check() {
self.self
selfFun().self
}
</expr>
}
@@ -0,0 +1,8 @@
Before shortening: fun check() {
self.self
selfFun().self
}
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT: