File tree Expand file tree Collapse file tree 3 files changed +3
-7
lines changed
lib/AST/RequirementMachine Expand file tree Collapse file tree 3 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -204,7 +204,8 @@ void swift::rewriting::applyInverses(
204204 // func f() where Self: ~Copyable
205205 // }
206206 //
207- if (representativeGPs.find (canSubject) == representativeGPs.end ()) {
207+ auto subjectRoot = canSubject->getDependentMemberRoot ()->getCanonicalType ();
208+ if (representativeGPs.find (subjectRoot) == representativeGPs.end ()) {
208209 errors.push_back (
209210 RequirementError::forInvalidInverseOuterSubject (inverse));
210211 continue ;
Original file line number Diff line number Diff line change @@ -156,10 +156,8 @@ protocol Veggie<A> {
156156}
157157protocol Carrot : Veggie
158158 where Self. NeedsCopyable: ~ Copyable { } // expected-error {{'Self.NeedsCopyable' required to be 'Copyable' but is marked with '~Copyable'}}
159- // expected-error @-1{{cannot suppress '~Copyable' on generic parameter 'Self.NeedsCopyable' defined in outer scope}}
160159
161160protocol CarrotCake : Carrot where Self. A: ~ Copyable { } // expected-error {{'Self.A' required to be 'Copyable' but is marked with '~Copyable'}}
162- // expected-error @-1{{cannot suppress '~Copyable' on generic parameter 'Self.A' defined in outer scope}}
163161
164162func ex1< Cucumber: ~ Copyable, Potato> ( _ nc: any Veggie < Cucumber > , c: any Veggie < Potato > ) {
165163 reqC ( nc. a ( ) ) // expected-error {{global function 'reqC' requires that 'Cucumber' conform to 'Copyable'}}
@@ -171,8 +169,6 @@ protocol Bird {
171169}
172170
173171protocol Eagle : Bird where Self. Song: ~ Copyable { } // expected-error {{'Self.Song' required to be 'Copyable' but is marked with '~Copyable'}}
174- // expected-error @-1{{cannot suppress '~Copyable' on generic parameter 'Self.Song' defined in outer scope}}
175-
176172
177173protocol Pushable < Element> {
178174 associatedtype Element : ~ Copyable
Original file line number Diff line number Diff line change @@ -16,8 +16,7 @@ protocol HasAssoc {
1616 associatedtype A
1717}
1818extension HasAssoc where Self. A: ~ Copyable { }
19- // expected-error@-1 {{cannot suppress '~Copyable' on generic parameter 'Self.A' defined in outer scope}}
20- // expected-error@-2 {{'Self.A' required to be 'Copyable' but is marked with '~Copyable'}}
19+ // expected-error@-1 {{'Self.A' required to be 'Copyable' but is marked with '~Copyable'}}
2120
2221class Box < T: ~ Copyable> { }
2322extension Box where T: ~ Copyable { }
You can’t perform that action at this time.
0 commit comments