KTIJ-28167 [AA] Support SAM constructors in KtFirReferenceShortener

Utilize `FirSamResolver` to obtain the potential SAM constructor
from the classifier

Also, accept K2_SYNTHETIC_RESOLVED in the `resolveUnqualifiedAccess`,
since this is the kind of resolve success which corresponds to the
SAM constructor call resolution

^KTIJ-28167 Fixed
This commit is contained in:
Roman Golyshev
2024-01-04 01:13:38 +01:00
committed by Space Team
parent e561de8a22
commit df8c6c694a
9 changed files with 117 additions and 5 deletions
@@ -466,6 +466,18 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerTestGenera
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/referenceInNestedClass.kt");
}
@Test
@TestMetadata("samInterface_constructorCall.kt")
public void testSamInterface_constructorCall() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/samInterface_constructorCall.kt");
}
@Test
@TestMetadata("samInterface_constructorCall_java.kt")
public void testSamInterface_constructorCall_java() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/samInterface_constructorCall_java.kt");
}
@Test
@TestMetadata("sameNameDifferentParams.kt")
public void testSameNameDifferentParams() throws Exception {
@@ -727,6 +739,12 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerTestGenera
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/nestedClasses/nestedClassFromSupertypes6_java.kt");
}
@Test
@TestMetadata("nestedSamInterface_constructorCall.kt")
public void testNestedSamInterface_constructorCall() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/nestedClasses/nestedSamInterface_constructorCall.kt");
}
@Test
@TestMetadata("TypeWithGenericsAsExtensionReceiverType_innerType.kt")
public void testTypeWithGenericsAsExtensionReceiverType_innerType() throws Exception {