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
@@ -643,6 +643,18 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerTestGenera
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/nestedClasses/nestedClassFromSupertypes6_java.kt");
}
@Test
@TestMetadata("TypeWithGenericsAsExtensionReceiverType_innerType.kt")
public void testTypeWithGenericsAsExtensionReceiverType_innerType() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/nestedClasses/TypeWithGenericsAsExtensionReceiverType_innerType.kt");
}
@Test
@TestMetadata("TypeWithGenericsAsExtensionReceiverType_nestedType.kt")
public void testTypeWithGenericsAsExtensionReceiverType_nestedType() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/nestedClasses/TypeWithGenericsAsExtensionReceiverType_nestedType.kt");
}
@Nested
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/nestedClasses/classHeaderPositions")
@TestDataPath("$PROJECT_ROOT")