@@ -16,6 +16,7 @@ import Swift
16
16
@_silgen_name ( " swift_continuation_logFailedCheck " )
17
17
internal func logFailedCheck( _ message: UnsafeRawPointer )
18
18
19
+ #if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
19
20
/// Implementation class that holds the `UnsafeContinuation` instance for
20
21
/// a `CheckedContinuation`.
21
22
@available( SwiftStdlib 5 . 1 , * )
@@ -82,7 +83,9 @@ internal final class CheckedContinuationCanary: @unchecked Sendable {
82
83
}
83
84
}
84
85
}
86
+ #endif
85
87
88
+ #if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
86
89
/// A mechanism to interface
87
90
/// between synchronous and asynchronous code,
88
91
/// logging correctness violations.
@@ -296,4 +299,65 @@ public func withCheckedThrowingContinuation<T>(
296
299
body ( CheckedContinuation ( continuation: $0, function: function) )
297
300
}
298
301
}
302
+ #else
303
+ @available ( SwiftStdlib 5 . 1 , * )
304
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
305
+ public struct CheckedContinuation < T, E: Error > : Sendable {
306
+ @available ( SwiftStdlib 5 . 1 , * )
307
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
308
+ public init ( continuation: UnsafeContinuation < T , E > , function: String = #function) {
309
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
310
+ }
311
+
312
+ @available ( SwiftStdlib 5 . 1 , * )
313
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
314
+ public func resume( returning value: __owned T) {
315
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
316
+ }
317
+
318
+ @available ( SwiftStdlib 5 . 1 , * )
319
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
320
+ public func resume( throwing error: __owned E) {
321
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
322
+ }
323
+ }
324
+ @available ( SwiftStdlib 5 . 1 , * )
325
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
326
+ extension CheckedContinuation {
327
+ @available ( SwiftStdlib 5 . 1 , * )
328
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
329
+ public func resume< Er: Error > ( with result: Result < T , Er > ) where E == Error {
330
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
331
+ }
332
+
333
+ @available ( SwiftStdlib 5 . 1 , * )
334
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
335
+ public func resume( with result: Result < T , E > ) {
336
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
337
+ }
299
338
339
+ @available ( SwiftStdlib 5 . 1 , * )
340
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
341
+ public func resume( ) where T == Void {
342
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
343
+ }
344
+ }
345
+
346
+ @available ( SwiftStdlib 5 . 1 , * )
347
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
348
+ public func withCheckedContinuation< T> (
349
+ function: String = #function,
350
+ _ body: ( CheckedContinuation < T , Never > ) -> Void
351
+ ) async -> T {
352
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
353
+ }
354
+
355
+ @available ( SwiftStdlib 5 . 1 , * )
356
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
357
+ public func withCheckedThrowingContinuation< T> (
358
+ function: String = #function,
359
+ _ body: ( CheckedContinuation < T , Error > ) -> Void
360
+ ) async throws -> T {
361
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
362
+ }
363
+ #endif
0 commit comments