@@ -155,6 +155,9 @@ func nongenericAnyIsPProtocol(type: Any.Type) -> Bool {
155155func nongenericAnyIsPAndAnyObjectType( type: Any . Type ) -> Bool {
156156 return type is ( P & AnyObject ) . Type
157157}
158+ func nongenericAnyIsPAndAnyObjectProtocol( type: Any . Type ) -> Bool {
159+ return type is ( P & AnyObject ) . Protocol
160+ }
158161func nongenericAnyIsPAndPCSubType( type: Any . Type ) -> Bool {
159162 return type is ( P & PCSub ) . Type
160163}
@@ -178,6 +181,9 @@ func nongenericAnyAsConditionalPProtocol(type: Any.Type) -> Bool {
178181func nongenericAnyAsConditionalPAndAnyObjectType( type: Any . Type ) -> Bool {
179182 return ( type as? ( P & AnyObject ) . Type) != nil
180183}
184+ func nongenericAnyAsConditionalPAndAnyObjectProtocol( type: Any . Type ) -> Bool {
185+ return ( type as? ( P & AnyObject ) . Protocol) != nil
186+ }
181187func nongenericAnyAsConditionalPAndPCSubType( type: Any . Type ) -> Bool {
182188 return ( type as? ( P & PCSub ) . Type) != nil
183189}
@@ -230,16 +236,16 @@ print(#line, PS() is P) // CHECK: [[@LINE]] true
230236// But that theory is not the one that Swift currently
231237// implements.
232238print ( #line, nongenericAnyIsPProtocol ( type: PS . self) ) // CHECK: [[@LINE]] false
233- print ( #line, genericAnyIs ( type: PS . self, to: P . self, expected: true ) ) // CHECK: [[@LINE]] false
239+ print ( #line, genericAnyIs ( type: PS . self, to: P . self, expected: false ) ) // CHECK: [[@LINE]] false
234240print ( #line, nongenericAnyIsPType ( type: PE . self) ) // CHECK: [[@LINE]] true
235241print ( #line, nongenericAnyIsPProtocol ( type: PE . self) ) // CHECK: [[@LINE]] false
236- print ( #line, genericAnyIs ( type: PE . self, to: P . self, expected: true ) ) // CHECK: [[@LINE]] false
242+ print ( #line, genericAnyIs ( type: PE . self, to: P . self, expected: false ) ) // CHECK: [[@LINE]] false
237243print ( #line, nongenericAnyIsPType ( type: PC . self) ) // CHECK: [[@LINE]] true
238244print ( #line, nongenericAnyIsPProtocol ( type: PC . self) ) // CHECK: [[@LINE]] false
239- print ( #line, genericAnyIs ( type: PC . self, to: P . self, expected: true ) ) // CHECK: [[@LINE]] false
245+ print ( #line, genericAnyIs ( type: PC . self, to: P . self, expected: false ) ) // CHECK: [[@LINE]] false
240246print ( #line, nongenericAnyIsPType ( type: PCSub . self) ) // CHECK: [[@LINE]] true
241247print ( #line, nongenericAnyIsPProtocol ( type: PCSub . self) ) // CHECK: [[@LINE]] false
242- print ( #line, genericAnyIs ( type: PCSub . self, to: P . self, expected: true ) ) // CHECK: [[@LINE]] false
248+ print ( #line, genericAnyIs ( type: PCSub . self, to: P . self, expected: false ) ) // CHECK: [[@LINE]] false
243249
244250// CHECK-LABEL: conditionally casting types to protocols with generics:
245251print ( #line, " conditionally casting types to protocols with generics: " )
@@ -248,16 +254,16 @@ print(#line, nongenericAnyAsConditionalPProtocol(type: P.self)) // CHECK: [[@LIN
248254print ( #line, genericAnyAsConditional ( type: P . self, to: P . self, expected: true ) ) // CHECK: [[@LINE]] true
249255print ( #line, nongenericAnyAsConditionalPType ( type: PS . self) ) // CHECK: [[@LINE]] true
250256print ( #line, nongenericAnyAsConditionalPProtocol ( type: PS . self) ) // CHECK: [[@LINE]] false
251- print ( #line, genericAnyAsConditional ( type: PS . self, to: P . self, expected: true ) ) // CHECK: [[@LINE]] false
257+ print ( #line, genericAnyAsConditional ( type: PS . self, to: P . self, expected: false ) ) // CHECK: [[@LINE]] false
252258print ( #line, nongenericAnyAsConditionalPType ( type: PE . self) ) // CHECK: [[@LINE]] true
253259print ( #line, nongenericAnyAsConditionalPProtocol ( type: PE . self) ) // CHECK: [[@LINE]] false
254- print ( #line, genericAnyAsConditional ( type: PE . self, to: P . self, expected: true ) ) // CHECK: [[@LINE]] false
260+ print ( #line, genericAnyAsConditional ( type: PE . self, to: P . self, expected: false ) ) // CHECK: [[@LINE]] false
255261print ( #line, nongenericAnyAsConditionalPType ( type: PC . self) ) // CHECK: [[@LINE]] true
256262print ( #line, nongenericAnyAsConditionalPProtocol ( type: PC . self) ) // CHECK: [[@LINE]] false
257- print ( #line, genericAnyAsConditional ( type: PC . self, to: P . self, expected: true ) ) // CHECK: [[@LINE]] false
263+ print ( #line, genericAnyAsConditional ( type: PC . self, to: P . self, expected: false ) ) // CHECK: [[@LINE]] false
258264print ( #line, nongenericAnyAsConditionalPType ( type: PCSub . self) ) // CHECK: [[@LINE]] true
259265print ( #line, nongenericAnyAsConditionalPProtocol ( type: PCSub . self) ) // CHECK: [[@LINE]] false
260- print ( #line, genericAnyAsConditional ( type: PCSub . self, to: P . self, expected: true ) ) // CHECK: [[@LINE]] false
266+ print ( #line, genericAnyAsConditional ( type: PCSub . self, to: P . self, expected: false ) ) // CHECK: [[@LINE]] false
261267
262268// CHECK-LABEL: unconditionally casting types to protocols with generics:
263269print ( #line, " unconditionally casting types to protocols with generics: " )
@@ -280,17 +286,20 @@ print(#line, genericAnyIs(type: PS.self, to: (P & AnyObject).self, expected: fal
280286print ( #line, nongenericAnyIsPAndAnyObjectType ( type: PE . self) ) // CHECK: [[@LINE]] false
281287print ( #line, genericAnyIs ( type: PE . self, to: ( P & AnyObject) . self, expected: false ) ) // CHECK: [[@LINE]] false
282288print ( #line, nongenericAnyIsPAndAnyObjectType ( type: PC . self) ) // CHECK: [[@LINE]] true
283- print ( #line, genericAnyIs ( type: PC . self, to: ( P & AnyObject) . self, expected: true ) ) // CHECK: [[@LINE]] false
289+ print ( #line, nongenericAnyIsPAndAnyObjectProtocol ( type: PC . self) ) // CHECK: [[@LINE]] false
290+ print ( #line, genericAnyIs ( type: PC . self, to: ( P & AnyObject) . self, expected: false ) ) // CHECK: [[@LINE]] false
284291print ( #line, nongenericAnyIsPAndAnyObjectType ( type: PCSub . self) ) // CHECK: [[@LINE]] true
285- print ( #line, genericAnyIs ( type: PCSub . self, to: ( P & AnyObject) . self, expected: true ) ) // CHECK: [[@LINE]] false
292+ print ( #line, nongenericAnyIsPAndAnyObjectProtocol ( type: PCSub . self) ) // CHECK: [[@LINE]] false
293+ print ( #line, genericAnyIs ( type: PCSub . self, to: ( P & AnyObject) . self, expected: false ) ) // CHECK: [[@LINE]] false
286294print ( #line, nongenericAnyAsConditionalPAndAnyObjectType ( type: PS . self) ) // CHECK: [[@LINE]] false
287295print ( #line, genericAnyAsConditional ( type: PS . self, to: ( P & AnyObject) . self, expected: false ) ) // CHECK: [[@LINE]] false
288296print ( #line, nongenericAnyAsConditionalPAndAnyObjectType ( type: PE . self) ) // CHECK: [[@LINE]] false
289297print ( #line, genericAnyAsConditional ( type: PE . self, to: ( P & AnyObject) . self, expected: false ) ) // CHECK: [[@LINE]] false
290298print ( #line, nongenericAnyAsConditionalPAndAnyObjectType ( type: PC . self) ) // CHECK: [[@LINE]] true
291- print ( #line, genericAnyAsConditional ( type: PC . self, to: ( P & AnyObject) . self, expected: true ) ) // CHECK: [[@LINE]] false
299+ print ( #line, nongenericAnyAsConditionalPAndAnyObjectProtocol ( type: PC . self) ) // CHECK: [[@LINE]] false
300+ print ( #line, genericAnyAsConditional ( type: PC . self, to: ( P & AnyObject) . self, expected: false ) ) // CHECK: [[@LINE]] false
292301print ( #line, nongenericAnyAsConditionalPAndAnyObjectType ( type: PCSub . self) ) // CHECK: [[@LINE]] true
293- print ( #line, genericAnyAsConditional ( type: PCSub . self, to: ( P & AnyObject) . self, expected: true ) ) // CHECK: [[@LINE]] false
302+ print ( #line, genericAnyAsConditional ( type: PCSub . self, to: ( P & AnyObject) . self, expected: false ) ) // CHECK: [[@LINE]] false
294303
295304// CHECK-LABEL: casting types to protocol & class existentials:
296305print ( #line, " casting types to protocol & class existentials: " )
@@ -301,15 +310,15 @@ print(#line, genericAnyIs(type: PE.self, to: (P & PCSub).self, expected: false))
301310//print(#line, nongenericAnyIsPAndPCSubType(type: PC.self)) // CHECK-SR-11565: [[@LINE]] false -- FIXME: reenable this when SR-11565 is fixed
302311print ( #line, genericAnyIs ( type: PC . self, to: ( P & PCSub) . self, expected: false ) ) // CHECK: [[@LINE]] false
303312print ( #line, nongenericAnyIsPAndPCSubType ( type: PCSub . self) ) // CHECK: [[@LINE]] true
304- print ( #line, genericAnyIs ( type: PCSub . self, to: ( P & PCSub) . self, expected: true ) ) // CHECK: [[@LINE]] false
313+ print ( #line, genericAnyIs ( type: PCSub . self, to: ( P & PCSub) . self, expected: false ) ) // CHECK: [[@LINE]] false
305314print ( #line, nongenericAnyAsConditionalPAndPCSubType ( type: PS . self) ) // CHECK: [[@LINE]] false
306315print ( #line, genericAnyAsConditional ( type: PS . self, to: ( P & PCSub) . self, expected: false ) ) // CHECK: [[@LINE]] false
307316print ( #line, nongenericAnyAsConditionalPAndPCSubType ( type: PE . self) ) // CHECK: [[@LINE]] false
308317print ( #line, genericAnyAsConditional ( type: PE . self, to: ( P & PCSub) . self, expected: false ) ) // CHECK: [[@LINE]] false
309318// print(#line, nongenericAnyAsConditionalPAndPCSubType(type: PC.self)) // CHECK-SR-11565: [[@LINE]] false -- FIXME: reenable this when SR-11565 is fixed
310319print ( #line, genericAnyAsConditional ( type: PC . self, to: ( P & PCSub) . self, expected: false ) ) // CHECK: [[@LINE]] false
311320print ( #line, nongenericAnyAsConditionalPAndPCSubType ( type: PCSub . self) ) // CHECK: [[@LINE]] true
312- print ( #line, genericAnyAsConditional ( type: PCSub . self, to: ( P & PCSub) . self, expected: true ) ) // CHECK: [[@LINE]] false
321+ print ( #line, genericAnyAsConditional ( type: PCSub . self, to: ( P & PCSub) . self, expected: false ) ) // CHECK: [[@LINE]] false
313322
314323
315324// CHECK-LABEL: type comparisons:
0 commit comments