Files
swift-mirror/test/SILGen/unavailable_decl_optimization_visionos.swift
Artem Chikin 1f14158a1d Introduce VisionOS Platform
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.
2024-04-10 09:38:02 -07:00

69 lines
2.8 KiB
Swift

// RUN: %target-swift-emit-silgen -module-name Test -parse-as-library %s -verify -target arm64-apple-xros1.0 | %FileCheck %s --check-prefixes=CHECK
// RUN: %target-swift-emit-silgen -module-name Test -parse-as-library %s -verify -unavailable-decl-optimization=none -target arm64-apple-xros1.0 | %FileCheck %s --check-prefixes=CHECK
// REQUIRES: OS=xros
public struct S {}
// CHECK-LABEL: sil{{.*}}@$s4Test19visionOSUnavailableAA1SVyF
// CHECK-NOT: ss31_diagnoseUnavailableCodeReacheds5NeverOyF
// CHECK: } // end sil function '$s4Test19visionOSUnavailableAA1SVyF'
@available(visionOS, unavailable)
public func visionOSUnavailable() -> S {
return S()
}
// CHECK-LABEL: sil{{.*}}@$s4Test14iOSUnavailableAA1SVyF
// CHECK-NOT: ss31_diagnoseUnavailableCodeReacheds5NeverOyF
// CHECK: } // end sil function '$s4Test14iOSUnavailableAA1SVyF'
@available(iOS, unavailable)
public func iOSUnavailable() -> S {
return S()
}
// CHECK-LABEL: sil{{.*}}@$s4Test16macOSUnavailableAA1SVyF
// CHECK-NOT: ss31_diagnoseUnavailableCodeReacheds5NeverOyF
// CHECK: } // end sil function '$s4Test16macOSUnavailableAA1SVyF'
@available(macOS, unavailable)
public func macOSUnavailable() -> S {
return S()
}
// CHECK-LABEL: sil{{.*}}@$s4Test31iOSUnavailableVisionOSAvailableAA1SVyF
// CHECK-NOT: ss31_diagnoseUnavailableCodeReacheds5NeverOyF
// CHECK: } // end sil function '$s4Test31iOSUnavailableVisionOSAvailableAA1SVyF'
@available(iOS, unavailable)
@available(visionOS, introduced: 1.0)
public func iOSUnavailableVisionOSAvailable() -> S {
return S()
}
// CHECK-LABEL: sil{{.*}}@$s4Test25iOSAndVisionOSUnavailableAA1SVyF
// CHECK-NOT: ss31_diagnoseUnavailableCodeReacheds5NeverOyF
// CHECK: } // end sil function '$s4Test25iOSAndVisionOSUnavailableAA1SVyF'
@available(iOS, unavailable)
@available(visionOS, unavailable)
public func iOSAndVisionOSUnavailable() -> S {
// FIXME: This function should be optimized (rdar://116742214)
return S()
}
@available(visionOS, unavailable)
public struct UnavailableOnVisionOS {
// CHECK-LABEL: sil{{.*}}@$s4Test21UnavailableOnVisionOSV14noAvailabilityAA1SVyF
// CHECK-NOT: ss31_diagnoseUnavailableCodeReacheds5NeverOyF
// CHECK: } // end sil function '$s4Test21UnavailableOnVisionOSV14noAvailabilityAA1SVyF'
public func noAvailability() -> S {
return S()
}
// CHECK-LABEL: sil{{.*}}@$s4Test21UnavailableOnVisionOSV022iOSUnavailableInheritsdF0AA1SVyF
// CHECK-NOT: ss31_diagnoseUnavailableCodeReacheds5NeverOyF
// CHECK: } // end sil function '$s4Test21UnavailableOnVisionOSV022iOSUnavailableInheritsdF0AA1SVyF'
@available(iOS, unavailable)
public func iOSUnavailableInheritsVisionOSUnavailable() -> S {
// FIXME: This function should be optimized (rdar://116742214)
return S()
}
}