AST: Introduce queries on Decl for active @available attrs.

Use these queries to replace some duplicated code. Also, move the
`attr_inlinable_available.swift` test to the `Availability` sub-directory since
the test has more to do with availability checking than it has to do
specifically with the `@inlinable` attr.
This commit is contained in:
Allan Shortlidge
2025-07-16 12:51:30 -07:00
parent b97df2645b
commit a3fbe3d530
6 changed files with 84 additions and 37 deletions

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -typecheck -dump-availability-scopes %s -target %target-cpu-apple-macos50 > %t.dump 2>&1
// RUN: %target-swift-frontend -typecheck -dump-availability-scopes %s -target %target-cpu-apple-macos50 -swift-version 5 > %t.dump 2>&1
// RUN: %FileCheck --strict-whitespace %s < %t.dump
// REQUIRES: OS=macosx
@@ -454,6 +454,23 @@ func deprecatedOnMacOS() {
let x = 1
}
// Since availableOniOS() doesn't have any active @available attributes it
// shouldn't create a scope.
// CHECK-NOT: availableOniOS
@available(iOS, introduced: 53)
func availableOniOS() { }
// CHECK-NEXT: {{^}} (decl version=50 decl=availableInSwift5
@available(swift 5)
func availableInSwift5() { }
// CHECK-NEXT: {{^}} (decl version=50 unavailable=swift decl=availableInSwift6
@available(swift 6)
func availableInSwift6() { }
// CHECK-NEXT: {{^}} (decl version=51 decl=FinalDecl
@available(OSX 51, *)

File diff suppressed because it is too large Load Diff