Skip to content

stdlib: Float16 needs an @available annotation for macOS [5.4] #36030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/public/core/FloatingPointTypes.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ internal struct _${Self}AnyHashableBox: _AnyHashableBox {
${SelfDocComment}
@frozen
% if bits == 16:
@available(iOS 14, tvOS 14, watchOS 7, *)
@available(macOS 11, iOS 14, tvOS 14, watchOS 7, *)
@available(macOS, unavailable)
@available(macCatalyst, unavailable)
% else:
Expand Down
15 changes: 15 additions & 0 deletions test/IRGen/float16_macos.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// RUN: %target-swift-frontend -emit-ir %s -target x86_64-apple-macos10.15 | %FileCheck %s --check-prefix=CHECK10
// RUN: %target-swift-frontend -emit-ir %s -target x86_64-apple-macos11 | %FileCheck %s --check-prefix=CHECK11

// REQUIRES: OS=macosx
// REQUIRES: CPU=x86_64
// UNSUPPORTED: use_os_stdlib

@available(macOS 11, *)
public struct Float16Wrapper {
@available(macOS, unavailable)
var x: Float16
}

// CHECK10-LABEL: @"$ss7Float16VMn" = extern_weak global %swift.type_descriptor
// CHECK11-LABEL: @"$ss7Float16VMn" = external global %swift.type_descriptor