Skip to content

Commit 532d097

Browse files
committed
AST: Implement Requirement::isSatisfied() for SameShape requirements
1 parent 30a1211 commit 532d097

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/AST/GenericSignature.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,6 @@ bool
799799
Requirement::isSatisfied(ArrayRef<Requirement> &conditionalRequirements,
800800
bool allowMissing) const {
801801
switch (getKind()) {
802-
case RequirementKind::SameShape:
803-
llvm_unreachable("Same-shape requirements not supported here");
804-
805802
case RequirementKind::Conformance: {
806803
auto *proto = getProtocolDecl();
807804
auto *module = proto->getParentModule();
@@ -833,6 +830,10 @@ Requirement::isSatisfied(ArrayRef<Requirement> &conditionalRequirements,
833830

834831
case RequirementKind::SameType:
835832
return getFirstType()->isEqual(getSecondType());
833+
834+
case RequirementKind::SameShape:
835+
return (getFirstType()->getReducedShape() ==
836+
getSecondType()->getReducedShape());
836837
}
837838

838839
llvm_unreachable("Bad requirement kind");

0 commit comments

Comments
 (0)