Skip to content

Commit f1c4e14

Browse files
committed
[Type checker] Eliminate generation of useless constraints NFC.
There's no point in adding the constraints known on an associated type to the constraint system, because they're implied by the protocol constraint itself.
1 parent b36bd89 commit f1c4e14

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -468,25 +468,6 @@ namespace {
468468
FunctionRefKind::Compound,
469469
locator));
470470

471-
if (!archetype) {
472-
// If the nested type is not an archetype (because it was constrained
473-
// to a concrete type by a requirement), return the fresh type
474-
// variable now, and let binding occur during overload resolution.
475-
return memberTypeVar;
476-
}
477-
478-
// FIXME: Would be better to walk the requirements of the protocol
479-
// of which the associated type is a member.
480-
if (auto superclass = member->getSuperclass()) {
481-
CS.addConstraint(ConstraintKind::Subtype, memberTypeVar,
482-
superclass, locator);
483-
}
484-
485-
for (auto proto : member->getConformingProtocols()) {
486-
CS.addConstraint(ConstraintKind::ConformsTo, memberTypeVar,
487-
proto->getDeclaredType(), locator);
488-
}
489-
490471
return memberTypeVar;
491472
});
492473
}

0 commit comments

Comments
 (0)