@@ -30,15 +30,30 @@ public func takeGenericPair<T, T1>(_ x: GenericPair<T, T1>) {
30
30
print ( x)
31
31
}
32
32
33
+ public func takeConcretePair( _ x: GenericPair < UInt32 , UInt32 > ) {
34
+ print ( " CONCRETE pair of UInt32: " , x. x, x. y, " ; " )
35
+ }
36
+
33
37
public func passThroughGenericPair< T1, T> ( _ x: GenericPair < T1 , T > , _ y: T ) -> GenericPair < T1 , T > {
34
38
return GenericPair < T1 , T > ( x: x. x, y: y)
35
39
}
36
40
41
+ public typealias ConcreteUint32Pair = GenericPair < UInt32 , UInt32 >
42
+
43
+ public func passThroughConcretePair( _ x: ConcreteUint32Pair , y: UInt32 ) -> ConcreteUint32Pair {
44
+ return ConcreteUint32Pair ( x: x. x, y: y)
45
+ }
46
+
37
47
public func inoutGenericPair< T1, T> ( _ x: inout GenericPair < T1 , T > , _ y: T1 ) {
38
48
x. x = y
39
49
}
40
50
41
- // CHECK: SWIFT_EXTERN void $s8Generics16inoutGenericPairyyAA0cD0Vyxq_Gz_xtr0_lF(void * _Nonnull x, const void * _Nonnull y, void * _Nonnull , void * _Nonnull ) SWIFT_NOEXCEPT SWIFT_CALL; // inoutGenericPair(_:_:)
51
+ public func inoutConcretePair( _ x: UInt32 , _ y: inout GenericPair < UInt32 , UInt32 > ) {
52
+ y. x = x
53
+ }
54
+
55
+ // CHECK: SWIFT_EXTERN void $s8Generics17inoutConcretePairyys6UInt32V_AA07GenericD0VyA2DGztF(uint32_t x, char * _Nonnull y) SWIFT_NOEXCEPT SWIFT_CALL; // inoutConcretePair(_:_:)
56
+ // CHECK-NEXT: SWIFT_EXTERN void $s8Generics16inoutGenericPairyyAA0cD0Vyxq_Gz_xtr0_lF(void * _Nonnull x, const void * _Nonnull y, void * _Nonnull , void * _Nonnull ) SWIFT_NOEXCEPT SWIFT_CALL; // inoutGenericPair(_:_:)
42
57
// CHECK-NEXT: // Stub struct to be used to pass/return values to/from Swift functions.
43
58
// CHECK-NEXT: struct swift_interop_stub_Generics_GenericPair_s6UInt32V_s6UInt32V {
44
59
// CHECK-NEXT: uint64_t _1;
@@ -56,7 +71,9 @@ public func inoutGenericPair<T1, T>(_ x: inout GenericPair<T1, T>, _ y: T1) {
56
71
// CHECK-EMPTY:
57
72
// CHECK-NEXT: SWIFT_EXTERN struct swift_interop_stub_Generics_GenericPair_s6UInt32V_s6UInt32V $s8Generics16makeConcretePairyAA07GenericD0Vys6UInt32VAFGAF_AFtF(uint32_t x, uint32_t y) SWIFT_NOEXCEPT SWIFT_CALL; // makeConcretePair(_:_:)
58
73
// CHECK-NEXT: SWIFT_EXTERN void $s8Generics15makeGenericPairyAA0cD0Vyxq_Gx_q_tr0_lF(SWIFT_INDIRECT_RESULT void * _Nonnull, const void * _Nonnull x, const void * _Nonnull y, void * _Nonnull , void * _Nonnull ) SWIFT_NOEXCEPT SWIFT_CALL; // makeGenericPair(_:_:)
74
+ // CHECK-NEXT: SWIFT_EXTERN struct swift_interop_stub_Generics_GenericPair_s6UInt32V_s6UInt32V $s8Generics23passThroughConcretePair_1yAA07GenericE0Vys6UInt32VAGGAH_AGtF(struct swift_interop_stub_Generics_GenericPair_s6UInt32V_s6UInt32V x, uint32_t y) SWIFT_NOEXCEPT SWIFT_CALL; // passThroughConcretePair(_:y:)
59
75
// CHECK-NEXT: SWIFT_EXTERN void $s8Generics22passThroughGenericPairyAA0dE0Vyxq_GAE_q_tr0_lF(SWIFT_INDIRECT_RESULT void * _Nonnull, const void * _Nonnull x, const void * _Nonnull y, void * _Nonnull , void * _Nonnull ) SWIFT_NOEXCEPT SWIFT_CALL; // passThroughGenericPair(_:_:)
76
+ // CHECK-NEXT: SWIFT_EXTERN void $s8Generics16takeConcretePairyyAA07GenericD0Vys6UInt32VAFGF(struct swift_interop_stub_Generics_GenericPair_s6UInt32V_s6UInt32V x) SWIFT_NOEXCEPT SWIFT_CALL; // takeConcretePair(_:)
60
77
// CHECK-NEXT: SWIFT_EXTERN void $s8Generics15takeGenericPairyyAA0cD0Vyxq_Gr0_lF(const void * _Nonnull x, void * _Nonnull , void * _Nonnull ) SWIFT_NOEXCEPT SWIFT_CALL; // takeGenericPair(_:)
61
78
62
79
// CHECK: template<class T_0_0, class T_0_1>
@@ -95,7 +112,11 @@ public func inoutGenericPair<T1, T>(_ x: inout GenericPair<T1, T>, _ y: T1) {
95
112
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
96
113
// CHECK-NEXT: class GenericPair;
97
114
// CHECK-EMPTY:
98
- // CHECK-NEXT: template<class T1, class T>
115
+ // CHECK-NEXT: inline void inoutConcretePair(uint32_t x, GenericPair<uint32_t, uint32_t>& y) noexcept {
116
+ // CHECK-NEXT: return _impl::$s8Generics17inoutConcretePairyys6UInt32V_AA07GenericD0VyA2DGztF(x, _impl::_impl_GenericPair<uint32_t, uint32_t>::getOpaquePointer(y));
117
+ // CHECK-NEXT: }
118
+
119
+ // CHECK: template<class T1, class T>
99
120
// CHECK-NEXT: requires swift::isUsableInGenericContext<T1> && swift::isUsableInGenericContext<T>
100
121
// CHECK-NEXT: inline void inoutGenericPair(GenericPair<T1, T>& x, const T1 & y) noexcept {
101
122
// CHECK-NEXT: return _impl::$s8Generics16inoutGenericPairyyAA0cD0Vyxq_Gz_xtr0_lF(_impl::_impl_GenericPair<T1, T>::getOpaquePointer(x), swift::_impl::getOpaquePointer(y), swift::getTypeMetadata<T1>(), swift::getTypeMetadata<T>());
@@ -109,6 +130,12 @@ public func inoutGenericPair<T1, T>(_ x: inout GenericPair<T1, T>, _ y: T1) {
109
130
// CHECK-NEXT: });
110
131
// CHECK-NEXT: }
111
132
133
+ // CHECK: inline GenericPair<uint32_t, uint32_t> passThroughConcretePair(const GenericPair<uint32_t, uint32_t>& x, uint32_t y) noexcept SWIFT_WARN_UNUSED_RESULT {
134
+ // CHECK-NEXT: return _impl::_impl_GenericPair<uint32_t, uint32_t>::returnNewValue([&](char * _Nonnull result) {
135
+ // CHECK-NEXT: _impl::swift_interop_returnDirect_Generics_GenericPair_s6UInt32V_s6UInt32V(result, _impl::$s8Generics23passThroughConcretePair_1yAA07GenericE0Vys6UInt32VAGGAH_AGtF(_impl::swift_interop_passDirect_Generics_GenericPair_s6UInt32V_s6UInt32V(_impl::_impl_GenericPair<uint32_t, uint32_t>::getOpaquePointer(x)), y));
136
+ // CHECK-NEXT: });
137
+ // CHECK-NEXT: }
138
+
112
139
// CHECK: template<class T1, class T>
113
140
// CHECK-NEXT: requires swift::isUsableInGenericContext<T1> && swift::isUsableInGenericContext<T>
114
141
// CHECK-NEXT: inline GenericPair<T1, T> passThroughGenericPair(const GenericPair<T1, T>& x, const T & y) noexcept SWIFT_WARN_UNUSED_RESULT {
@@ -117,6 +144,10 @@ public func inoutGenericPair<T1, T>(_ x: inout GenericPair<T1, T>, _ y: T1) {
117
144
// CHECK-NEXT: });
118
145
// CHECK-NEXT: }
119
146
147
+ // CHECK: inline void takeConcretePair(const GenericPair<uint32_t, uint32_t>& x) noexcept {
148
+ // CHECK-NEXT: return _impl::$s8Generics16takeConcretePairyyAA07GenericD0Vys6UInt32VAFGF(_impl::swift_interop_passDirect_Generics_GenericPair_s6UInt32V_s6UInt32V(_impl::_impl_GenericPair<uint32_t, uint32_t>::getOpaquePointer(x)));
149
+ // CHECK-NEXT: }
150
+
120
151
// CHECK: template<class T, class T1>
121
152
// CHECK-NEXT: requires swift::isUsableInGenericContext<T> && swift::isUsableInGenericContext<T1>
122
153
// CHECK-NEXT: inline void takeGenericPair(const GenericPair<T, T1>& x) noexcept {
0 commit comments