@@ -10720,17 +10720,28 @@ ConstraintSystem::simplifyApplicableFnConstraint(
10720
10720
/* RParen=*/ SourceLoc (),
10721
10721
/* firstTrailingClosureIndex=*/ 0 );
10722
10722
10723
+ // The base expression for `.callAsFunction`.
10724
+ auto *baseExpr = castToExpr (argumentsLoc->getAnchor ());
10725
+
10723
10726
SmallVector<Identifier, 2 > closureLabelsScratch;
10724
10727
// Create implicit `.callAsFunction` expression to use as an anchor
10725
10728
// for new argument list that only has trailing closures in it.
10726
10729
auto *implicitCall = UnresolvedDotExpr::createImplicit (
10727
- ctx, getAsExpr (argumentsLoc-> getAnchor ()) , {ctx.Id_callAsFunction },
10730
+ ctx, baseExpr , {ctx.Id_callAsFunction },
10728
10731
implicitCallArgumentList->getArgumentLabels (closureLabelsScratch));
10729
10732
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
+ }
10734
10745
10735
10746
auto callAsFunctionArguments =
10736
10747
FunctionType::get (trailingClosureTypes, callAsFunctionResultTy,
0 commit comments