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

15 lines
549 B
Swift

// Ensure that the `unnecessary check` availability warning is emitted when unnecessary due to
// scope's explicit annotation
// RUN: %target-typecheck-verify-swift -verify -target %target-cpu-apple-macosx11.2 -disable-objc-attr-requires-foundation-module
// REQUIRES: OS=macosx
@available(macOS 11.1, *)
class Foo {
// expected-note@-1 {{enclosing scope here}}
func foo() {
// expected-warning@+1 {{unnecessary check for 'macOS'; enclosing scope ensures guard will always be true}}
if #available(macOS 11.0, *) {}
}
}