File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -1558,18 +1558,17 @@ Type ConstraintSystem::getMemberReferenceTypeFromOpenedType(
15581558 Type type = openedType;
15591559
15601560 // Cope with dynamic 'Self'.
1561- if (!outerDC->getSelfProtocolDecl ()) {
1562- const auto replacementTy =
1563- getDynamicSelfReplacementType (baseObjTy, value, locator);
1564-
1565- if (auto func = dyn_cast<AbstractFunctionDecl>(value)) {
1566- if (isa<ConstructorDecl>(func) &&
1567- func->getDeclContext ()->getSelfClassDecl ()) {
1568- type = type->withCovariantResultType ();
1569- }
1561+ if (outerDC->getSelfClassDecl ()) {
1562+ if (isa<ConstructorDecl>(value)) {
1563+ type = type->withCovariantResultType ();
15701564 }
15711565
1572- type = type->replaceDynamicSelfType (replacementTy);
1566+ if (type->hasDynamicSelfType ()) {
1567+ auto replacementTy = getDynamicSelfReplacementType (
1568+ baseObjTy, value, locator);
1569+
1570+ type = type->replaceDynamicSelfType (replacementTy);
1571+ }
15731572 }
15741573
15751574 // Check if we need to apply a layer of optionality to the uncurried type.
You can’t perform that action at this time.
0 commit comments