@@ -348,8 +348,7 @@ static const AvailableAttr *getActiveAvailableAttribute(const Decl *D,
348348
349349// / Returns true if there is any availability attribute on the declaration
350350// / that is active on the target platform.
351- static bool hasActiveAvailableAttribute (Decl *D,
352- ASTContext &AC) {
351+ static bool hasActiveAvailableAttribute (const Decl *D, ASTContext &AC) {
353352 return getActiveAvailableAttribute (D, AC);
354353}
355354
@@ -718,9 +717,13 @@ class TypeRefinementContextBuilder : private ASTWalker {
718717 return nullptr ;
719718 }
720719
721- const AvailabilityContext getEffectiveAvailabilityForDeclSignature (Decl *D) {
720+ const AvailabilityContext
721+ getEffectiveAvailabilityForDeclSignature (const Decl *D) {
722722 auto EffectiveIntroduction = AvailabilityRange::alwaysAvailable ();
723723
724+ // Availability attributes are found abstract syntax decls.
725+ D = abstractSyntaxDeclForAvailableAttribute (D);
726+
724727 // As a special case, extension decls are treated as effectively as
725728 // available as the nominal type they extend, up to the deployment target.
726729 // This rule is a convenience for library authors who have written
@@ -754,7 +757,7 @@ class TypeRefinementContextBuilder : private ASTWalker {
754757 // / are not constrained since they appear in the interface of the module and
755758 // / may be consumed by clients with lower deployment targets, but there are
756759 // / some exceptions.
757- bool shouldConstrainSignatureToDeploymentTarget (Decl *D) {
760+ bool shouldConstrainSignatureToDeploymentTarget (const Decl *D) {
758761 if (isCurrentTRCContainedByDeploymentTarget ())
759762 return false ;
760763
0 commit comments