Skip to content

Commit b7daed7

Browse files
authored
Merge pull request #22658 from mikeash/version-9999-always-available
[Stdlib] Special-case major version 9999 as always available.
2 parents 0fe7e14 + de805c0 commit b7daed7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

stdlib/public/core/Availability.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ public func _stdlib_isOSVersionAtLeast(
2525
_ patch: Builtin.Word
2626
) -> Builtin.Int1 {
2727
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
28+
if Int(major) == 9999 {
29+
return true._value
30+
}
2831
// The call to _swift_stdlib_operatingSystemVersion is used as an indicator
2932
// that this function was called by a compiler optimization pass. If it is
3033
// replaced that pass needs to be updated.

test/stdlib/Runtime.swift.gyb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,9 @@ AvailabilityVersionsTestSuite.test("_stdlib_isOSVersionAtLeast") {
766766
expectFalse(isAtLeastOS(1066, 0, 0))
767767
expectTrue(isAtLeastOS(0, 1066, 0))
768768
expectTrue(isAtLeastOS(0, 0, 1066))
769+
770+
// 9999 is a special version that's always available
771+
expectTrue(isAtLeastOS(9999, 0, 0))
769772
#endif
770773
}
771774

0 commit comments

Comments
 (0)