[Analysis API] fix "Unexpected class FirTypeProjectionWithVarianceImpl" exception

from KtFirExpressionTypeProvider.getKtExpressionType

^KTIJ-23432 fixed
This commit is contained in:
Ilya Kirillov
2023-05-04 19:54:06 +02:00
parent 89dbc4daec
commit 4c69f2fbcb
8 changed files with 36 additions and 2 deletions
@@ -83,6 +83,9 @@ internal class KtFirExpressionTypeProvider(
// `false` does not have a corresponding elements on the FIR side and hence the containing `FirWhenBranch` is returned. In this
// case, we simply report null since FIR does not know about it.
is FirWhenBranch -> null
// `listOf<_>(1)` where `expression` is `_`
is FirPlaceholderProjection -> null
else -> error("Unexpected ${fir?.let { it::class }} for ${expression::class} with text `${expression.text}`")
}
}
@@ -232,6 +232,12 @@ public class FirIdeDependentAnalysisSourceModuleHLExpressionTypeTestGenerated ex
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/stringLiteral.kt");
}
@Test
@TestMetadata("underscoreTypeArgument.kt")
public void testUnderscoreTypeArgument() throws Exception {
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/underscoreTypeArgument.kt");
}
@Test
@TestMetadata("unresolvedSuper_multipleSuperTypes.kt")
public void testUnresolvedSuper_multipleSuperTypes() throws Exception {
@@ -232,6 +232,12 @@ public class FirIdeNormalAnalysisSourceModuleHLExpressionTypeTestGenerated exten
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/stringLiteral.kt");
}
@Test
@TestMetadata("underscoreTypeArgument.kt")
public void testUnderscoreTypeArgument() throws Exception {
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/underscoreTypeArgument.kt");
}
@Test
@TestMetadata("unresolvedSuper_multipleSuperTypes.kt")
public void testUnresolvedSuper_multipleSuperTypes() throws Exception {