KT-62675 [AA] Handle labeled this expressions in reference shortener
At the moment, there is no good way to meaningfully filter `this` expressions. The filters for the reference shortener can work only with symbols, and it does not make a lot of sense to check any particular symbol when deciding whether to shorten a labeled `this` expression. We would probably need a better API for the shortener to be able to filter more precisely (see KT-63555) ^KT-62675 Fixed
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class Regular {
|
||||
fun one() {}
|
||||
}
|
||||
|
||||
fun Regular.usage() {
|
||||
<expr>this@usage.one()</expr>
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
Before shortening: this@usage.one()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] this@usage.one()
|
||||
[thisLabel] this@usage
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] this@usage.one()
|
||||
[thisLabel] this@usage
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] this@usage.one()
|
||||
[thisLabel] this@usage
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package test
|
||||
|
||||
class Regular {
|
||||
fun one() {}
|
||||
}
|
||||
|
||||
fun test(action: Regular.() -> Unit) {}
|
||||
|
||||
fun Regular.usage() {
|
||||
test {
|
||||
<expr>this@usage.one()</expr>
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: this@usage.one()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package test
|
||||
|
||||
class Regular {
|
||||
fun one() {}
|
||||
}
|
||||
|
||||
fun Regular.usage() {
|
||||
fun Regular.local() {
|
||||
<expr>this@usage.one()</expr>
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: this@usage.one()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package test
|
||||
|
||||
class Regular {
|
||||
fun one() {}
|
||||
}
|
||||
|
||||
fun test(action: Regular.() -> Unit) {}
|
||||
|
||||
fun usage() {
|
||||
test {
|
||||
<expr>this@test.one()</expr>
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
Before shortening: this@test.one()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] this@test.one()
|
||||
[thisLabel] this@test
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] this@test.one()
|
||||
[thisLabel] this@test
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] this@test.one()
|
||||
[thisLabel] this@test
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package test
|
||||
|
||||
class Regular {
|
||||
fun one() {}
|
||||
}
|
||||
|
||||
fun test(action: Regular.() -> Unit) {}
|
||||
|
||||
fun usage() {
|
||||
test {
|
||||
test r2@{
|
||||
<expr>this@test.one()</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: this@test.one()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class Regular {
|
||||
fun one() {}
|
||||
|
||||
fun usage() {
|
||||
<expr>this@Regular.one()</expr>
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
Before shortening: this@Regular.one()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[qualifier] this@Regular.one()
|
||||
[thisLabel] this@Regular
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] this@Regular.one()
|
||||
[thisLabel] this@Regular
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] this@Regular.one()
|
||||
[thisLabel] this@Regular
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package test
|
||||
|
||||
class Other {
|
||||
fun one() {}
|
||||
}
|
||||
|
||||
class Regular {
|
||||
fun one() {}
|
||||
|
||||
fun Other.usage() {
|
||||
<expr>this@Regular.one()</expr>
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: this@Regular.one()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package test
|
||||
|
||||
class Regular {
|
||||
fun one() {}
|
||||
|
||||
inner class Inner {
|
||||
fun usage() {
|
||||
<expr>this@Regular.one()</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
Before shortening: this@Regular.one()
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
Reference in New Issue
Block a user