Skip to content

Commit f605cac

Browse files
committed
Filled out platforms for Swift 5.4 availability.
Previously, the availability was "Future", meaning that any features that were gated to be available in "Swift 5.4" would only be used if the target were the highest possible version number (like iOS 99). Here that is fixed by using the OS versions that actually shipped with Swift 5.4. rdar://75978438
1 parent fae8f4a commit f605cac

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lib/AST/Availability.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,20 @@ AvailabilityContext ASTContext::getSwift53Availability() {
393393
}
394394

395395
AvailabilityContext ASTContext::getSwift54Availability() {
396-
return getSwiftFutureAvailability();
396+
auto target = LangOpts.Target;
397+
398+
if (target.isMacOSX()) {
399+
return AvailabilityContext(
400+
VersionRange::allGTE(llvm::VersionTuple(11, 3, 0)));
401+
} else if (target.isiOS()) {
402+
return AvailabilityContext(
403+
VersionRange::allGTE(llvm::VersionTuple(14, 5, 0)));
404+
} else if (target.isWatchOS()) {
405+
return AvailabilityContext(
406+
VersionRange::allGTE(llvm::VersionTuple(7, 4, 0)));
407+
} else {
408+
return AvailabilityContext::alwaysAvailable();
409+
}
397410
}
398411

399412
AvailabilityContext ASTContext::getSwiftFutureAvailability() {

0 commit comments

Comments
 (0)