[FIR] Transform children independently when callee is an error

To make sure all possible types are resolved and any additional errors
are reported, resolve children of function calls using independent
resolution mode when the callee reference is an error.

#KT-59041 Fixed
This commit is contained in:
Brian Norman
2023-06-13 10:07:09 -05:00
committed by Space Team
parent 2f36886bac
commit 6b5e7ae825
8 changed files with 43 additions and 1 deletions
@@ -14428,6 +14428,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/incompleteCode/kt4866UnresolvedArrayAccess.kt");
}
@Test
@TestMetadata("kt59041.kt")
public void testKt59041() throws Exception {
runTest("compiler/testData/diagnostics/tests/incompleteCode/kt59041.kt");
}
@Test
@TestMetadata("NoSenselessComparisonForErrorType.kt")
public void testNoSenselessComparisonForErrorType() throws Exception {
@@ -14428,6 +14428,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/incompleteCode/kt4866UnresolvedArrayAccess.kt");
}
@Test
@TestMetadata("kt59041.kt")
public void testKt59041() throws Exception {
runTest("compiler/testData/diagnostics/tests/incompleteCode/kt59041.kt");
}
@Test
@TestMetadata("NoSenselessComparisonForErrorType.kt")
public void testNoSenselessComparisonForErrorType() throws Exception {
@@ -14428,6 +14428,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/incompleteCode/kt4866UnresolvedArrayAccess.kt");
}
@Test
@TestMetadata("kt59041.kt")
public void testKt59041() throws Exception {
runTest("compiler/testData/diagnostics/tests/incompleteCode/kt59041.kt");
}
@Test
@TestMetadata("NoSenselessComparisonForErrorType.kt")
public void testNoSenselessComparisonForErrorType() throws Exception {
@@ -14434,6 +14434,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/incompleteCode/kt4866UnresolvedArrayAccess.kt");
}
@Test
@TestMetadata("kt59041.kt")
public void testKt59041() throws Exception {
runTest("compiler/testData/diagnostics/tests/incompleteCode/kt59041.kt");
}
@Test
@TestMetadata("NoSenselessComparisonForErrorType.kt")
public void testNoSenselessComparisonForErrorType() throws Exception {
@@ -413,7 +413,7 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
// The callee reference can be resolved as an error very early, e.g., `super` as a callee during raw FIR creation.
// We still need to visit/transform other parts, e.g., call arguments, to check if any other errors are there.
if (calleeReference !is FirResolvedNamedReference) {
functionCall.transformChildren(transformer, data)
functionCall.transformChildren(transformer, ResolutionMode.ContextIndependent)
}
return functionCall
}
@@ -0,0 +1,6 @@
// COMPARE_WITH_LIGHT_TREE
// !DIAGNOSTICS: -UNUSED_VARIABLE
fun main() {
val list = <!UNRESOLVED_REFERENCE!>mutable<!> ListOf<!SYNTAX!><<!>Int<!SYNTAX{LT}!><!SYNTAX!>><!>(1) {}<!>
}
@@ -0,0 +1,6 @@
// COMPARE_WITH_LIGHT_TREE
// !DIAGNOSTICS: -UNUSED_VARIABLE
fun main() {
val list = <!UNRESOLVED_REFERENCE!>mutable<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>ListOf<!><!SYNTAX!><<!><!DEBUG_INFO_MISSING_UNRESOLVED!>Int<!><!SYNTAX!>><!>(1) {}
}
@@ -14434,6 +14434,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/incompleteCode/kt4866UnresolvedArrayAccess.kt");
}
@Test
@TestMetadata("kt59041.kt")
public void testKt59041() throws Exception {
runTest("compiler/testData/diagnostics/tests/incompleteCode/kt59041.kt");
}
@Test
@TestMetadata("NoSenselessComparisonForErrorType.kt")
public void testNoSenselessComparisonForErrorType() throws Exception {