mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
`@_nonSendable` on a type effectively desugars to an unavailable extension that provides (`@unchecked`) conformance to the `Sendable` protocol. Make sure we copy over platform availability so that the extension does not promise greater availability than the type it extends. Fixes rdar://90330588.
27 lines
1.0 KiB
Swift
27 lines
1.0 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -typecheck -enable-library-evolution -target %target-cpu-apple-macosx12.0 -emit-module-interface-path %t/Library.swiftinterface -module-name Library %s
|
|
|
|
// REQUIRES: concurrency
|
|
// REQUIRES: OS=macosx
|
|
|
|
@available(macOS 11.0, *)
|
|
@_nonSendable
|
|
public struct X { }
|
|
|
|
@_nonSendable
|
|
public struct Y { }
|
|
|
|
// RUN: %FileCheck %s <%t/Library.swiftinterface
|
|
// CHECK: @available(macOS 11.0, *)
|
|
// CHECK-NEXT: public struct X
|
|
|
|
// CHECK: @available(macOS, unavailable, introduced: 11.0)
|
|
// CHECK-NEXT: @available(*, unavailable)
|
|
// CHECK-NEXT: extension Library.X{{( )?}}: @unchecked Swift.Sendable {
|
|
|
|
// CHECK: @available(*, unavailable)
|
|
// CHECK-NEXT: extension Library.Y{{( )?}}: @unchecked Swift.Sendable {
|
|
|
|
// RUN: %target-swift-frontend -typecheck -enable-library-evolution -target %target-cpu-apple-macosx12.0 -emit-module-interface-path %t/Library.swiftinterface -DLIBRARY -module-name Library %s -module-interface-preserve-types-as-written
|
|
// RUN: %FileCheck %s <%t/Library.swiftinterface
|