Files
swift-mirror/test/Availability/availability_macos.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

38 lines
951 B
Swift

// RUN: %target-typecheck-verify-swift
// REQUIRES: OS=macosx
struct A {} // expected-note * {{found this candidate}}
struct B {} // expected-note * {{found this candidate}}
func ambiguousInFarFuture(_: A) {}
@available(macOS 99, *)
func ambiguousInFarFuture(_: B) {}
struct S {
func ambiguousInFarFuture(_: A) {}
}
@available(macOS 99, *)
extension S {
func ambiguousInFarFuture(_: B) {}
}
func testDeploymentTarget(_ s: S) {
ambiguousInFarFuture(.init())
s.ambiguousInFarFuture(.init())
}
@available(macOS 99, *)
func testFarFuture(_ s: S) {
ambiguousInFarFuture(.init()) // expected-error {{ambiguous use of 'init()'}}
s.ambiguousInFarFuture(.init()) // expected-error {{ambiguous use of 'init()'}}
}
@available(macOS, unavailable)
func testUnavailable(_ s: S) {
ambiguousInFarFuture(.init()) // expected-error {{ambiguous use of 'init()'}}
s.ambiguousInFarFuture(.init()) // expected-error {{ambiguous use of 'init()'}}
}