Skip to content

Commit eb56862

Browse files
committed
Sema: Clean up getMemberReferenceTypeFromOpenedType()
1 parent dd41eeb commit eb56862

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lib/Sema/TypeOfReference.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,19 +1471,13 @@ Type ConstraintSystem::getMemberReferenceTypeFromOpenedType(
14711471
getDynamicSelfReplacementType(baseObjTy, value, locator);
14721472

14731473
if (auto func = dyn_cast<AbstractFunctionDecl>(value)) {
1474-
if (func->hasDynamicSelfResult() &&
1474+
if (isa<ConstructorDecl>(func) &&
14751475
!baseObjTy->getOptionalObjectType()) {
14761476
type = type->replaceCovariantResultType(replacementTy, 2);
14771477
}
1478-
} else if (auto *decl = dyn_cast<SubscriptDecl>(value)) {
1479-
if (decl->getElementInterfaceType()->hasDynamicSelfType()) {
1480-
type = type->replaceCovariantResultType(replacementTy, 2);
1481-
}
1482-
} else if (auto *decl = dyn_cast<VarDecl>(value)) {
1483-
if (decl->getValueInterfaceType()->hasDynamicSelfType()) {
1484-
type = type->replaceCovariantResultType(replacementTy, 1);
1485-
}
14861478
}
1479+
1480+
type = type->replaceDynamicSelfType(replacementTy);
14871481
}
14881482

14891483
// Check if we need to apply a layer of optionality to the uncurried type.

0 commit comments

Comments
 (0)