@@ -8883,7 +8883,8 @@ namespace {
88838883 rewriteFunction (closure);
88848884
88858885 if (AnyFunctionRef (closure).hasExternalPropertyWrapperParameters ()) {
8886- return Action::SkipNode (rewriteClosure (closure));
8886+ return Action::SkipNode (Rewriter.buildSingleCurryThunk (
8887+ closure, closure, Rewriter.cs .getConstraintLocator (closure)));
88878888 }
88888889
88898890 return Action::SkipNode (closure);
@@ -8935,49 +8936,6 @@ namespace {
89358936 std::optional<SyntacticElementTarget>
89368937 rewriteTarget (SyntacticElementTarget target);
89378938
8938- AutoClosureExpr *rewriteClosure (ClosureExpr *closure) {
8939- auto &solution = Rewriter.solution ;
8940-
8941- // Apply types to synthesized property wrapper vars.
8942- for (auto *param : *closure->getParameters ()) {
8943- if (!param->hasAttachedPropertyWrapper ())
8944- continue ;
8945-
8946- // Set the interface type of each property wrapper synthesized var
8947- auto *backingVar = param->getPropertyWrapperBackingProperty ();
8948- auto backingType =
8949- solution.simplifyType (solution.getType (backingVar))->mapTypeOutOfContext ();
8950- backingVar->setInterfaceType (backingType);
8951-
8952- if (auto *projectionVar = param->getPropertyWrapperProjectionVar ()) {
8953- projectionVar->setInterfaceType (
8954- solution.simplifyType (solution.getType (projectionVar))->mapTypeOutOfContext ());
8955- }
8956-
8957- auto *wrappedValueVar = param->getPropertyWrapperWrappedValueVar ();
8958- auto wrappedValueType =
8959- solution.simplifyType (solution.getType (wrappedValueVar))->mapTypeOutOfContext ();
8960- wrappedValueVar->setInterfaceType (wrappedValueType->getWithoutSpecifierType ());
8961-
8962- if (param->hasImplicitPropertyWrapper ()) {
8963- if (wrappedValueType->is <LValueType>())
8964- wrappedValueVar->setImplInfo (StorageImplInfo::getMutableComputed ());
8965-
8966- // Add an explicit property wrapper attribute, which is needed for
8967- // synthesizing the accessors.
8968- auto &context = wrappedValueVar->getASTContext ();
8969- auto *typeExpr = TypeExpr::createImplicit (backingType, context);
8970- auto *attr = CustomAttr::create (context, SourceLoc (), typeExpr, /* implicit=*/ true );
8971- wrappedValueVar->getAttrs ().add (attr);
8972- }
8973- }
8974-
8975- TypeChecker::checkParameterList (closure->getParameters (), closure);
8976-
8977- return Rewriter.buildSingleCurryThunk (
8978- closure, closure, Rewriter.cs .getConstraintLocator (closure));
8979- }
8980-
89818939 // / Rewrite the function for the given solution.
89828940 // /
89838941 // / \returns true if an error occurred.
@@ -8996,9 +8954,11 @@ namespace {
89968954
89978955 switch (result) {
89988956 case SolutionApplicationToFunctionResult::Success: {
8999- if (auto closure = dyn_cast_or_null<ClosureExpr>(
9000- fn.getAbstractClosureExpr ()))
8957+ if (auto closure =
8958+ dyn_cast_or_null<ClosureExpr>( fn.getAbstractClosureExpr ())) {
90018959 TypeChecker::checkClosureAttributes (closure);
8960+ TypeChecker::checkParameterList (closure->getParameters (), closure);
8961+ }
90028962 return false ;
90038963 }
90048964
0 commit comments