From de805c011283c75114be2167b32bbe417ab5fd31 Mon Sep 17 00:00:00 2001 From: Mike Ash Date: Tue, 12 Feb 2019 14:40:55 -0500 Subject: [PATCH] [Stdlib] Special-case major version 9999 as always available. rdar://problem/43776049 --- stdlib/public/core/Availability.swift | 3 +++ test/stdlib/Runtime.swift.gyb | 3 +++ 2 files changed, 6 insertions(+) diff --git a/stdlib/public/core/Availability.swift b/stdlib/public/core/Availability.swift index 9a7a1b9bc4981..1ff2b47715ece 100644 --- a/stdlib/public/core/Availability.swift +++ b/stdlib/public/core/Availability.swift @@ -25,6 +25,9 @@ public func _stdlib_isOSVersionAtLeast( _ patch: Builtin.Word ) -> Builtin.Int1 { #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) + if Int(major) == 9999 { + return true._value + } // The call to _swift_stdlib_operatingSystemVersion is used as an indicator // that this function was called by a compiler optimization pass. If it is // replaced that pass needs to be updated. diff --git a/test/stdlib/Runtime.swift.gyb b/test/stdlib/Runtime.swift.gyb index 51ba861d93ce2..d56899f6c087f 100644 --- a/test/stdlib/Runtime.swift.gyb +++ b/test/stdlib/Runtime.swift.gyb @@ -766,6 +766,9 @@ AvailabilityVersionsTestSuite.test("_stdlib_isOSVersionAtLeast") { expectFalse(isAtLeastOS(1066, 0, 0)) expectTrue(isAtLeastOS(0, 1066, 0)) expectTrue(isAtLeastOS(0, 0, 1066)) + + // 9999 is a special version that's always available + expectTrue(isAtLeastOS(9999, 0, 0)) #endif }