Skip to content

Commit 6eb6921

Browse files
committed
Update availability diagnostic for macOS major version number changes
Resolves: SR-15093
1 parent 5b8714e commit 6eb6921

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,19 +1539,20 @@ static bool fixAvailabilityByNarrowingNearbyVersionCheck(
15391539
TRC && TRC->getReason() != TypeRefinementContext::Reason::Root) {
15401540

15411541
// Only fix situations that are "nearby" versions, meaning
1542-
// disagreement on a minor-or-less version for non-macOS,
1543-
// or disagreement on a subminor-or-less version for macOS.
1542+
// disagreement on a subminor-or-less version for macOS 10,
1543+
// or disagreement on a minor-or-less version otherwise.
15441544
auto RunningVers = RunningRange.getLowerEndpoint();
15451545
auto RequiredVers = RequiredRange.getLowerEndpoint();
15461546
auto Platform = targetPlatform(Context.LangOpts);
15471547
if (RunningVers.getMajor() != RequiredVers.getMajor())
15481548
return false;
15491549
if ((Platform == PlatformKind::macOS ||
15501550
Platform == PlatformKind::macOSApplicationExtension) &&
1551+
RunningVers.getMajor() == 10 &&
15511552
!(RunningVers.getMinor().hasValue() &&
15521553
RequiredVers.getMinor().hasValue() &&
15531554
RunningVers.getMinor().getValue() ==
1554-
RequiredVers.getMinor().getValue()))
1555+
RequiredVers.getMinor().getValue()))
15551556
return false;
15561557

15571558
auto FixRange = TRC->getAvailabilityConditionVersionSourceRange(

0 commit comments

Comments
 (0)