[Analysis API FIR] fix call resolution on error elements
This commit is contained in:
+5
@@ -124,6 +124,10 @@ internal class KtFe10CallResolver(
|
||||
Errors.UNRESOLVED_REFERENCE,
|
||||
)
|
||||
|
||||
private val syntaxErrors = setOf(
|
||||
Errors.ASSIGNMENT_IN_EXPRESSION_CONTEXT,
|
||||
)
|
||||
|
||||
val diagnosticWithResolvedCallsAtPosition1 = setOf(
|
||||
Errors.OVERLOAD_RESOLUTION_AMBIGUITY,
|
||||
Errors.NONE_APPLICABLE,
|
||||
@@ -640,6 +644,7 @@ internal class KtFe10CallResolver(
|
||||
diagnostics: Diagnostics = context.diagnostics
|
||||
) = diagnostics.firstOrNull { diagnostic ->
|
||||
if (diagnostic.severity != Severity.ERROR) return@firstOrNull false
|
||||
if (diagnostic.factory in syntaxErrors) return@firstOrNull true
|
||||
val isResolutionError = diagnostic.factory in resolutionFailureErrors
|
||||
val isCallArgError = diagnostic.factory in callArgErrors
|
||||
val reportedPsi = diagnostic.psiElement
|
||||
|
||||
+16
@@ -854,6 +854,22 @@ public class Fe10IdeNormalAnalysisSourceModuleResolveCallTestGenerated extends A
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class InvalidCode {
|
||||
@Test
|
||||
public void testAllFilesPresentInInvalidCode() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("getterAssignment.kt")
|
||||
public void testGetterAssignment() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode/getterAssignment.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/nonCalls")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Reference in New Issue
Block a user