From a4bf73860bbd995d08feabc5942a7abe61e4c7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20Laferrie=CC=80re?= Date: Tue, 8 Sep 2020 14:09:11 -0700 Subject: [PATCH] [stdlib] Align availability of a Float16 initializer with its type The constructor `init?(text: Substring)` was more available than its type Float16 for macOS and macCatalyst where the type is explicitly unavailable. The compiler may report this as an error in the future. --- stdlib/public/core/FloatingPointParsing.swift.gyb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stdlib/public/core/FloatingPointParsing.swift.gyb b/stdlib/public/core/FloatingPointParsing.swift.gyb index aa58f864ddc42..0ae7a0a3e6dbb 100644 --- a/stdlib/public/core/FloatingPointParsing.swift.gyb +++ b/stdlib/public/core/FloatingPointParsing.swift.gyb @@ -166,7 +166,13 @@ extension ${Self}: LosslessStringConvertible { // In particular, we still have to export // _swift_stdlib_strtoXYZ_clocale() // as ABI to support old compiled code that still requires it. +%if bits == 16: + @available(iOS 14.0, watchOS 7.0, tvOS 14.0, *) + @available(macOS, unavailable) + @available(macCatalyst, unavailable) +%else: @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *) +%end public init?(_ text: Substring) { self = 0.0 let success = withUnsafeMutablePointer(to: &self) { p -> Bool in