You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typealiasB2=protocol<P1,P2> // expected-error {{'protocol<...>' composition syntax has been removed; join the protocols using '&'}} {{16-32=P1 & P2}}
133
133
typealiasB3=protocol<P1,P2> // expected-error {{'protocol<...>' composition syntax has been removed; join the protocols using '&'}} {{16-32=P1 & P2}}
134
134
typealiasB4=protocol<P1,P2> // expected-error {{'protocol<...>' composition syntax has been removed; join the protocols using '&'}} {{16-33=P1 & P2}}
135
-
typealiasC1=protocol<Any,P1> // expected-error {{'protocol<...>' composition syntax has been removed and is not needed here}} {{16-33=P1}}
136
-
typealiasC2=protocol<P1,Any> // expected-error {{'protocol<...>' composition syntax has been removed and is not needed here}} {{16-33=P1}}
135
+
typealiasC1=protocol<Any,P1> // expected-error {{'protocol<...>' composition syntax has been removed; join the protocols using '&'}} {{16-33=Any & P1}}
136
+
typealiasC2=protocol<P1,Any> // expected-error {{'protocol<...>' composition syntax has been removed; join the protocols using '&'}} {{16-33=P1 & Any}}
137
137
typealiasD=protocol<P1> // expected-error {{'protocol<...>' composition syntax has been removed and is not needed here}} {{15-27=P1}}
138
138
typealiasE=protocol<Any> // expected-error {{'protocol<...>' composition syntax has been removed and is not needed here}} {{15-28=Any}}
139
-
typealiasF=protocol<Any,Any> // expected-error {{'protocol<...>' composition syntax has been removed and is not needed here}} {{15-33=Any}}
139
+
typealiasF=protocol<Any,Any> // expected-error {{'protocol<...>' composition syntax has been removed; join the protocols using '&'}} {{15-33=Any & Any}}
140
140
typealiasG=protocol<P1>.Type // expected-error {{'protocol<...>' composition syntax has been removed and is not needed here}} {{15-27=P1}}
141
141
typealiasH=protocol<P1>! // expected-error {{'protocol<...>' composition syntax has been removed and is not needed here}} {{15-28=P1!}}
142
142
// expected-warning@-1 {{using '!' is not allowed here; treating this as '?' instead}}
143
143
typealiasJ=protocol<P1,P2>.Protocol // expected-error {{'protocol<...>' composition syntax has been removed; join the protocols using '&'}} {{15-31=(P1 & P2)}}
144
144
typealiasK=protocol<P1,P2>? // expected-error {{'protocol<...>' composition syntax has been removed; join the protocols using '&'}} {{15-32=(P1 & P2)?}}
145
+
typealiasL=protocol<(P1),P2> // expected-error {{'protocol<...>' composition syntax has been removed; join the protocols using '&'}} {{15-33=(P1) & P2}}
146
+
147
+
// Deprecated protocol composition syntax in expression context.
148
+
do{
149
+
func typesAreEqual<T>(_:T.Type, _:T.Type){}
150
+
151
+
typesAreEqual(Optional<P1 & P2>.self,
152
+
Optional<protocol<P1, P2>>.self)
153
+
// expected-error@-1 {{'protocol<...>' composition syntax has been removed; join the protocols using '&'}} {{26-43=P1 & P2>}}
154
+
155
+
// Test that we parse non-identifier components.
156
+
typesAreEqual(Optional<P1 & P2>.self,
157
+
Optional<protocol<P1,(P2)>>.self)
158
+
// expected-error@-1 {{'protocol<...>' composition syntax has been removed; join the protocols using '&'}} {{26-45=P1 & (P2)>}}
159
+
}
145
160
146
161
typealiasT01=P1.Protocol&P2 // expected-error {{non-protocol, non-class type '(any P1).Type' cannot be used within a protocol-constrained type}}
147
162
typealiasT02=P1.Type&P2 // expected-error {{non-protocol, non-class type 'any P1.Type' cannot be used within a protocol-constrained type}}
0 commit comments