@@ -10720,17 +10720,28 @@ ConstraintSystem::simplifyApplicableFnConstraint(
1072010720 /* RParen=*/ SourceLoc (),
1072110721 /* firstTrailingClosureIndex=*/ 0 );
1072210722
10723+ // The base expression for `.callAsFunction`.
10724+ auto *baseExpr = castToExpr (argumentsLoc->getAnchor ());
10725+
1072310726 SmallVector<Identifier, 2 > closureLabelsScratch;
1072410727 // Create implicit `.callAsFunction` expression to use as an anchor
1072510728 // for new argument list that only has trailing closures in it.
1072610729 auto *implicitCall = UnresolvedDotExpr::createImplicit (
10727- ctx, getAsExpr (argumentsLoc-> getAnchor ()) , {ctx.Id_callAsFunction },
10730+ ctx, baseExpr , {ctx.Id_callAsFunction },
1072810731 implicitCallArgumentList->getArgumentLabels (closureLabelsScratch));
1072910732
10730- associateArgumentList (
10731- getConstraintLocator (implicitCall,
10732- ConstraintLocator::ApplyArgument),
10733- implicitCallArgumentList);
10733+ {
10734+
10735+ // Record new root in the constraint system.
10736+ ImplicitCallAsFunctionRoots.insert ({calleeLoc, implicitCall});
10737+
10738+ setType (implicitCall, callAsFunctionResultTy);
10739+
10740+ associateArgumentList (
10741+ getConstraintLocator (implicitCall,
10742+ ConstraintLocator::ApplyArgument),
10743+ implicitCallArgumentList);
10744+ }
1073410745
1073510746 auto callAsFunctionArguments =
1073610747 FunctionType::get (trailingClosureTypes, callAsFunctionResultTy,
0 commit comments