[K2]: Compiler crashes when array literal is used in delegate expression
FirCallResolver tries to find a candidate for the delegate's getValue and cannot parse an arrayLiteral with a nullable coneType.Running FirCallCompletionResultsWriterTransformer.transformArrayLiteral is required to find the result type. Therefore, completeCall should not be invoked with the ResolutionMode from the 'data' param, but rather in ResolutionMode.ContextIndependent. #KT-65022 Fixed
This commit is contained in:
committed by
Space Team
parent
b4bc576d37
commit
1bb6f869a2
+6
@@ -176,6 +176,12 @@ public class DiagnosticCompilerTestFirTestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/definitelyNotNullAmbiguity.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegateByArrayLiteral.kt")
|
||||
public void testDelegateByArrayLiteral() {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/delegateByArrayLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegatedSuperType.kt")
|
||||
public void testDelegatedSuperType() {
|
||||
|
||||
+6
@@ -176,6 +176,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/definitelyNotNullAmbiguity.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegateByArrayLiteral.kt")
|
||||
public void testDelegateByArrayLiteral() {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/delegateByArrayLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegatedSuperType.kt")
|
||||
public void testDelegatedSuperType() {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
FILE: delegateByArrayLiteral.kt
|
||||
public final val d: <ERROR TYPE REF: Unresolved name: getValue>by <implicitArrayOf>()
|
||||
public get(): <ERROR TYPE REF: Unresolved name: getValue> {
|
||||
^ D|/d|.<Unresolved name: getValue>#(Null(null), ::R|/d|)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
// ISSUE: KT-65022
|
||||
|
||||
val d by <!DELEGATE_SPECIAL_FUNCTION_MISSING, UNSUPPORTED!>[]<!>
|
||||
+6
@@ -176,6 +176,12 @@ public class FirLightTreeDiagnosticsTestGenerated extends AbstractFirLightTreeDi
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/definitelyNotNullAmbiguity.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegateByArrayLiteral.kt")
|
||||
public void testDelegateByArrayLiteral() {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/delegateByArrayLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegatedSuperType.kt")
|
||||
public void testDelegatedSuperType() {
|
||||
|
||||
+6
@@ -176,6 +176,12 @@ public class FirPsiDiagnosticTestGenerated extends AbstractFirPsiDiagnosticTest
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/definitelyNotNullAmbiguity.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegateByArrayLiteral.kt")
|
||||
public void testDelegateByArrayLiteral() {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/delegateByArrayLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegatedSuperType.kt")
|
||||
public void testDelegatedSuperType() {
|
||||
|
||||
+1
-1
@@ -1704,7 +1704,7 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
|
||||
data,
|
||||
)
|
||||
arrayLiteral.transformChildren(transformer, ResolutionMode.ContextDependent)
|
||||
callCompleter.completeCall(syntheticIdCall, data)
|
||||
callCompleter.completeCall(syntheticIdCall, ResolutionMode.ContextIndependent)
|
||||
arrayLiteral
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user