@@ -8883,7 +8883,8 @@ namespace {
8883
8883
rewriteFunction(closure);
8884
8884
8885
8885
if (AnyFunctionRef(closure).hasExternalPropertyWrapperParameters()) {
8886
- return Action::SkipNode(rewriteClosure(closure));
8886
+ return Action::SkipNode(Rewriter.buildSingleCurryThunk(
8887
+ closure, closure, Rewriter.cs.getConstraintLocator(closure)));
8887
8888
}
8888
8889
8889
8890
return Action::SkipNode(closure);
@@ -8935,49 +8936,6 @@ namespace {
8935
8936
std::optional<SyntacticElementTarget>
8936
8937
rewriteTarget(SyntacticElementTarget target);
8937
8938
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
-
8981
8939
/// Rewrite the function for the given solution.
8982
8940
///
8983
8941
/// \returns true if an error occurred.
@@ -8996,9 +8954,11 @@ namespace {
8996
8954
8997
8955
switch (result) {
8998
8956
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())) {
9001
8959
TypeChecker::checkClosureAttributes(closure);
8960
+ TypeChecker::checkParameterList(closure->getParameters(), closure);
8961
+ }
9002
8962
return false;
9003
8963
}
9004
8964
0 commit comments