KT-62676 [AA] Collect redundant this qualifiers in reference shortener

^KT-62676 Fixed
This commit is contained in:
Roman Golyshev
2023-10-27 16:30:13 +02:00
committed by teamcity
parent 4ca1f9d492
commit b0f15451fd
31 changed files with 412 additions and 4 deletions
@@ -0,0 +1,9 @@
package test
class Foo
fun Foo.one() {}
fun Foo.usage() {
<expr>this.one()</expr>
}
@@ -0,0 +1,8 @@
Before shortening: this.one()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[qualifier] this.one()
with SHORTEN_AND_IMPORT:
[qualifier] this.one()
with SHORTEN_AND_STAR_IMPORT:
[qualifier] this.one()
@@ -0,0 +1,11 @@
package test
class Foo
fun Foo.one() {}
fun Foo.usage() {
fun one() {}
<expr>this.one()</expr>
}
@@ -0,0 +1,5 @@
Before shortening: this.one()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,9 @@
package test
class Foo {
fun one() {}
fun usage() {
<expr>this.one()</expr>
}
}
@@ -0,0 +1,8 @@
Before shortening: this.one()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[qualifier] this.one()
with SHORTEN_AND_IMPORT:
[qualifier] this.one()
with SHORTEN_AND_STAR_IMPORT:
[qualifier] this.one()
@@ -0,0 +1,11 @@
package test
class Foo {
fun one() {}
fun usage() {
fun one() {}
<expr>this.one()</expr>
}
}
@@ -0,0 +1,5 @@
Before shortening: this.one()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,9 @@
package test
class Foo {
val one: Int
init {
<expr>this.one</expr> = 10
}
}
@@ -0,0 +1,8 @@
Before shortening: this.one
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[qualifier] this.one
with SHORTEN_AND_IMPORT:
[qualifier] this.one
with SHORTEN_AND_STAR_IMPORT:
[qualifier] this.one
@@ -0,0 +1,9 @@
package test
class Foo(one: Int) {
val one: Int
init {
<expr>this.one</expr> = one
}
}
@@ -0,0 +1,5 @@
Before shortening: this.one
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,9 @@
package test
class Foo {
val one: Int = 10
fun usage() {
<expr>this.one</expr>
}
}
@@ -0,0 +1,8 @@
Before shortening: this.one
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[qualifier] this.one
with SHORTEN_AND_IMPORT:
[qualifier] this.one
with SHORTEN_AND_STAR_IMPORT:
[qualifier] this.one
@@ -0,0 +1,14 @@
package test
class Foo {
val one: Int = 10
context(Context)
fun usage() {
<expr>this.one</expr>
}
}
class Context {
val one: Int = 20
}
@@ -0,0 +1,8 @@
Before shortening: this.one
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[qualifier] this.one
with SHORTEN_AND_IMPORT:
[qualifier] this.one
with SHORTEN_AND_STAR_IMPORT:
[qualifier] this.one
@@ -0,0 +1,11 @@
package test
class Foo {
val one: Int = 10
fun usage() {
val one = 20
<expr>this.one</expr>
}
}
@@ -0,0 +1,5 @@
Before shortening: this.one
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,9 @@
package test
class Foo {
val one: Int = 10
fun usage(one: Int) {
<expr>this.one</expr>
}
}
@@ -0,0 +1,5 @@
Before shortening: this.one
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,11 @@
package test
class Foo {
val one: Int = 10
fun usage() {
<expr>this.one</expr>
val one = 20
}
}
@@ -0,0 +1,8 @@
Before shortening: this.one
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[qualifier] this.one
with SHORTEN_AND_IMPORT:
[qualifier] this.one
with SHORTEN_AND_STAR_IMPORT:
[qualifier] this.one
@@ -0,0 +1,9 @@
package test
class Foo
fun Foo?.one() {}
fun Foo?.usage() {
<expr>this.one()</expr>
}
@@ -0,0 +1,8 @@
Before shortening: this.one()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[qualifier] this.one()
with SHORTEN_AND_IMPORT:
[qualifier] this.one()
with SHORTEN_AND_STAR_IMPORT:
[qualifier] this.one()
@@ -0,0 +1,9 @@
package test
class Foo
fun Foo.one() {}
fun Foo?.usage() {
<expr>this?.one()</expr>
}
@@ -0,0 +1,5 @@
Before shortening: this?.one()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT: