mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This change introduces a new compilation target platform to the Swift compiler - visionOS. - Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target. - Addition of the new platform kind definition. - Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries. - Utilities to read out Darwin platform SDK info containing platform mapping data. - Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback'). - Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path. - Changes to existing test suite to accomodate the new platform.
149 lines
7.4 KiB
Swift
149 lines
7.4 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-emit-module-interfaces(%t/Library.swiftinterface, %t/Library.private.swiftinterface) %s -module-name Library -target %target-swift-abi-5.3-triple
|
|
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -module-name Library
|
|
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.private.swiftinterface) -module-name Library
|
|
// RUN: %FileCheck %s --check-prefixes=CHECK,CHECK-PUBLIC < %t/Library.swiftinterface
|
|
// RUN: %FileCheck %s --check-prefixes=CHECK,CHECK-PRIVATE < %t/Library.private.swiftinterface
|
|
|
|
// REQUIRES: VENDOR=apple
|
|
|
|
// CHECK-NOT: #if compiler(>=5.3) && $Actors
|
|
// CHECK: public actor ActorWithImplicitAvailability {
|
|
public actor ActorWithImplicitAvailability {
|
|
// CHECK: @available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *)
|
|
// CHECK-NEXT: @_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor {
|
|
// CHECK-NEXT: get
|
|
// CHECK-NEXT: }
|
|
}
|
|
|
|
// CHECK-NOT: #if compiler(>=5.3) && $Actors
|
|
// CHECK: @available(macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4, *)
|
|
// CHECK-NEXT: public actor ActorWithExplicitAvailability {
|
|
@available(SwiftStdlib 5.2, *)
|
|
public actor ActorWithExplicitAvailability {
|
|
// CHECK: @available(iOS 13.4, tvOS 13.4, watchOS 6.2, macOS 10.15.4, *)
|
|
// CHECK-NEXT: @_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor {
|
|
// CHECK-NEXT: get
|
|
// CHECK-NEXT: }
|
|
}
|
|
|
|
// CHECK-NOT: #if compiler(>=5.3) && $Actors
|
|
// CHECK: @_hasMissingDesignatedInitializers @available(macOS, unavailable)
|
|
// CHECK-NEXT: public actor UnavailableActor {
|
|
@available(macOS, unavailable)
|
|
public actor UnavailableActor {
|
|
// CHECK: @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
|
|
// CHECK-NEXT: @available(macOS, unavailable, introduced: 10.15)
|
|
// CHECK-NEXT: @_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor {
|
|
// CHECK-NEXT: get
|
|
// CHECK-NEXT: }
|
|
}
|
|
|
|
// CHECK: @available(macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4, *)
|
|
// CHECK-NEXT: public enum Enum {
|
|
@available(SwiftStdlib 5.2, *)
|
|
public enum Enum {
|
|
// CHECK-NOT: #if compiler(>=5.3) && $Actors
|
|
// CHECK: @_hasMissingDesignatedInitializers public actor NestedActor {
|
|
public actor NestedActor {
|
|
// CHECK: @available(iOS 13.4, tvOS 13.4, watchOS 6.2, macOS 10.15.4, *)
|
|
// CHECK-NEXT: @_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor {
|
|
// CHECK-NEXT: get
|
|
// CHECK-NEXT: }
|
|
}
|
|
}
|
|
|
|
// CHECK: extension Library.Enum {
|
|
extension Enum {
|
|
// CHECK-NOT: #if compiler(>=5.3) && $Actors
|
|
// CHECK: @_hasMissingDesignatedInitializers public actor ExtensionNestedActor {
|
|
public actor ExtensionNestedActor {
|
|
// CHECK: @available(iOS 13.4, tvOS 13.4, watchOS 6.2, macOS 10.15.4, *)
|
|
// CHECK-NEXT: @_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor {
|
|
// CHECK-NEXT: get
|
|
// CHECK-NEXT: }
|
|
}
|
|
|
|
// CHECK-NOT: #if compiler(>=5.3) && $Actors
|
|
// CHECK: @_hasMissingDesignatedInitializers @available(macOS, unavailable)
|
|
// CHECK-NEXT: public actor UnavailableExtensionNestedActor {
|
|
@available(macOS, unavailable)
|
|
public actor UnavailableExtensionNestedActor {
|
|
// CHECK: @available(iOS 13.4, tvOS 13.4, watchOS 6.2, *)
|
|
// CHECK-NEXT: @available(macOS, unavailable, introduced: 10.15.4)
|
|
// CHECK-NEXT: @_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor {
|
|
// CHECK-NEXT: get
|
|
// CHECK-NEXT: }
|
|
}
|
|
}
|
|
|
|
// CHECK-PUBLIC: @available(macOS, unavailable)
|
|
// CHECK-PUBLIC-NEXT: @available(iOS, unavailable)
|
|
// CHECK-PUBLIC-NEXT: @available(watchOS, unavailable)
|
|
// CHECK-PUBLIC-NEXT: @available(tvOS, unavailable
|
|
// CHECK-PUBLIC-NEXT: public struct SPIAvailableStruct
|
|
// CHECK-PRIVATE: @_spi_available(macOS, introduced: 10.15.4)
|
|
// CHECK-PRIVATE-NEXT: @_spi_available(iOS, introduced: 13.4)
|
|
// CHECK-PRIVATE-NEXT: @_spi_available(watchOS, introduced: 6.2)
|
|
// CHECK-PRIVATE-NEXT: @_spi_available(tvOS, introduced: 13.4)
|
|
// CHECK-PRIVATE-NEXT: public struct SPIAvailableStruct
|
|
@_spi_available(SwiftStdlib 5.2, *)
|
|
public struct SPIAvailableStruct {
|
|
// CHECK-NOT: #if compiler(>=5.3) && $Actors
|
|
// CHECK: @_hasMissingDesignatedInitializers @available(macOS, unavailable)
|
|
// CHECK-NEXT: public actor UnavailableNestedActor
|
|
@available(macOS, unavailable)
|
|
public actor UnavailableNestedActor {
|
|
// CHECK-PUBLIC: @available(iOS, unavailable)
|
|
// CHECK-PUBLIC-NEXT: @available(tvOS, unavailable)
|
|
// CHECK-PUBLIC-NEXT: @available(watchOS, unavailable)
|
|
// CHECK-PUBLIC-NEXT: @available(macOS, unavailable)
|
|
// CHECK-PUBLIC-NEXT: @_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor
|
|
// CHECK-PRIVATE: @_spi_available(iOS, introduced: 13.4)
|
|
// CHECK-PRIVATE-NEXT: @_spi_available(tvOS, introduced: 13.4)
|
|
// CHECK-PRIVATE-NEXT: @_spi_available(watchOS, introduced: 6.2)
|
|
// CHECK-PRIVATE-NEXT: @_spi_available(macOS, unavailable, introduced: 10.15.4)
|
|
// CHECK-PRIVATE-NEXT: @_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor
|
|
}
|
|
}
|
|
|
|
// CHECK: @_hasMissingDesignatedInitializers @available(macCatalyst 13.1, *)
|
|
// CHECK-NEXT: public class MacCatalystAvailableClass
|
|
@available(macCatalyst 13.1, *)
|
|
public class MacCatalystAvailableClass {
|
|
// CHECK-NOT: #if compiler(>=5.3) && $Actors
|
|
// CHECK: @_hasMissingDesignatedInitializers public actor NestedActor
|
|
public actor NestedActor {
|
|
// CHECK: @available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, macCatalyst 13.1, *)
|
|
// CHECK-NEXT: @_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor
|
|
}
|
|
|
|
// CHECK-NOT: #if compiler(>=5.3) && $Actors
|
|
// CHECK: @_hasMissingDesignatedInitializers @available(macCatalyst 14, *)
|
|
// CHECK-NEXT: public actor LessAvailableMacCatalystActor
|
|
@available(macCatalyst 14, *)
|
|
public actor LessAvailableMacCatalystActor {
|
|
// CHECK: @available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, macCatalyst 14, *)
|
|
// CHECK-NEXT: @_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor
|
|
}
|
|
|
|
// CHECK-NOT: #if compiler(>=5.3) && $Actors
|
|
// CHECK: @_hasMissingDesignatedInitializers @available(iOS 15.0, macOS 12.0, *)
|
|
// CHECK-NEXT: public actor AvailableiOSAndMacOSNestedActor {
|
|
@available(iOS 15.0, macOS 12.0, *)
|
|
public actor AvailableiOSAndMacOSNestedActor {
|
|
// CHECK: @available(iOS 15.0, tvOS 13.0, watchOS 6.0, macOS 12.0, *)
|
|
// CHECK-NEXT: @_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor
|
|
}
|
|
|
|
// CHECK-NOT: #if compiler(>=5.3) && $Actors
|
|
// CHECK: @_hasMissingDesignatedInitializers @available(iOS, unavailable)
|
|
// CHECK-NEXT: public actor UnavailableiOSNestedActor
|
|
@available(iOS, unavailable)
|
|
public actor UnavailableiOSNestedActor {
|
|
// CHECK: @available(tvOS 13.0, watchOS 6.0, macOS 10.15, *)
|
|
// CHECK-NEXT: @available(iOS, unavailable, introduced: 13.0)
|
|
// CHECK-NEXT: @_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor
|
|
}
|
|
}
|