[FIR] Fix NPE on invalid gets with index
^KT-60342 fixed
This commit is contained in:
+6
@@ -100,6 +100,12 @@ public class Fe10IdeNormalAnalysisSourceModuleHLExpressionTypeTestGenerated exte
|
||||
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 {
|
||||
|
||||
+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 {
|
||||
|
||||
+6
@@ -100,6 +100,12 @@ public class FirStandaloneNormalAnalysisSourceModuleHLExpressionTypeTestGenerate
|
||||
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 {
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
class Incomplete {
|
||||
fun get{}
|
||||
}
|
||||
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
var incomplete: Incomplete = Incomplete(1)
|
||||
<expr>incomplete[0]</expr> += 1
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
expression: incomplete[0]
|
||||
type: kotlin.Unit
|
||||
Reference in New Issue
Block a user