[FIR] Fix NPE on invalid gets with index
^KT-60342 fixed
This commit is contained in:
+1
-1
@@ -154,7 +154,7 @@ internal class KtFirExpressionTypeProvider(
|
||||
val assignment = expression.parent as? KtBinaryExpression ?: return null
|
||||
if (assignment.operationToken !in KtTokens.ALL_ASSIGNMENTS) return null
|
||||
if (assignment.left != expression) return null
|
||||
val setTargetParameterType = fir.argumentsToSubstitutedValueParameters()?.values?.last()?.substitutedType ?: return null
|
||||
val setTargetParameterType = fir.argumentsToSubstitutedValueParameters()?.values?.lastOrNull()?.substitutedType ?: return null
|
||||
return setTargetParameterType.asKtType()
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -100,6 +100,12 @@ public class FirIdeDependentAnalysisSourceModuleHLExpressionTypeTestGenerated ex
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/inParens.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incompleteGet.kt")
|
||||
public void testIncompleteGet() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/incompleteGet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("insideStringTemplate.kt")
|
||||
public void testInsideStringTemplate() throws Exception {
|
||||
|
||||
+6
@@ -100,6 +100,12 @@ public class FirIdeNormalAnalysisSourceModuleHLExpressionTypeTestGenerated exten
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/inParens.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incompleteGet.kt")
|
||||
public void testIncompleteGet() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/expressionTypeProvider/expressionType/incompleteGet.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("insideStringTemplate.kt")
|
||||
public void testInsideStringTemplate() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user