AA: handle underscore as type arguments
^KTIJ-24742 Fixed
This commit is contained in:
committed by
Ilya Kirillov
parent
d73d3c46e2
commit
5455942859
+6
@@ -97,6 +97,12 @@ internal class KtFirTypeProvider(
|
||||
return when (val fir = ktTypeReference.getOrBuildFir(firResolveSession)) {
|
||||
is FirResolvedTypeRef -> fir.coneType.asKtType()
|
||||
is FirDelegatedConstructorCall -> fir.constructedTypeRef.coneType.asKtType()
|
||||
is FirTypeProjectionWithVariance -> {
|
||||
when (val typeRef = fir.typeRef) {
|
||||
is FirResolvedTypeRef -> typeRef.coneType.asKtType()
|
||||
else -> throwUnexpectedFirElementError(fir, ktTypeReference)
|
||||
}
|
||||
}
|
||||
else -> throwUnexpectedFirElementError(fir, ktTypeReference)
|
||||
}
|
||||
}
|
||||
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.fir.test.cases.generated.cases.components.typeProvider;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.fir.test.configurators.AnalysisApiFirTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.typeProvider.AbstractTypeReferenceTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/typeProvider/typeReference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirIdeDependentAnalysisSourceModuleTypeReferenceTestGenerated extends AbstractTypeReferenceTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.Source,
|
||||
AnalysisSessionMode.Dependent,
|
||||
AnalysisApiMode.Ide
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInTypeReference() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/typeProvider/typeReference"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("starProjection.kt")
|
||||
public void testStarProjection() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/starProjection.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypeEntry.kt")
|
||||
public void testSuperTypeEntry() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/superTypeEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypeEntry_withTypeArgument.kt")
|
||||
public void testSuperTypeEntry_withTypeArgument() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/superTypeEntry_withTypeArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeArgument_functionCall.kt")
|
||||
public void testTypeArgument_functionCall() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/typeArgument_functionCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeArgument_superTypeEntry.kt")
|
||||
public void testTypeArgument_superTypeEntry() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/typeArgument_superTypeEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("underscoreTypeArgument_inferred.kt")
|
||||
public void testUnderscoreTypeArgument_inferred() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/underscoreTypeArgument_inferred.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("underscoreTypeArgument_reified.kt")
|
||||
public void testUnderscoreTypeArgument_reified() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/underscoreTypeArgument_reified.kt");
|
||||
}
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.fir.test.cases.generated.cases.components.typeProvider;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.fir.test.configurators.AnalysisApiFirTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.typeProvider.AbstractTypeReferenceTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/typeProvider/typeReference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirIdeNormalAnalysisSourceModuleTypeReferenceTestGenerated extends AbstractTypeReferenceTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.Source,
|
||||
AnalysisSessionMode.Normal,
|
||||
AnalysisApiMode.Ide
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInTypeReference() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/typeProvider/typeReference"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("starProjection.kt")
|
||||
public void testStarProjection() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/starProjection.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypeEntry.kt")
|
||||
public void testSuperTypeEntry() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/superTypeEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypeEntry_withTypeArgument.kt")
|
||||
public void testSuperTypeEntry_withTypeArgument() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/superTypeEntry_withTypeArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeArgument_functionCall.kt")
|
||||
public void testTypeArgument_functionCall() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/typeArgument_functionCall.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeArgument_superTypeEntry.kt")
|
||||
public void testTypeArgument_superTypeEntry() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/typeArgument_superTypeEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("underscoreTypeArgument_inferred.kt")
|
||||
public void testUnderscoreTypeArgument_inferred() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/underscoreTypeArgument_inferred.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("underscoreTypeArgument_reified.kt")
|
||||
public void testUnderscoreTypeArgument_reified() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/typeProvider/typeReference/underscoreTypeArgument_reified.kt");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user