@@ -53,7 +53,7 @@ protocol Iterable<Element>: ~Copyable {
5353
5454struct ReqC < T: Copyable > { }
5555
56- func reqC< T: Copyable > ( _ t: T ) { } // expected-note 8 {{'where T: Copyable' is implicit here}}
56+ func reqC< T: Copyable > ( _ t: T ) { } // expected-note 14 {{'where T: Copyable' is implicit here}}
5757
5858
5959protocol ProvideA < A> : ~ Copyable {
@@ -130,9 +130,29 @@ func checkExistential(_ s: any Gen) {
130130 reqC ( s. i ( ) . e ( ) . i ( ) . e ( ) )
131131}
132132
133+ func checkExistential2< R: ~ Copyable> ( _ s: any Gen < R > ) {
134+ reqC ( s. e ( ) ) // expected-error {{global function 'reqC' requires that 'R' conform to 'Copyable'}}
135+ reqC ( s. e ( ) . e ( ) ) // expected-error {{value of type 'R' has no member 'e'}}
136+
137+ reqC ( s. i ( ) ) // expected-error {{requires that 'T' conform to 'Copyable'}}
138+ reqC ( s. i ( ) . e ( ) )
139+ reqC ( s. i ( ) . e ( ) . i ( ) ) // expected-error {{requires that 'T' conform to 'Copyable'}}
140+ reqC ( s. i ( ) . e ( ) . i ( ) . e ( ) )
141+ }
142+
143+ // Suppression on the constrained existential only goes far down
144+ // as possible to suppress on the generic type parameter itself.
145+ func checkExistential3< R> ( _ s: any Gen < R > ) where R: Gen , R: ~ Copyable, R. E: ~ Copyable {
146+ reqC ( s. e ( ) ) // expected-error {{global function 'reqC' requires that 'R' conform to 'Copyable'}}
147+ reqC ( s. e ( ) . e ( ) ) // expected-error {{global function 'reqC' requires that 'R.E' conform to 'Copyable'}}
148+ reqC ( s. e ( ) . e ( ) . e ( ) )
149+ }
150+
133151protocol Veggie < A> {
134152 associatedtype A : ~ Copyable
135153 associatedtype NeedsCopyable
154+
155+ func a( ) -> A
136156}
137157protocol Carrot : Veggie
138158 where Self. NeedsCopyable: ~ Copyable { } // expected-error {{'Self.NeedsCopyable' required to be 'Copyable' but is marked with '~Copyable'}}
@@ -141,6 +161,10 @@ protocol Carrot: Veggie
141161protocol CarrotCake : Carrot where Self. A: ~ Copyable { } // expected-error {{'Self.A' required to be 'Copyable' but is marked with '~Copyable'}}
142162// expected-error @-1{{cannot suppress '~Copyable' on generic parameter 'Self.A' defined in outer scope}}
143163
164+ func ex1< Cucumber: ~ Copyable, Potato> ( _ nc: any Veggie < Cucumber > , c: any Veggie < Potato > ) {
165+ reqC ( nc. a ( ) ) // expected-error {{global function 'reqC' requires that 'Cucumber' conform to 'Copyable'}}
166+ reqC ( c. a ( ) )
167+ }
144168
145169protocol Bird {
146170 associatedtype Song
0 commit comments