Skip to content

Commit c5df787

Browse files
committed
RequirementMachine: Fix for redundant protocol refinement via concrete type requirements
1 parent f50c7c9 commit c5df787

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/AST/RequirementMachine/RewriteSystem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ bool Rule::isProtocolRefinementRule() const {
9898
RHS.size() == 1 &&
9999
LHS[0] == RHS[0] &&
100100
LHS[0].getKind() == Symbol::Kind::Protocol &&
101-
LHS[1].getKind() == Symbol::Kind::Protocol &&
101+
(LHS[1].getKind() == Symbol::Kind::Protocol ||
102+
LHS[1].getKind() == Symbol::Kind::ConcreteConformance) &&
102103
LHS[0] != LHS[1]) {
103104

104105
// A protocol refinement rule must be from a directly-stated
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures -requirement-machine-protocol-signatures=on 2>&1 | %FileCheck %s
2+
3+
protocol P {}
4+
class C : P {}
5+
6+
// CHECK-LABEL: redundant_protocol_inheritance_via_concrete.(file).Q@
7+
// CHECK-NEXT: Requirement signature: <Self where Self : C>
8+
protocol Q : P, C {}

0 commit comments

Comments
 (0)