Skip to content

Commit d983f30

Browse files
committed
comment test cases unsupported in Swift 6.2
1 parent 6a9ac22 commit d983f30

File tree

2 files changed

+16
-109
lines changed

2 files changed

+16
-109
lines changed

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

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
import Instance
1212

1313
@available(macOS 13.3.0, *)
14-
func foo(_ p: inout MutableSpan<CInt>, a: A, aa: inout A, c: C, b: B, bb: inout B) {
14+
func foo(_ p: inout MutableSpan<CInt>, a: A, aa: inout A, c: C/*, b: B, bb: inout B*/) {
1515
aa.basic(&p)
1616
aa.bar(&p)
1717
a.constSelf(&p)
1818
a.valSelf(&p)
1919
let _: MutableSpan<CInt> = a.lifetimeBoundSelf(3)
2020
c.refSelf(&p)
21-
b.nonescaping(&p)
22-
let _: MutableSpan<CInt> = bb.nonescapingLifetimebound(73)
21+
//b.nonescaping(&p)
22+
//let _: MutableSpan<CInt> = bb.nonescapingLifetimebound(73)
2323

2424
#if VERIFY
2525
aa.countedSelf(&p)
@@ -55,9 +55,11 @@ void refSelf(struct C *c, int * __counted_by(len) p __noescape, int len) __attri
5555

5656
int * __counted_by(len) lifetimeBoundSelf(struct A a __lifetimebound, int len) __attribute__((swift_name("A.lifetimeBoundSelf(self:_:)")));
5757

58-
void nonescaping(const struct B *d, int * __counted_by(len) p __noescape, int len) __attribute__((swift_name("B.nonescaping(self:_:_:)")));
58+
//void nonescaping(const struct B *d, int * __counted_by(len) p __noescape, int len) __attribute__((swift_name("B.nonescaping(self:_:_:)")));
5959

60-
int * __counted_by(len) nonescapingLifetimebound(struct B *d __lifetimebound, int len) __attribute__((swift_name("B.nonescapingLifetimebound(self:_:)")));
60+
// Swift 6.2 error: a mutating method cannot have a ~Escapable 'self'
61+
// requires https://github.com/swiftlang/swift/pull/84010
62+
//int * __counted_by(len) nonescapingLifetimebound(struct B *d __lifetimebound, int len) __attribute__((swift_name("B.nonescapingLifetimebound(self:_:)")));
6163

6264
//--- Inputs/module.modulemap
6365
module Instance {
@@ -191,22 +193,3 @@ public func refSelf(_ c: C!, _ p: inout MutableSpan<Int32>) {
191193
}
192194
}
193195
------------------------------
194-
@__swiftmacro_So1BV11nonescaping15_SwiftifyImportfMp_.swift
195-
------------------------------
196-
/// This is an auto-generated wrapper for safer interop
197-
@_alwaysEmitIntoClient @available(visionOS 1.0, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) @_lifetime(p: copy p) @_disfavoredOverload
198-
public func nonescaping(_ p: inout MutableSpan<Int32>) {
199-
let len = Int32(exactly: p.count)!
200-
return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
201-
return unsafe nonescaping(_pPtr.baseAddress!, len)
202-
}
203-
}
204-
------------------------------
205-
@__swiftmacro_So1BV24nonescapingLifetimebound15_SwiftifyImportfMp_.swift
206-
------------------------------
207-
/// This is an auto-generated wrapper for safer interop
208-
@_alwaysEmitIntoClient @available(visionOS 1.0, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) @_lifetime(copy self) @_disfavoredOverload
209-
public mutating func nonescapingLifetimebound(_ len: Int32) -> MutableSpan<Int32> {
210-
return unsafe _swiftifyOverrideLifetime(MutableSpan<Int32>(_unsafeStart: unsafe nonescapingLifetimebound(len), count: Int(len)), copying: ())
211-
}
212-
------------------------------

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

Lines changed: 9 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
//--- test.swift
1010
import Instance
1111

12-
func foo(_ p: inout MutableSpan<CInt>, a: A, aa: inout A, s: IntSpan, cs: ConstIntSpan, asp: AliasingSpan, b: inout baz.B) {
12+
func foo(_ p: inout MutableSpan<CInt>, a: A, aa: inout A, s: IntSpan, cs: ConstIntSpan, asp: AliasingSpan/*, b: inout baz.B*/) {
1313
aa.basic(&p)
1414
aa.bar(&p)
1515
a.constSelf(&p)
1616
a.valSelf(&p)
1717
aa.refSelf(&p)
18-
aa.namespaced(&p)
19-
b.decapseman(&p)
20-
baz.bar(&aa, &p)
21-
baz.this(&aa, &p)
18+
//aa.namespaced(&p)
19+
//b.decapseman(&p)
20+
//baz.bar(&aa, &p)
21+
//baz.this(&aa, &p)
2222

2323
let _: IntSpan = unsafe s.spanSelf()
2424
let _: MutableSpan<CInt> = unsafe s.spanSelf()
@@ -60,6 +60,9 @@ const IntSpan spanConstSelf(const IntSpan p __lifetimebound) __attribute__((swif
6060

6161
ConstIntSpan constSpanSelf(ConstIntSpan p __lifetimebound) __attribute__((swift_name("ConstIntSpan.constSpanSelf(self:)")));
6262

63+
/*
64+
* Swift 6.2 error: 'swift_name' attribute has invalid identifier for the base name.
65+
* Requires https://github.com/llvm/llvm-project/pull/145947
6366
namespace baz {
6467
void namespaced(A *a, IntSpan p __noescape) __attribute__((swift_name("A.namespaced(self:_:)")));
6568
struct B {};
@@ -68,6 +71,7 @@ namespace baz {
6871
}
6972

7073
void decapseman(baz::B *b, IntSpan p __noescape) __attribute__((swift_name("baz.B.decapseman(self:_:)")));
74+
*/
7175

7276
//--- Inputs/module.modulemap
7377
module Instance {
@@ -176,86 +180,6 @@ module Instance {
176180
// CHECK-NEXT: }
177181
// CHECK-NEXT:}
178182
// CHECK-NEXT:------------------------------
179-
// CHECK-NEXT:@__swiftmacro_{{.*}}namespaced{{.*}}_SwiftifyImportfMp_.swift
180-
// CHECK-NEXT:------------------------------
181-
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop
182-
// CHECK-NEXT:@_alwaysEmitIntoClient @available(visionOS 1.0, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) @_lifetime(p: copy p) @_disfavoredOverload
183-
// CHECK-NEXT:public mutating func namespaced(_ p: inout MutableSpan<CInt>) {
184-
// CHECK-NEXT: return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
185-
// CHECK-NEXT: return unsafe namespaced(IntSpan(_pPtr))
186-
// CHECK-NEXT: }
187-
// CHECK-NEXT:}
188-
// CHECK-NEXT:------------------------------
189-
// CHECK-NEXT:@__swiftmacro_{{.*}}baz{{.*}}namespaced{{.*}}_SwiftifyImportfMp_.swift
190-
// CHECK-NEXT:------------------------------
191-
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop
192-
// CHECK-NEXT:@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
193-
// CHECK-NEXT: public static func namespaced(_ a: UnsafeMutablePointer<A>!, _ p: inout MutableSpan<CInt>) {
194-
// CHECK-NEXT: return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
195-
// CHECK-NEXT: return unsafe namespaced(a, IntSpan(_pPtr))
196-
// CHECK-NEXT: }
197-
// CHECK-NEXT:}
198-
// CHECK-NEXT:------------------------------
199-
// CHECK-NEXT:@__swiftmacro_{{.*}}baz{{.*}}Instance{{.*}}decapseman{{.*}}_SwiftifyImportfMp_.swift
200-
// CHECK-NEXT:------------------------------
201-
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop
202-
// CHECK-NEXT:@_alwaysEmitIntoClient @available(visionOS 1.0, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) @_lifetime(p: copy p) @_disfavoredOverload
203-
// CHECK-NEXT:public mutating func decapseman(_ p: inout MutableSpan<CInt>) {
204-
// CHECK-NEXT: return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
205-
// CHECK-NEXT: return unsafe decapseman(IntSpan(_pPtr))
206-
// CHECK-NEXT: }
207-
// CHECK-NEXT:}
208-
// CHECK-NEXT:------------------------------
209-
// CHECK-NEXT:@__swiftmacro_{{.*}}decapseman{{.*}}_SwiftifyImportfMp_.swift
210-
// CHECK-NEXT:------------------------------
211-
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop
212-
// CHECK-NEXT:@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
213-
// CHECK-NEXT:public func decapseman(_ b: UnsafeMutablePointer<baz.B>!, _ p: inout MutableSpan<CInt>) {
214-
// CHECK-NEXT: return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
215-
// CHECK-NEXT: return unsafe decapseman(b, IntSpan(_pPtr))
216-
// CHECK-NEXT: }
217-
// CHECK-NEXT:}
218-
// CHECK-NEXT:------------------------------
219-
// CHECK-NEXT:@__swiftmacro_{{.*}}baz{{.*}}Instance{{.*}}bar{{.*}}_SwiftifyImportfMp_.swift
220-
// CHECK-NEXT:------------------------------
221-
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop
222-
// CHECK-NEXT:@_alwaysEmitIntoClient @available(visionOS 1.0, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) @_lifetime(p: copy p) @_disfavoredOverload
223-
// CHECK-NEXT:public static func bar(_ a: inout A, _ p: inout MutableSpan<CInt>) {
224-
// CHECK-NEXT: return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
225-
// CHECK-NEXT: return unsafe bar(&a, IntSpan(_pPtr))
226-
// CHECK-NEXT: }
227-
// CHECK-NEXT:}
228-
// CHECK-NEXT:------------------------------
229-
// CHECK-NEXT:@__swiftmacro_{{.*}}baz{{.*}}renamed{{.*}}_SwiftifyImportfMp_.swift
230-
// CHECK-NEXT:------------------------------
231-
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop
232-
// CHECK-NEXT:@available(swift, obsoleted: 3, renamed: "baz.bar(_:_:)") @_alwaysEmitIntoClient @available(visionOS 1.0, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) @_lifetime(p: copy p) @_disfavoredOverload
233-
// CHECK-NEXT: public static func renamed(_ a: inout A, _ p: inout MutableSpan<CInt>) {
234-
// CHECK-NEXT: return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
235-
// CHECK-NEXT: return unsafe renamed(&a, IntSpan(_pPtr))
236-
// CHECK-NEXT: }
237-
// CHECK-NEXT:}
238-
// CHECK-NEXT:------------------------------
239-
// CHECK-NEXT:@__swiftmacro_{{.*}}baz{{.*}}this{{.*}}_SwiftifyImportfMp_.swift
240-
// CHECK-NEXT:------------------------------
241-
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop
242-
// CHECK-NEXT:@_alwaysEmitIntoClient @available(visionOS 1.0, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) @_lifetime(p: copy p) @_disfavoredOverload
243-
// CHECK-NEXT:public static func this(_ a: inout A, _ p: inout MutableSpan<CInt>) {
244-
// CHECK-NEXT: return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
245-
// CHECK-NEXT: return unsafe this(&a, IntSpan(_pPtr))
246-
// CHECK-NEXT: }
247-
// CHECK-NEXT:}
248-
// CHECK-NEXT:------------------------------
249-
// CHECK-NEXT:@__swiftmacro_{{.*}}baz{{.*}}that{{.*}}_SwiftifyImportfMp_.swift
250-
// CHECK-NEXT:------------------------------
251-
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop
252-
// CHECK-NEXT:@available(swift, obsoleted: 3, renamed: "this(_:_:)") @_alwaysEmitIntoClient @available(visionOS 1.0, tvOS 12.2, watchOS 5.2, iOS 12.2, macOS 10.14.4, *) @_lifetime(p: copy p) @_disfavoredOverload
253-
// CHECK-NEXT: public static func that(_ a: inout A, _ p: inout MutableSpan<CInt>) {
254-
// CHECK-NEXT: return unsafe p.withUnsafeMutableBufferPointer { _pPtr in
255-
// CHECK-NEXT: return unsafe that(&a, IntSpan(_pPtr))
256-
// CHECK-NEXT: }
257-
// CHECK-NEXT:}
258-
// CHECK-NEXT:------------------------------
259183
// CHECK-NEXT:@__swiftmacro_{{.*}}Instance{{.*}}spanSelf{{.*}}_SwiftifyImportfMp_.swift
260184
// CHECK-NEXT:------------------------------
261185
// CHECK-NEXT:/// This is an auto-generated wrapper for safer interop

0 commit comments

Comments
 (0)