Files
swift-mirror/test/Availability/availability_soft_deprecated.swift
Allan Shortlidge 897a74f495 Tests: Move some availability tests into a new test/Availability directory.
Un-reverts 9c01ee2c1b.

Also, add myself as a reviewer for more availability related files.

NFC.
2025-06-23 15:57:34 -07:00

47 lines
1.6 KiB
Swift

// RUN: %target-typecheck-verify-swift
// RUN: %target-typecheck-verify-swift -warn-soft-deprecated -verify-additional-prefix soft-deprecated-
// REQUIRES: OS=macosx || OS=ios || OS=tvos || OS=watchos || OS=xros
@available(*, deprecated)
func alwaysDeprecated() {}
@available(macOS, deprecated: 1.0)
@available(iOS, deprecated: 1.0)
@available(tvOS, deprecated: 1.0)
@available(watchOS, deprecated: 1.0)
@available(visionOS, deprecated: 1.0)
func deprecatedEarly() {}
@available(macOS, deprecated: 10000)
@available(iOS, deprecated: 10000)
@available(tvOS, deprecated: 10000)
@available(watchOS, deprecated: 10000)
@available(visionOS, deprecated: 10000)
func deprecatedFarFuture() {}
protocol Proto {}
struct HasSoftDeprecatedConformanceToProto {}
@available(macOS, deprecated: 10000)
@available(iOS, deprecated: 10000)
@available(tvOS, deprecated: 10000)
@available(watchOS, deprecated: 10000)
@available(visionOS, deprecated: 10000)
extension HasSoftDeprecatedConformanceToProto: Proto {}
func test() {
alwaysDeprecated() // expected-warning {{'alwaysDeprecated()' is deprecated}}
deprecatedEarly() // expected-warning {{'deprecatedEarly()' was deprecated in}}
deprecatedFarFuture() // expected-soft-deprecated-warning {{'deprecatedFarFuture()' was deprecated in}}
let _: any Proto = HasSoftDeprecatedConformanceToProto() // expected-soft-deprecated-warning {{conformance of 'HasSoftDeprecatedConformanceToProto' to 'Proto' was deprecated in}}
}
@available(*, deprecated)
func testDeprecated() {
alwaysDeprecated()
deprecatedEarly()
deprecatedFarFuture()
let _: any Proto = HasSoftDeprecatedConformanceToProto()
}