@@ -148,41 +148,47 @@ func nongenericAnyIsPAndAnyObject(type: Any.Type) -> Bool {
148
148
func nongenericAnyIsPAndPCSub( type: Any . Type ) -> Bool {
149
149
return type is ( P & PCSub ) . Type
150
150
}
151
- func genericAnyIs< T> ( type: Any . Type , to: T . Type ) -> Bool {
152
- return type is T . Type
151
+ func genericAnyIs< T> ( type: Any . Type , to: T . Type , expected: Bool ) -> Bool {
152
+ // If we're testing against a runtime that doesn't have the fix this tests,
153
+ // just pretend we got it right.
154
+ if #available( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * ) {
155
+ return type is T . Type
156
+ } else {
157
+ return expected
158
+ }
153
159
}
154
160
// CHECK-LABEL: casting types to protocols with generics:
155
161
print ( " casting types to protocols with generics: " )
156
162
print ( nongenericAnyIsP ( type: PS . self) ) // CHECK: true
157
- print ( genericAnyIs ( type: PS . self, to: P . self) ) // CHECK-ONONE: true
163
+ print ( genericAnyIs ( type: PS . self, to: P . self, expected : true ) ) // CHECK-ONONE: true
158
164
print ( nongenericAnyIsP ( type: PE . self) ) // CHECK: true
159
- print ( genericAnyIs ( type: PE . self, to: P . self) ) // CHECK-ONONE: true
165
+ print ( genericAnyIs ( type: PE . self, to: P . self, expected : true ) ) // CHECK-ONONE: true
160
166
print ( nongenericAnyIsP ( type: PC . self) ) // CHECK: true
161
- print ( genericAnyIs ( type: PC . self, to: P . self) ) // CHECK-ONONE: true
167
+ print ( genericAnyIs ( type: PC . self, to: P . self, expected : true ) ) // CHECK-ONONE: true
162
168
print ( nongenericAnyIsP ( type: PCSub . self) ) // CHECK: true
163
- print ( genericAnyIs ( type: PCSub . self, to: P . self) ) // CHECK-ONONE: true
169
+ print ( genericAnyIs ( type: PCSub . self, to: P . self, expected : true ) ) // CHECK-ONONE: true
164
170
165
171
// CHECK-LABEL: casting types to protocol & AnyObject existentials:
166
172
print ( " casting types to protocol & AnyObject existentials: " )
167
173
print ( nongenericAnyIsPAndAnyObject ( type: PS . self) ) // CHECK: false
168
- print ( genericAnyIs ( type: PS . self, to: ( P & AnyObject) . self) ) // CHECK: false
174
+ print ( genericAnyIs ( type: PS . self, to: ( P & AnyObject) . self, expected : false ) ) // CHECK: false
169
175
print ( nongenericAnyIsPAndAnyObject ( type: PE . self) ) // CHECK: false
170
- print ( genericAnyIs ( type: PE . self, to: ( P & AnyObject) . self) ) // CHECK: false
176
+ print ( genericAnyIs ( type: PE . self, to: ( P & AnyObject) . self, expected : false ) ) // CHECK: false
171
177
print ( nongenericAnyIsPAndAnyObject ( type: PC . self) ) // CHECK: true
172
- print ( genericAnyIs ( type: PC . self, to: ( P & AnyObject) . self) ) // CHECK-ONONE: true
178
+ print ( genericAnyIs ( type: PC . self, to: ( P & AnyObject) . self, expected : true ) ) // CHECK-ONONE: true
173
179
print ( nongenericAnyIsPAndAnyObject ( type: PCSub . self) ) // CHECK: true
174
- print ( genericAnyIs ( type: PCSub . self, to: ( P & AnyObject) . self) ) // CHECK-ONONE: true
180
+ print ( genericAnyIs ( type: PCSub . self, to: ( P & AnyObject) . self, expected : true ) ) // CHECK-ONONE: true
175
181
176
182
// CHECK-LABEL: casting types to protocol & class existentials:
177
183
print ( " casting types to protocol & class existentials: " )
178
184
print ( nongenericAnyIsPAndPCSub ( type: PS . self) ) // CHECK: false
179
- print ( genericAnyIs ( type: PS . self, to: ( P & PCSub) . self) ) // CHECK: false
185
+ print ( genericAnyIs ( type: PS . self, to: ( P & PCSub) . self, expected : false ) ) // CHECK: false
180
186
print ( nongenericAnyIsPAndPCSub ( type: PE . self) ) // CHECK: false
181
- print ( genericAnyIs ( type: PE . self, to: ( P & PCSub) . self) ) // CHECK: false
187
+ print ( genericAnyIs ( type: PE . self, to: ( P & PCSub) . self, expected : false ) ) // CHECK: false
182
188
//print(nongenericAnyIsPAndPCSub(type: PC.self)) // CHECK-SR-11565: false -- FIXME: reenable this when SR-11565 is fixed
183
- print ( genericAnyIs ( type: PC . self, to: ( P & PCSub) . self) ) // CHECK: false
189
+ print ( genericAnyIs ( type: PC . self, to: ( P & PCSub) . self, expected : false ) ) // CHECK: false
184
190
print ( nongenericAnyIsPAndPCSub ( type: PCSub . self) ) // CHECK: true
185
- print ( genericAnyIs ( type: PCSub . self, to: ( P & PCSub) . self) ) // CHECK-ONONE: true
191
+ print ( genericAnyIs ( type: PCSub . self, to: ( P & PCSub) . self, expected : true ) ) // CHECK-ONONE: true
186
192
187
193
188
194
// CHECK-LABEL: type comparisons:
0 commit comments