Skip to content

Commit 9ecfac2

Browse files
committed
[test] Adjust tests now that Optional supports nonescapable use
`Optional` is now depending on `$NonescapableTypes`, and thus the compiler no longer generates `#else` branches to allow suppressing that feature.
1 parent b7b75ae commit 9ecfac2

File tree

4 files changed

+2
-20
lines changed

4 files changed

+2
-20
lines changed

test/Concurrency/sending_conditional_suppression.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,7 @@ public struct TestInStruct {
207207
// to make sure we do not fail if we fail to parse sending in the if block.
208208

209209
// CHECK: #if compiler(>=5.3) && $NonescapableTypes // Suppression Count: 24
210-
// CHECK-NEXT: @inlinable public func withCheckedContinuation<T>(isolation: isolated (any _Concurrency.Actor)? = #isolation, function: Swift.String = #function, _ body: (_Concurrency.CheckedContinuation<T, Swift.Never>) -> Swift.Void) async -> sending T {
211-
// CHECK-NEXT: fatalError()
212-
// CHECK-NEXT: }
213-
// CHECK-NEXT: #elseif compiler(>=5.3) && $SendingArgsAndResults // Suppression Count: 25
210+
// CHECK-NEXT: #if compiler(>=5.3) && $SendingArgsAndResults // Suppression Count: 25
214211
// CHECK-NEXT: @inlinable public func withCheckedContinuation<T>(isolation: isolated (any _Concurrency.Actor)? = #isolation, function: Swift.String = #function, _ body: (_Concurrency.CheckedContinuation<T, Swift.Never>) -> Swift.Void) async -> sending T {
215212
// CHECK-NEXT: fatalError()
216213
// CHECK-NEXT: }
@@ -219,6 +216,7 @@ public struct TestInStruct {
219216
// CHECK-NEXT: fatalError()
220217
// CHECK-NEXT: }
221218
// CHECK-NEXT: #endif
219+
// CHECK-NEXT: #endif
222220
@inlinable public func withCheckedContinuation<T>(
223221
isolation: isolated (any _Concurrency.Actor)? = #isolation,
224222
function: String = #function,

test/Macros/SwiftifyImport/MacroErrors/NullableSpan.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
// RUN: %target-typecheck-verify-swift -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -verify
44

5-
// XFAIL: *
6-
// expanded form errors with "type 'Span' does not conform to protocol 'Escapable'" because Optional doesn't support ~Escapable yet
75
@_SwiftifyImport(.countedBy(pointer: .param(1), count: "len"), .nonescaping(pointer: .param(1)))
86
func nullableSpan(_ ptr: UnsafePointer<CInt>?, _ len: CInt) {
97
}

test/Macros/SwiftifyImport/SizedBy/Opaque.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ func impNullableUnsafeRawBufferPointer(_ ptr: OpaquePointer!, _ size: CInt) {
2121
func nonnullSpan(_ ptr: OpaquePointer, _ size: CInt) {
2222
}
2323

24-
// expected-note@+2{{in expansion of macro '_SwiftifyImport' on global function 'nullableSpan' here}}
25-
// Cannot refer to source location for the error: "type 'RawSpan' does not conform to protocol 'Escapable'" (which is currently necessary for Optional)
2624
@_SwiftifyImport(.sizedBy(pointer: .param(1), size: "size"), .nonescaping(pointer: .param(1)))
2725
func nullableSpan(_ ptr: OpaquePointer?, _ size: CInt) {
2826
}

test/ModuleInterface/noncopyable_generics.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,28 +140,16 @@ import NoncopyableGenerics_Misc
140140
// CHECK-MISC-NEXT: }
141141
// CHECK-MISC-NEXT: #if compiler(>=5.3) && $NonescapableTypes
142142
// CHECK-MISC-NEXT: public func substCopyable(_ t: Swift.String?)
143-
// CHECK-MISC-NEXT: #else
144-
// CHECK-MISC-NEXT: public func substCopyable(_ t: Swift.String?)
145143
// CHECK-MISC-NEXT: #endif
146144
// CHECK-MISC-NEXT: #if compiler(>=5.3) && $NonescapableTypes
147145
// CHECK-MISC-NEXT: public func substGenericCopyable<T>(_ t: T?)
148-
// CHECK-MISC-NEXT: #else
149-
// CHECK-MISC-NEXT: public func substGenericCopyable<T>(_ t: T?)
150146
// CHECK-MISC-NEXT: #endif
151147

152-
// NOTE: we really shouldn't be emitting the else branch for the two funcs
153-
// below, since the suppressed version isn't valid. We don't have a good way of
154-
// fixing that right now, either.
155-
156148
// CHECK-MISC-NEXT: #if compiler(>=5.3) && $NonescapableTypes
157149
// CHECK-MISC-NEXT: public func substNC(_ t: borrowing {{.*}}.NoCopyPls?)
158-
// CHECK-MISC-NEXT: #else
159-
// CHECK-MISC-NEXT: public func substNC(_ t: borrowing {{.*}}.NoCopyPls?)
160150
// CHECK-MISC-NEXT: #endif
161151
// CHECK-MISC-NEXT: #if compiler(>=5.3) && $NonescapableTypes
162152
// CHECK-MISC-NEXT: public func substGenericNC<T>(_ t: borrowing T?) where T : ~Copyable
163-
// CHECK-MISC-NEXT: #else
164-
// CHECK-MISC-NEXT: public func substGenericNC<T>(_ t: borrowing T?) where T : ~Copyable
165153
// CHECK-MISC-NEXT: #endif
166154

167155
// CHECK-MISC: public protocol Publik : ~Copyable {

0 commit comments

Comments
 (0)