@@ -999,30 +999,6 @@ namespace {
999999 return false ;
10001000 }
10011001
1002- // / If the given parameter \p param has non-trivial ownership semantics,
1003- // / adjust the type of the given expression \p expr to reflect it. The
1004- // / expression is expected to serve as either an argument or reference
1005- // / to the parameter.
1006- void adjustExprOwnershipForParam (Expr *expr,
1007- const AnyFunctionType::Param ¶m) {
1008- // If the 'self' parameter has non-trivial ownership, adjust the
1009- // argument accordingly.
1010- switch (param.getValueOwnership ()) {
1011- case ValueOwnership::Default:
1012- case ValueOwnership::InOut:
1013- break ;
1014-
1015- case ValueOwnership::Owned:
1016- case ValueOwnership::Shared:
1017- assert (param.getPlainType ()->isEqual (cs.getType (expr)));
1018-
1019- expr->setType (ParenType::get (cs.getASTContext (), param.getPlainType (),
1020- param.getParameterFlags ()));
1021- cs.cacheType (expr);
1022- break ;
1023- }
1024- }
1025-
10261002 // / Build the call inside the body of a single curry thunk
10271003 // / "{ args in base.fn(args) }".
10281004 // /
@@ -1049,10 +1025,6 @@ namespace {
10491025 baseExpr =
10501026 coerceToType (baseExpr, calleeSelfParam.getOldType (), locator);
10511027
1052- // If the 'self' parameter has non-trivial ownership, adjust the
1053- // argument type accordingly.
1054- adjustExprOwnershipForParam (baseExpr, calleeSelfParam);
1055-
10561028 // Uncurry the callee type in the presence of a base expression; we
10571029 // want '(args) -> result' vs. '(self) -> (args) -> result'.
10581030 calleeFnTy = calleeFnTy->getResult ()->castTo <FunctionType>();
@@ -1357,11 +1329,6 @@ namespace {
13571329
13581330 selfOpenedRef = new (ctx) OpaqueValueExpr (SourceLoc (), opaqueValueTy);
13591331 cs.cacheType (selfOpenedRef);
1360-
1361- // If we're opening an existential and the thunk's 'self' parameter has
1362- // non-trivial ownership, we must adjust the parameter reference type
1363- // here, because the body will use the opaque value instead.
1364- adjustExprOwnershipForParam (selfParamRef, selfThunkParam);
13651332 }
13661333
13671334 Expr *outerThunkBody = nullptr ;
@@ -1385,11 +1352,6 @@ namespace {
13851352
13861353 // Close the existential if warranted.
13871354 if (hasOpenedExistential) {
1388- // If the callee's 'self' parameter has non-trivial ownership, adjust
1389- // the argument type accordingly.
1390- adjustExprOwnershipForParam (selfOpenedRef,
1391- selfCalleeTy->getParams ().front ());
1392-
13931355 outerThunkBody = new (ctx) OpenExistentialExpr (
13941356 selfParamRef, cast<OpaqueValueExpr>(selfOpenedRef),
13951357 outerThunkBody, outerThunkBody->getType ());
0 commit comments