[FIR] Fix completion of synthetic call arguments

This commit is contained in:
Mikhail Glukhikh
2020-12-28 13:10:20 +03:00
parent b7a382f097
commit a6534c4653
7 changed files with 33 additions and 4 deletions
@@ -534,13 +534,16 @@ class FirCallCompletionResultsWriterTransformer(
syntheticCall: D,
data: ExpectedArgumentType?,
): CompositeTransformResult<FirStatement> where D : FirResolvable, D : FirExpression {
syntheticCall.transformChildren(this, data?.getExpectedType(syntheticCall)?.toExpectedType())
val calleeReference = syntheticCall.calleeReference as? FirNamedReferenceWithCandidate ?: return syntheticCall.compose()
val declaration = calleeReference.candidate.symbol.fir as? FirSimpleFunction ?: return syntheticCall.compose()
val typeRef = typeCalculator.tryCalculateReturnType(declaration)
syntheticCall.replaceTypeRefWithSubstituted(calleeReference, typeRef)
syntheticCall.transformChildren(
this,
data = data?.getExpectedType(syntheticCall)?.toExpectedType() ?: syntheticCall.typeRef.coneType.toExpectedType()
)
return (syntheticCall.transformCalleeReference(
StoreCalleeReference,