KTIJ-26057 [AA] Ignore implicit receivers scope when dealing with types in reference shortener

Implicit receivers generally do not affect the resolution of types.
However, they generate scopes which might contain undesirable
classifiers, which can confuse reference shortener.

Dropping all the implicit receivers when dealing with type references
allows completely avoid such undesirable scopes instead of filtering
them by `instanceof` checks.

Also, temporary move `hasTypeParameterFromParent` check higher to the
`findClassifierElementsToShorten`, because ATM we don't know how to
properly decide whether to shorten the fully-qualified inner types
with implicit parameters or not (see KTIJ-26072).

^KTIJ-26057 Fixed
This commit is contained in:
Roman Golyshev
2023-10-23 22:42:29 +02:00
committed by teamcity
parent 65ff684589
commit 44d48510b4
7 changed files with 71 additions and 26 deletions
@@ -0,0 +1,7 @@
package test
class Outer<T> {
inner class Inner
}
fun <T> Outer<T>.test(p: <expr>Outer<T>.Inner</expr>) {}
@@ -0,0 +1,5 @@
Before shortening: Outer<T>.Inner
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,7 @@
package test
class Outer<T> {
class Nested
}
fun <T> Outer<T>.test(p: <expr>Outer.Nested</expr>) {}
@@ -0,0 +1,7 @@
Before shortening: Outer.Nested
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
[type] Outer.Nested
with SHORTEN_AND_STAR_IMPORT:
[type] Outer.Nested