@@ -205,23 +205,26 @@ getAvailabilityConstraintForAttr(const Decl *decl,
205205 auto &ctx = decl->getASTContext ();
206206 auto domain = attr.getDomain ();
207207 auto deploymentRange = domain.getDeploymentRange (ctx);
208- bool domainSupportsRefinement = domain.supportsContextRefinement ();
209- std::optional<AvailabilityRange> availableRange =
210- domainSupportsRefinement ? context.getAvailabilityRange (domain, ctx)
211- : deploymentRange;
212208
213- // Is the decl obsoleted in this context?
209+ // Is the decl obsoleted in the deployment context?
214210 if (auto obsoletedRange = attr.getObsoletedRange (ctx)) {
215- if (availableRange && availableRange ->isContainedIn (*obsoletedRange))
211+ if (deploymentRange && deploymentRange ->isContainedIn (*obsoletedRange))
216212 return AvailabilityConstraint::unavailableObsolete (attr);
217213 }
218214
219- // Is the decl not yet introduced in this context?
215+ // Is the decl not yet introduced in the local context?
220216 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);
225228 }
226229
227230 return std::nullopt ;
0 commit comments