File tree Expand file tree Collapse file tree 4 files changed +16
-9
lines changed
lib/AST/RequirementMachine Expand file tree Collapse file tree 4 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -396,7 +396,7 @@ void MinimalConformances::collectConformanceRules() {
396
396
continue ;
397
397
398
398
// Save protocol refinement relations in a side table.
399
- if (rule.isProtocolRefinementRule ())
399
+ if (rule.isProtocolRefinementRule (Context ))
400
400
ProtocolRefinements.insert (ruleID);
401
401
402
402
if (!System.isInMinimizationDomain (rule.getLHS ().getRootProtocol ()))
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ bool Rule::isIdentityConformanceRule() const {
93
93
94
94
// / If this is a rule of the form [P].[Q] => [P] where [P] and [Q] are
95
95
// / protocol symbols, return true, otherwise return false.
96
- bool Rule::isProtocolRefinementRule () const {
96
+ bool Rule::isProtocolRefinementRule (RewriteContext &ctx ) const {
97
97
if (LHS.size () == 2 &&
98
98
RHS.size () == 1 &&
99
99
LHS[0 ] == RHS[0 ] &&
@@ -111,7 +111,7 @@ bool Rule::isProtocolRefinementRule() const {
111
111
auto *proto = LHS[0 ].getProtocol ();
112
112
auto *otherProto = LHS[1 ].getProtocol ();
113
113
114
- auto inherited = proto-> getInheritedProtocols ();
114
+ auto inherited = ctx. getInheritedProtocols (proto );
115
115
return (std::find (inherited.begin (), inherited.end (), otherProto)
116
116
!= inherited.end ());
117
117
}
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ class Rule final {
108
108
109
109
bool isIdentityConformanceRule () const ;
110
110
111
- bool isProtocolRefinementRule () const ;
111
+ bool isProtocolRefinementRule (RewriteContext &ctx ) const ;
112
112
113
113
bool isCircularConformanceRule () const ;
114
114
Original file line number Diff line number Diff line change 1
1
// RUN: %target-typecheck-verify-swift
2
2
// RUN: %target-swift-frontend -typecheck -debug-generic-signatures -requirement-machine-protocol-signatures=verify %s 2>&1 | %FileCheck %s
3
3
4
- protocol Base { }
5
-
6
4
// CHECK-LABEL: redundant_protocol_refinement.(file).Base@
7
5
// CHECK-LABEL: Requirement signature: <Self>
8
-
9
- protocol Middle : Base { }
6
+ protocol Base { }
10
7
11
8
// CHECK-LABEL: redundant_protocol_refinement.(file).Middle@
12
9
// CHECK-LABEL: Requirement signature: <Self where Self : Base>
10
+ protocol Middle : Base { }
13
11
12
+ // CHECK-LABEL: redundant_protocol_refinement.(file).Derived@
13
+ // CHECK-LABEL: Requirement signature: <Self where Self : Middle>
14
14
protocol Derived : Middle , Base { }
15
15
// expected-note@-1 {{conformance constraint 'Self' : 'Base' implied here}}
16
16
// expected-warning@-2 {{redundant conformance constraint 'Self' : 'Base'}}
17
17
18
- // CHECK-LABEL: redundant_protocol_refinement.(file).Derived @
18
+ // CHECK-LABEL: redundant_protocol_refinement.(file).Derived2 @
19
19
// CHECK-LABEL: Requirement signature: <Self where Self : Middle>
20
+ protocol Derived2 : Middle { }
21
+
22
+ // CHECK-LABEL: redundant_protocol_refinement.(file).MoreDerived@
23
+ // CHECK-LABEL: Requirement signature: <Self where Self : Derived2>
24
+ protocol MoreDerived : Derived2 , Base { }
25
+ // expected-note@-1 {{conformance constraint 'Self' : 'Base' implied here}}
26
+ // expected-warning@-2 {{redundant conformance constraint 'Self' : 'Base'}}
20
27
21
28
protocol P1 { }
22
29
You can’t perform that action at this time.
0 commit comments