@@ -205,23 +205,26 @@ getAvailabilityConstraintForAttr(const Decl *decl,
205
205
auto &ctx = decl->getASTContext ();
206
206
auto domain = attr.getDomain ();
207
207
auto deploymentRange = domain.getDeploymentRange (ctx);
208
- bool domainSupportsRefinement = domain.supportsContextRefinement ();
209
- std::optional<AvailabilityRange> availableRange =
210
- domainSupportsRefinement ? context.getAvailabilityRange (domain, ctx)
211
- : deploymentRange;
212
208
213
- // Is the decl obsoleted in this context?
209
+ // Is the decl obsoleted in the deployment context?
214
210
if (auto obsoletedRange = attr.getObsoletedRange (ctx)) {
215
- if (availableRange && availableRange ->isContainedIn (*obsoletedRange))
211
+ if (deploymentRange && deploymentRange ->isContainedIn (*obsoletedRange))
216
212
return AvailabilityConstraint::unavailableObsolete (attr);
217
213
}
218
214
219
- // Is the decl not yet introduced in this context?
215
+ // Is the decl not yet introduced in the local context?
220
216
if (auto introducedRange = attr.getIntroducedRange (ctx)) {
221
- if (!availableRange || !availableRange->isContainedIn (*introducedRange))
222
- return domainSupportsRefinement
223
- ? AvailabilityConstraint::unintroduced (attr)
224
- : AvailabilityConstraint::unavailableUnintroduced (attr);
217
+ if (domain.supportsContextRefinement ()) {
218
+ auto availableRange = context.getAvailabilityRange (domain, ctx);
219
+ if (!availableRange || !availableRange->isContainedIn (*introducedRange))
220
+ return AvailabilityConstraint::unintroduced (attr);
221
+
222
+ return std::nullopt;
223
+ }
224
+
225
+ // Is the decl not yet introduced in the deployment context?
226
+ if (deploymentRange && !deploymentRange->isContainedIn (*introducedRange))
227
+ return AvailabilityConstraint::unavailableUnintroduced (attr);
225
228
}
226
229
227
230
return std::nullopt;
0 commit comments