@@ -348,8 +348,7 @@ static const AvailableAttr *getActiveAvailableAttribute(const Decl *D,
348
348
349
349
// / Returns true if there is any availability attribute on the declaration
350
350
// / 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) {
353
352
return getActiveAvailableAttribute (D, AC);
354
353
}
355
354
@@ -718,9 +717,13 @@ class TypeRefinementContextBuilder : private ASTWalker {
718
717
return nullptr ;
719
718
}
720
719
721
- const AvailabilityContext getEffectiveAvailabilityForDeclSignature (Decl *D) {
720
+ const AvailabilityContext
721
+ getEffectiveAvailabilityForDeclSignature (const Decl *D) {
722
722
auto EffectiveIntroduction = AvailabilityRange::alwaysAvailable ();
723
723
724
+ // Availability attributes are found abstract syntax decls.
725
+ D = abstractSyntaxDeclForAvailableAttribute (D);
726
+
724
727
// As a special case, extension decls are treated as effectively as
725
728
// available as the nominal type they extend, up to the deployment target.
726
729
// This rule is a convenience for library authors who have written
@@ -754,7 +757,7 @@ class TypeRefinementContextBuilder : private ASTWalker {
754
757
// / are not constrained since they appear in the interface of the module and
755
758
// / may be consumed by clients with lower deployment targets, but there are
756
759
// / some exceptions.
757
- bool shouldConstrainSignatureToDeploymentTarget (Decl *D) {
760
+ bool shouldConstrainSignatureToDeploymentTarget (const Decl *D) {
758
761
if (isCurrentTRCContainedByDeploymentTarget ())
759
762
return false ;
760
763
0 commit comments