1
1
// RUN: rm -rf %t && mkdir -p %t
2
2
// RUN: %build-irgen-test-overlays
3
- // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s -check-prefix=CHECK-%target-os
3
+ // RUN: %target-swift-frontend(mock-sdk: -sdk %S/Inputs -I %t) %s -emit-ir -disable-objc-attr-requires-foundation-module -enable-experimental-subclass-existentials | %FileCheck %s -check-prefix=CHECK-%target-os
4
4
5
5
// REQUIRES: CPU=x86_64
6
6
// REQUIRES: objc_interop
@@ -41,9 +41,9 @@ import gizmo
41
41
42
42
@objc func testOptionalPrimitives( )
43
43
-> OpaquePointer ? { return nil }
44
- // CHECK-macosx: private unnamed_addr constant [9 x i8] c"^v16@0:8\00"
45
- // CHECK-ios: private unnamed_addr constant [9 x i8] c"^v16@0:8\00"
46
- // CHECK-tvos: private unnamed_addr constant [9 x i8] c"^v16@0:8\00"
44
+ // CHECK-macosx: private unnamed_addr constant [9 x i8] c"^v16@0:8\00"
45
+ // CHECK-ios: private unnamed_addr constant [9 x i8] c"^v16@0:8\00"
46
+ // CHECK-tvos: private unnamed_addr constant [9 x i8] c"^v16@0:8\00"
47
47
48
48
@objc func testCSignedTypes( _ a: CSignedChar , b: CShort , c: CInt , d: CLong , e: CLongLong ) { }
49
49
// CHECK-macosx: private unnamed_addr constant [23 x i8] c"v44@0:8c16s20i24q28q36\00"
@@ -71,68 +71,69 @@ import gizmo
71
71
// CHECK-tvos: private unnamed_addr constant [20 x i8] c"v36@0:8c16s20i24q28\00"
72
72
73
73
@objc class func getSelf( ) -> Methods . Type { return self }
74
- // These strings are required for another purpose and so are tested above.
74
+ // These strings are required for another purpose and so are tested above.
75
75
76
76
@objc func getDynamicSelf( ) -> Self { return self }
77
- // CHECK-macosx: private unnamed_addr constant [8 x i8] c"@16@0:8\00"
78
- // CHECK-ios: private unnamed_addr constant [8 x i8] c"@16@0:8\00"
79
- // CHECK-tvos: private unnamed_addr constant [8 x i8] c"@16@0:8\00"
77
+ // CHECK-macosx: private unnamed_addr constant [8 x i8] c"@16@0:8\00"
78
+ // CHECK-ios: private unnamed_addr constant [8 x i8] c"@16@0:8\00"
79
+ // CHECK-tvos: private unnamed_addr constant [8 x i8] c"@16@0:8\00"
80
80
81
- func testId( _ s: AnyObject ) -> AnyObject { return self }
81
+ @ objc func testId( _ s: AnyObject ) -> AnyObject { return self }
82
82
// CHECK-macosx: private unnamed_addr constant [11 x i8] c"@24@0:8@16\00"
83
83
// CHECK-ios: private unnamed_addr constant [11 x i8] c"@24@0:8@16\00"
84
84
// CHECK-tvos: private unnamed_addr constant [11 x i8] c"@24@0:8@16\00"
85
85
86
- @objc func comp1( _ a: P1 & P2 , b: P1 & P2 & P3 ) -> P1 & P2 { return a }
86
+ @objc func comp1( _ a: P1 & P2 , b: P1 & P2 & P3 ) -> P1 & P2 { return a }
87
87
// CHECK-macosx: private unnamed_addr constant [14 x i8] c"@32@0:8@16@24\00"
88
88
// CHECK-ios: private unnamed_addr constant [14 x i8] c"@32@0:8@16@24\00"
89
89
// CHECK-tvos: private unnamed_addr constant [14 x i8] c"@32@0:8@16@24\00"
90
90
91
- @objc func returnsBool( _ b : Bool ) -> Bool { return b }
91
+ @objc func returnsBool( _ b : Bool ) -> Bool { return b }
92
92
// CHECK-macosx: private unnamed_addr constant [11 x i8] c"c20@0:8c16\00"
93
93
// CHECK-ios: private unnamed_addr constant [11 x i8] c"B20@0:8B16\00"
94
94
// CHECK-tvos: private unnamed_addr constant [11 x i8] c"B20@0:8B16\00"
95
95
96
- @objc func comp1( _ a: Methods , b: Methods , c: Methods ) -> Methods { return a }
96
+ @objc func comp1( _ a: Methods , b: Methods , c: Methods ) -> Methods { return a }
97
97
// CHECK-macosx: private unnamed_addr constant [17 x i8] c"@40@0:8@16@24@32\00"
98
98
// CHECK-ios: private unnamed_addr constant [17 x i8] c"@40@0:8@16@24@32\00"
99
99
// CHECK-tvos: private unnamed_addr constant [17 x i8] c"@40@0:8@16@24@32\00"
100
100
101
- @objc func passSelector( _ aSelector : Selector ) { }
101
+ @objc func passSelector( _ aSelector : Selector ) { }
102
102
// CHECK-macosx: private unnamed_addr constant [11 x i8] c"v24@0:8:16\00"
103
103
// CHECK-ios: private unnamed_addr constant [11 x i8] c"v24@0:8:16\00"
104
104
// CHECK-tvos: private unnamed_addr constant [11 x i8] c"v24@0:8:16\00"
105
105
106
- @objc func copyUnsafeMutablePointer( _ p: UnsafeMutablePointer < Int32 > ) -> UnsafeMutablePointer < Int32 > { return p }
106
+ @objc func copyUnsafeMutablePointer( _ p: UnsafeMutablePointer < Int32 > ) -> UnsafeMutablePointer < Int32 > { return p }
107
107
// CHECK-macosx: private unnamed_addr constant [13 x i8] c"^i24@0:8^i16\00"
108
108
// CHECK-ios: private unnamed_addr constant [13 x i8] c"^i24@0:8^i16\00"
109
109
// CHECK-tvos: private unnamed_addr constant [13 x i8] c"^i24@0:8^i16\00"
110
110
111
- @objc func copyUnsafeMutablePointerInt( _ p: UnsafeMutablePointer < Int > ) -> UnsafeMutablePointer < Int > { return p }
111
+ @objc func copyUnsafeMutablePointerInt( _ p: UnsafeMutablePointer < Int > ) -> UnsafeMutablePointer < Int > { return p }
112
112
// CHECK-macosx: private unnamed_addr constant [13 x i8] c"^q24@0:8^q16\00"
113
113
// CHECK-ios: private unnamed_addr constant [13 x i8] c"^q24@0:8^q16\00"
114
114
// CHECK-tvos: private unnamed_addr constant [13 x i8] c"^q24@0:8^q16\00"
115
115
116
- func testArchetype( _ work: P3 ) {
117
- }
116
+ @ objc func testArchetype( _ work: P3 ) {
117
+ }
118
118
// CHECK-macosx: private unnamed_addr constant [11 x i8] c"v24@0:8@16\00"
119
119
// CHECK-ios: private unnamed_addr constant [11 x i8] c"v24@0:8@16\00"
120
120
// CHECK-tvos: private unnamed_addr constant [11 x i8] c"v24@0:8@16\00"
121
121
122
- @objc func foo( _ x: ( Int ) -> Int ) -> Int {
123
- return 1
124
- }
122
+ @objc func foo( _ x: ( Int ) -> Int ) -> Int {
123
+ return 1
124
+ }
125
125
// CHECK-macosx: private unnamed_addr constant [12 x i8] c"q24@0:8@?16\00"
126
126
// CHECK-ios: private unnamed_addr constant [12 x i8] c"q24@0:8@?16\00"
127
127
// CHECK-tvos: private unnamed_addr constant [12 x i8] c"q24@0:8@?16\00"
128
128
129
- @objc func returnNSRadixedOptions( ) -> NSRadixedOptions {
129
+ @objc func returnNSRadixedOptions( ) -> NSRadixedOptions {
130
130
return . octal
131
131
}
132
132
// CHECK-macosx: [[ENUMENCODING:@.*]] = private unnamed_addr constant [8 x i8] c"i16@0:8\00"
133
133
// CHECK-ios: [[ENUMENCODING:@.*]] = private unnamed_addr constant [8 x i8] c"i16@0:8\00"
134
134
// CHECK-tvos: [[ENUMENCODING:@.*]] = private unnamed_addr constant [8 x i8] c"i16@0:8\00"
135
- @objc func returnChoseNSRadixedOptions( _ choice: NSRadixedOptions ) -> NSRadixedOptions {
135
+
136
+ @objc func returnChoseNSRadixedOptions( _ choice: NSRadixedOptions ) -> NSRadixedOptions {
136
137
switch choice {
137
138
case . octal: return . hex
138
139
case . hex: return . octal
@@ -142,7 +143,7 @@ func testArchetype(_ work: P3) {
142
143
// CHECK-ios: private unnamed_addr constant [11 x i8] c"i20@0:8i16\00"
143
144
// CHECK-tvos: private unnamed_addr constant [11 x i8] c"i20@0:8i16\00"
144
145
145
- @objc func getRawEnumInGizmo( ) -> RawEnumInGizmo {
146
+ @objc func getRawEnumInGizmo( ) -> RawEnumInGizmo {
146
147
return InGizmoTwo
147
148
}
148
149
// CHECK-macosx: { i8* getelementptr inbounds ([18 x i8], [18 x i8]* @"\01L_selector_data(getRawEnumInGizmo)", i64 0, i64 0),
@@ -160,19 +161,23 @@ func testArchetype(_ work: P3) {
160
161
161
162
@objc protocol MyProtocol {
162
163
func myMethod2( _ arg : NSRuncing & NSFunging )
163
- func readWithAuthorization( _ authData : Gizmo , reply : ( NSView , NSSpoon ) -> Void )
164
- func doSomething( _ context: MyCustomObject )
164
+ func readWithAuthorization( _ authData : Gizmo , reply : ( NSView , NSSpoon ) -> Void )
165
+ func doSomething( _ context: MyCustomObject )
166
+ func subclassComposition( _: MyCustomObject & NSRuncing & NSFunging )
165
167
}
166
168
167
169
// CHECK-macosx: [[ENC1:@.*]] = private unnamed_addr constant [35 x i8] c"v24@0:8@\22<NSFunging><NSRuncing>\2216\00"
168
170
// CHECK-macosx: [[ENC2:@.*]] = private unnamed_addr constant [46 x i8] c"v32@0:8@\22Gizmo\2216@?<v@?@\22NSView\22@\22NSSpoon\22>24\00"
169
171
// CHECK-macosx: [[ENC3:@.*]] = private unnamed_addr constant [53 x i8] c"v24@0:8@\22_TtC18objc_type_encoding14MyCustomObject\2216\00"
170
- // CHECK-macosx: @_PROTOCOL_METHOD_TYPES__TtP18objc_type_encoding10MyProtocol_ = private constant [3 x i8*] [i8* getelementptr inbounds ([35 x i8], [35 x i8]* [[ENC1]], i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* [[ENC2]], i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* [[ENC3]], i64 0, i64 0)]
172
+ // CHECK-macosx: [[ENC4:@.*]] = private unnamed_addr constant [75 x i8] c"v24@0:8@\22_TtC18objc_type_encoding14MyCustomObject<NSFunging><NSRuncing>\2216\00"
173
+ // CHECK-macosx: @_PROTOCOL_METHOD_TYPES__TtP18objc_type_encoding10MyProtocol_ = private constant [4 x i8*] [i8* getelementptr inbounds ([35 x i8], [35 x i8]* [[ENC1]], i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* [[ENC2]], i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* [[ENC3]], i64 0, i64 0), i8* getelementptr inbounds ([75 x i8], [75 x i8]* [[ENC4]], i64 0, i64 0)]
171
174
// CHECK-ios: [[ENC1:@.*]] = private unnamed_addr constant [35 x i8] c"v24@0:8@\22<NSFunging><NSRuncing>\2216\00"
172
175
// CHECK-ios: [[ENC2:@.*]] = private unnamed_addr constant [46 x i8] c"v32@0:8@\22Gizmo\2216@?<v@?@\22NSView\22@\22NSSpoon\22>24\00"
173
176
// CHECK-ios: [[ENC3:@.*]] = private unnamed_addr constant [53 x i8] c"v24@0:8@\22_TtC18objc_type_encoding14MyCustomObject\2216\00"
174
- // CHECK-ios: @_PROTOCOL_METHOD_TYPES__TtP18objc_type_encoding10MyProtocol_ = private constant [3 x i8*] [i8* getelementptr inbounds ([35 x i8], [35 x i8]* [[ENC1]], i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* [[ENC2]], i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* [[ENC3]], i64 0, i64 0)]
177
+ // CHECK-ios: [[ENC4:@.*]] = private unnamed_addr constant [75 x i8] c"v24@0:8@\22_TtC18objc_type_encoding14MyCustomObject<NSFunging><NSRuncing>\2216\00"
178
+ // CHECK-ios: @_PROTOCOL_METHOD_TYPES__TtP18objc_type_encoding10MyProtocol_ = private constant [4 x i8*] [i8* getelementptr inbounds ([35 x i8], [35 x i8]* [[ENC1]], i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* [[ENC2]], i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* [[ENC3]], i64 0, i64 0), i8* getelementptr inbounds ([75 x i8], [75 x i8]* [[ENC4]], i64 0, i64 0)]
175
179
// CHECK-tvos: [[ENC1:@.*]] = private unnamed_addr constant [35 x i8] c"v24@0:8@\22<NSFunging><NSRuncing>\2216\00"
176
180
// CHECK-tvos: [[ENC2:@.*]] = private unnamed_addr constant [46 x i8] c"v32@0:8@\22Gizmo\2216@?<v@?@\22NSView\22@\22NSSpoon\22>24\00"
177
181
// CHECK-tvos: [[ENC3:@.*]] = private unnamed_addr constant [53 x i8] c"v24@0:8@\22_TtC18objc_type_encoding14MyCustomObject\2216\00"
178
- // CHECK-tvos: @_PROTOCOL_METHOD_TYPES__TtP18objc_type_encoding10MyProtocol_ = private constant [3 x i8*] [i8* getelementptr inbounds ([35 x i8], [35 x i8]* [[ENC1]], i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* [[ENC2]], i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* [[ENC3]], i64 0, i64 0)]
182
+ // CHECK-tvos: [[ENC4:@.*]] = private unnamed_addr constant [75 x i8] c"v24@0:8@\22_TtC18objc_type_encoding14MyCustomObject<NSFunging><NSRuncing>\2216\00"
183
+ // CHECK-tvos: @_PROTOCOL_METHOD_TYPES__TtP18objc_type_encoding10MyProtocol_ = private constant [4 x i8*] [i8* getelementptr inbounds ([35 x i8], [35 x i8]* [[ENC1]], i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* [[ENC2]], i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* [[ENC3]], i64 0, i64 0), i8* getelementptr inbounds ([75 x i8], [75 x i8]* [[ENC4]], i64 0, i64 0)]
0 commit comments