Skip to content

Commit 1dbcf23

Browse files
committed
[stdlib] Availability macros don't work in inlinable code 😩
1 parent e2cfab4 commit 1dbcf23

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

‎stdlib/public/core/Assert.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ internal func _internalInvariant_5_1(
311311
// FIXME: The below won't run the assert on 5.1 stdlib if testing on older
312312
// OSes, which means that testing may not test the assertion. We need a real
313313
// solution to this.
314-
guard #available(SwiftStdlib 5.1, *) else { return }
314+
guard #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) //SwiftStdlib 5.1
315+
else { return }
315316
_internalInvariant(condition(), message, file: file, line: line)
316317
#endif
317318
}

‎stdlib/public/core/FloatingPoint.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,8 @@ extension BinaryFloatingPoint {
18951895
switch (Source.exponentBitCount, Source.significandBitCount) {
18961896
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
18971897
case (5, 10):
1898-
guard #available(SwiftStdlib 5.3, *) else {
1898+
guard #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *) //SwiftStdlib 5.3
1899+
else {
18991900
// Convert signaling NaN to quiet NaN by multiplying by 1.
19001901
self = Self._convert(from: value).value * 1
19011902
break

‎stdlib/public/core/FloatingPointParsing.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ extension ${Self}: LosslessStringConvertible {
165165
%if bits == 16:
166166
self.init(Substring(text))
167167
%else:
168-
if #available(SwiftStdlib 5.3, *) {
168+
if #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *) { //SwiftStdlib 5.3
169169
self.init(Substring(text))
170170
} else {
171171
self = 0.0

‎stdlib/public/core/TemporaryAllocation.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ internal func _isStackAllocationSafe(byteCount: Int, alignment: Int) -> Bool {
8989

9090
// Finally, take a slow path through the standard library to see if the
9191
// current environment can accept a larger stack allocation.
92-
guard #available(SwiftStdlib 5.6, *) else {
92+
guard #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) //SwiftStdlib 5.6
93+
else {
9394
return false
9495
}
9596
return swift_stdlib_isStackAllocationSafe(byteCount, alignment)

0 commit comments

Comments
 (0)