@@ -999,30 +999,6 @@ namespace {
999
999
return false ;
1000
1000
}
1001
1001
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
-
1026
1002
// / Build the call inside the body of a single curry thunk
1027
1003
// / "{ args in base.fn(args) }".
1028
1004
// /
@@ -1049,10 +1025,6 @@ namespace {
1049
1025
baseExpr =
1050
1026
coerceToType (baseExpr, calleeSelfParam.getOldType (), locator);
1051
1027
1052
- // If the 'self' parameter has non-trivial ownership, adjust the
1053
- // argument type accordingly.
1054
- adjustExprOwnershipForParam (baseExpr, calleeSelfParam);
1055
-
1056
1028
// Uncurry the callee type in the presence of a base expression; we
1057
1029
// want '(args) -> result' vs. '(self) -> (args) -> result'.
1058
1030
calleeFnTy = calleeFnTy->getResult ()->castTo <FunctionType>();
@@ -1357,11 +1329,6 @@ namespace {
1357
1329
1358
1330
selfOpenedRef = new (ctx) OpaqueValueExpr (SourceLoc (), opaqueValueTy);
1359
1331
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);
1365
1332
}
1366
1333
1367
1334
Expr *outerThunkBody = nullptr ;
@@ -1385,11 +1352,6 @@ namespace {
1385
1352
1386
1353
// Close the existential if warranted.
1387
1354
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
-
1393
1355
outerThunkBody = new (ctx) OpenExistentialExpr (
1394
1356
selfParamRef, cast<OpaqueValueExpr>(selfOpenedRef),
1395
1357
outerThunkBody, outerThunkBody->getType ());
0 commit comments