Skip to content

Commit d93b120

Browse files
committed
Sema: Remove usage of replaceCovariantResultType() in CSApply
1 parent 1fbdc20 commit d93b120

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/Sema/CSApply.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2481,19 +2481,21 @@ namespace {
24812481
if (!base)
24822482
return nullptr;
24832483

2484-
const auto hasDynamicSelf =
2485-
subscript->getElementInterfaceType()->hasDynamicSelfType();
2484+
bool hasDynamicSelf = fullSubscriptTy->hasDynamicSelfType();
24862485

24872486
// Form the subscript expression.
24882487
auto subscriptExpr = SubscriptExpr::create(
24892488
ctx, base, args, subscriptRef, isImplicit, semantics);
24902489
cs.setType(subscriptExpr, fullSubscriptTy->getResult());
24912490
subscriptExpr->setIsSuper(isSuper);
2492-
cs.setType(subscriptExpr,
2493-
hasDynamicSelf
2494-
? fullSubscriptTy->getResult()->replaceCovariantResultType(
2495-
containerTy, 0)
2496-
: fullSubscriptTy->getResult());
2491+
2492+
if (!hasDynamicSelf) {
2493+
cs.setType(subscriptExpr, fullSubscriptTy->getResult());
2494+
} else {
2495+
cs.setType(subscriptExpr,
2496+
fullSubscriptTy->getResult()
2497+
->replaceDynamicSelfType(containerTy));
2498+
}
24972499

24982500
Expr *result = subscriptExpr;
24992501
closeExistentials(result, locator);

0 commit comments

Comments
 (0)