Skip to content

Commit 45a973b

Browse files
committed
Update ObjC protocol metatype test
1 parent 64d9f5d commit 45a973b

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

test/Interpreter/generic_casts_objc.swift

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ enum PE: P {}
1616
class PC: P, PObjC {}
1717
class PCSub: PC {}
1818

19-
func nongenericAnyIsPObjC(type: Any.Type) -> Bool {
19+
func nongenericAnyIsPObjCType(type: Any.Type) -> Bool {
2020
return type is PObjC.Type
2121
}
22+
func nongenericAnyIsPObjCProtocol(type: Any.Type) -> Bool {
23+
return type is PObjC.Protocol
24+
}
2225
func genericAnyIs<T>(type: Any.Type, to: T.Type, expected: Bool) -> Bool {
2326
// If we're testing against a runtime that doesn't have the fix this tests,
2427
// just pretend we got it right.
@@ -29,13 +32,23 @@ func genericAnyIs<T>(type: Any.Type, to: T.Type, expected: Bool) -> Bool {
2932
}
3033
}
3134

32-
// CHECK-LABEL: casting types to ObjC protocols with generics:
33-
print("casting types to ObjC protocols with generics:")
34-
print(nongenericAnyIsPObjC(type: PS.self)) // CHECK: false
35-
print(genericAnyIs(type: PS.self, to: PObjC.self, expected: false)) // CHECK: false
36-
print(nongenericAnyIsPObjC(type: PE.self)) // CHECK: false
37-
print(genericAnyIs(type: PE.self, to: PObjC.self, expected: false)) // CHECK: false
38-
print(nongenericAnyIsPObjC(type: PC.self)) // CHECK: true
39-
print(genericAnyIs(type: PC.self, to: PObjC.self, expected: true)) // CHECK-ONONE: true
40-
print(nongenericAnyIsPObjC(type: PCSub.self)) // CHECK: true
41-
print(genericAnyIs(type: PCSub.self, to: PObjC.self, expected: true)) // CHECK-ONONE: true
35+
// CHECK-LABEL: casting types to ObjC protocol existential metatype:
36+
print("casting types to ObjC protocol existential metatype:")
37+
print(#line, nongenericAnyIsPObjCType(type: PS.self)) // CHECK: [[@LINE]] false
38+
print(#line, nongenericAnyIsPObjCType(type: PE.self)) // CHECK: [[@LINE]] false
39+
print(#line, nongenericAnyIsPObjCType(type: PC.self)) // CHECK: [[@LINE]] true
40+
print(#line, nongenericAnyIsPObjCType(type: PCSub.self)) // CHECK: [[@LINE]] true
41+
42+
// CHECK-LABEL: casting types to ObjC protocol metatype:
43+
print("casting types to ObjC protocol metatype:")
44+
print(#line, nongenericAnyIsPObjCProtocol(type: PS.self)) // CHECK: [[@LINE]] false
45+
print(#line, nongenericAnyIsPObjCProtocol(type: PE.self)) // CHECK: [[@LINE]] false
46+
print(#line, nongenericAnyIsPObjCProtocol(type: PC.self)) // CHECK: [[@LINE]] false
47+
print(#line, nongenericAnyIsPObjCProtocol(type: PCSub.self)) // CHECK: [[@LINE]] false
48+
49+
// CHECK-LABEL: casting types to ObjC protocol metatype via generic:
50+
print("casting types to ObjC protocol metatype via generic:")
51+
print(#line, genericAnyIs(type: PS.self, to: PObjC.self, expected: false)) // CHECK: [[@LINE]] false
52+
print(#line, genericAnyIs(type: PE.self, to: PObjC.self, expected: false)) // CHECK: [[@LINE]] false
53+
print(#line, genericAnyIs(type: PC.self, to: PObjC.self, expected: true)) // CHECK-ONONE: [[@LINE]] false
54+
print(#line, genericAnyIs(type: PCSub.self, to: PObjC.self, expected: true)) // CHECK-ONONE: [[@LINE]] false

0 commit comments

Comments
 (0)