Files
swift-mirror/test/ModuleInterface/sendable_availability.swift
Doug Gregor 5e50ee8560 Add @available attributes on the implicit "extension" for @_nonSendable types
`@_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.
2022-03-25 11:01:44 -07:00

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