@@ -5122,6 +5122,13 @@ void AttributeChecker::checkBackDeployedAttrs(
5122
5122
ActiveAttr = AttrAndRange->first ;
5123
5123
5124
5124
for (auto *Attr : Attrs) {
5125
+ auto Domain = Attr->getAvailabilityDomain ();
5126
+ if (!Domain.isVersionValid (Attr->getParsedVersion ())) {
5127
+ diagnose (Attr->getLocation (),
5128
+ diag::availability_invalid_version_number_for_domain,
5129
+ Attr->getParsedVersion (), Domain);
5130
+ }
5131
+
5125
5132
// Back deployment only makes sense for public declarations.
5126
5133
if (diagnoseAndRemoveAttrIfDeclIsNonPublic (Attr, /* isError=*/ true ))
5127
5134
continue ;
@@ -5169,7 +5176,7 @@ void AttributeChecker::checkBackDeployedAttrs(
5169
5176
}
5170
5177
5171
5178
auto AtLoc = Attr->AtLoc ;
5172
- auto Platform = Attr->Platform ;
5179
+ auto Platform = Attr->getPlatform () ;
5173
5180
5174
5181
if (!seenPlatforms.insert ({Platform, AtLoc}).second ) {
5175
5182
// We've seen the platform before, emit error to the previous one which
@@ -5210,9 +5217,8 @@ void AttributeChecker::checkBackDeployedAttrs(
5210
5217
D->getLoc (), D->getInnermostDeclContext ());
5211
5218
5212
5219
// Unavailable decls cannot be back deployed.
5213
- auto backDeployedDomain = Attr->getAvailabilityDomain ();
5214
- if (availability.containsUnavailableDomain (backDeployedDomain)) {
5215
- auto domainForDiagnostics = backDeployedDomain;
5220
+ if (availability.containsUnavailableDomain (Domain)) {
5221
+ auto domainForDiagnostics = Domain;
5216
5222
llvm::VersionTuple ignoredVersion;
5217
5223
5218
5224
AvailabilityInference::updateBeforeAvailabilityDomainForFallback (
@@ -5244,7 +5250,7 @@ void AttributeChecker::checkBackDeployedAttrs(
5244
5250
if (auto availableRangeAttrPair =
5245
5251
getSemanticAvailableRangeDeclAndAttr (VD)) {
5246
5252
auto beforeDomain = Attr->getAvailabilityDomain ();
5247
- auto beforeVersion = Attr->Version ;
5253
+ auto beforeVersion = Attr->getVersion () ;
5248
5254
auto availableAttr = availableRangeAttrPair.value ().first ;
5249
5255
auto introVersion = availableAttr.getIntroduced ().value ();
5250
5256
AvailabilityDomain introDomain = availableAttr.getDomain ();
@@ -5254,7 +5260,7 @@ void AttributeChecker::checkBackDeployedAttrs(
5254
5260
AvailabilityInference::updateIntroducedAvailabilityDomainForFallback (
5255
5261
availableAttr, Ctx, introDomain, introVersion);
5256
5262
5257
- if (Attr-> Version <= introVersion) {
5263
+ if (beforeVersion <= introVersion) {
5258
5264
diagnose (AtLoc, diag::attr_has_no_effect_decl_not_available_before,
5259
5265
Attr, VD, beforeDomain, AvailabilityRange (beforeVersion));
5260
5266
diagnose (availableAttr.getParsedAttr ()->AtLoc ,
0 commit comments