Skip to content

Commit 8af7a4b

Browse files
committed
add namespace tests
1 parent 748ef20 commit 8af7a4b

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

test/Interop/Cxx/swiftify-import/import-as-instance-method.swift

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
//--- test.swift
1111
import Instance
1212

13-
func foo(_ p: inout MutableSpan<CInt>, a: A, aa: inout A, s: IntSpan, cs: ConstIntSpan, asp: AliasingSpan) {
13+
func foo(_ p: inout MutableSpan<CInt>, a: A, aa: inout A, s: IntSpan, cs: ConstIntSpan, asp: AliasingSpan, b: inout baz.B) {
1414
aa.basic(&p)
1515
aa.bar(&p)
1616
a.constSelf(&p)
1717
a.valSelf(&p)
1818
aa.refSelf(&p)
19+
aa.namespaced(&p)
20+
b.decapseman(&p)
1921

2022
let _: IntSpan = unsafe s.spanSelf()
2123
let _: MutableSpan<CInt> = unsafe s.spanSelf()
@@ -57,6 +59,13 @@ const IntSpan spanConstSelf(const IntSpan p __lifetimebound) __attribute__((swif
5759

5860
ConstIntSpan constSpanSelf(ConstIntSpan p __lifetimebound) __attribute__((swift_name("ConstIntSpan.constSpanSelf(self:)")));
5961

62+
namespace baz {
63+
void namespaced(A *a, IntSpan p __noescape) __attribute__((swift_name("A.namespaced(self:_:)")));
64+
struct B {};
65+
}
66+
67+
void decapseman(baz::B *b, IntSpan p __noescape) __attribute__((swift_name("baz.B.decapseman(self:_:)")));
68+
6069
//--- Inputs/module.modulemap
6170
module Instance {
6271
header "instance.h"
@@ -164,6 +173,46 @@ public func refSelf(_ a: inout A, _ p: inout MutableSpan<CInt>) {
164173
}
165174
}
166175
------------------------------
176+
@__swiftmacro_So1AV10namespaced15_SwiftifyImportfMp_.swift
177+
------------------------------
178+
/// This is an auto-generated wrapper for safer interop
179+
@_alwaysEmitIntoClient @available(visionOS 1.0, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) @_lifetime(p: copy p) @_disfavoredOverload
180+
public mutating func namespaced(_ p: inout MutableSpan<CInt>) {
181+
return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
182+
return unsafe namespaced(IntSpan(_pPtr))
183+
}
184+
}
185+
------------------------------
186+
@__swiftmacro_So3bazO10namespaced15_SwiftifyImportfMp_.swift
187+
------------------------------
188+
/// This is an auto-generated wrapper for safer interop
189+
@available(swift, obsoleted: 3, renamed: "A.namespaced(self:_:)") @_alwaysEmitIntoClient @available(visionOS 1.0, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) @_lifetime(p: copy p) @_disfavoredOverload
190+
public static func namespaced(_ a: UnsafeMutablePointer<A>!, _ p: inout MutableSpan<CInt>) {
191+
return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
192+
return unsafe namespaced(a, IntSpan(_pPtr))
193+
}
194+
}
195+
------------------------------
196+
@__swiftmacro_So3bazO1BV8InstanceE10decapseman15_SwiftifyImportfMp_.swift
197+
------------------------------
198+
/// This is an auto-generated wrapper for safer interop
199+
@_alwaysEmitIntoClient @available(visionOS 1.0, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) @_lifetime(p: copy p) @_disfavoredOverload
200+
public mutating func decapseman(_ p: inout MutableSpan<CInt>) {
201+
return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
202+
return unsafe decapseman(IntSpan(_pPtr))
203+
}
204+
}
205+
------------------------------
206+
@__swiftmacro_So10decapseman15_SwiftifyImportfMp_.swift
207+
------------------------------
208+
/// This is an auto-generated wrapper for safer interop
209+
@available(swift, obsoleted: 3, renamed: "baz.B.decapseman(self:_:)") @_alwaysEmitIntoClient @available(visionOS 1.0, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) @_lifetime(p: copy p) @_disfavoredOverload
210+
public func decapseman(_ b: UnsafeMutablePointer<baz.B>!, _ p: inout MutableSpan<CInt>) {
211+
return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
212+
return unsafe decapseman(b, IntSpan(_pPtr))
213+
}
214+
}
215+
------------------------------
167216
@__swiftmacro_So3stdO3__1O0056spanCInt_CUnsignedLong_18446744073709551615_syGJqopasxheV8InstanceE8spanSelf15_SwiftifyImportfMp_.swift
168217
------------------------------
169218
/// This is an auto-generated wrapper for safer interop

0 commit comments

Comments
 (0)