[FIR] Fix completion of FirDelegatedConstructorCall
Before this fix, changes that were made to the arguments list by calling argumentList.transformArguments() were overriden by replaceArgumentList. This fixes reverses the order in which these calls are made. This also aligns the logic between the completion of qualified accesses and delegated constructor calls. #KT-59102 Fixed
This commit is contained in:
committed by
Space Team
parent
267068546f
commit
4b85776405
+6
@@ -2738,6 +2738,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI
|
||||
runTest("compiler/testData/ir/irText/firProblems/kt55458.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt59102.kt")
|
||||
public void testKt59102() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/kt59102.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaInEnumEntryConstructorCall.kt")
|
||||
public void testLambdaInEnumEntryConstructorCall() throws Exception {
|
||||
|
||||
compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java
Generated
+6
@@ -2738,6 +2738,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/kt55458.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt59102.kt")
|
||||
public void testKt59102() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/kt59102.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaInEnumEntryConstructorCall.kt")
|
||||
public void testLambdaInEnumEntryConstructorCall() throws Exception {
|
||||
|
||||
+4
-2
@@ -466,8 +466,6 @@ class FirCallCompletionResultsWriterTransformer(
|
||||
delegatedConstructorCall.calleeReference as? FirNamedReferenceWithCandidate ?: return delegatedConstructorCall
|
||||
val subCandidate = calleeReference.candidate
|
||||
|
||||
val argumentsMapping = runIf(!calleeReference.isError) { calleeReference.candidate.createArgumentsMapping() }
|
||||
delegatedConstructorCall.argumentList.transformArguments(this, argumentsMapping)
|
||||
if (calleeReference.isError) {
|
||||
subCandidate.argumentMapping?.let {
|
||||
delegatedConstructorCall.replaceArgumentList(buildArgumentListForErrorCall(delegatedConstructorCall.argumentList, it))
|
||||
@@ -478,6 +476,10 @@ class FirCallCompletionResultsWriterTransformer(
|
||||
delegatedConstructorCall.replaceArgumentList(buildResolvedArgumentList(it, delegatedConstructorCall.argumentList.source))
|
||||
}
|
||||
}
|
||||
|
||||
val argumentsMapping = runIf(!calleeReference.isError) { subCandidate.createArgumentsMapping() }
|
||||
delegatedConstructorCall.argumentList.transformArguments(this, argumentsMapping)
|
||||
|
||||
return delegatedConstructorCall.apply {
|
||||
replaceCalleeReference(calleeReference.toResolvedReference())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user