Skip to content

Commit db394c5

Browse files
committed
Sema: Don't emit 'add @available attribute' fixit on implicit declarations
1 parent 972cd5c commit db394c5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,8 @@ static const Decl *ancestorMemberLevelDeclForAvailabilityFixit(const Decl *D) {
12371237
while (D) {
12381238
D = relatedDeclForAvailabilityFixit(D);
12391239

1240-
if (D->getDeclContext()->isTypeContext() &&
1240+
if (!D->isImplicit() &&
1241+
D->getDeclContext()->isTypeContext() &&
12411242
DeclAttribute::canAttributeAppearOnDecl(DeclAttrKind::DAK_Available,
12421243
D)) {
12431244
break;

test/Sema/conformance_availability.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ struct AssocConformanceDeprecated : Rider {
236236
struct AssocConformanceAvailable1 : Rider {
237237
// expected-error@-1 {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
238238
// expected-note@-2 {{in associated type 'Self.H' (inferred as 'HasAvailableConformance1')}}
239-
// FIXME expected-note@-3 {{add @available attribute to enclosing initializer}}
240-
// expected-note@-4 {{add @available attribute to enclosing struct}}
239+
// expected-note@-3 {{add @available attribute to enclosing struct}}
241240
typealias H = HasAvailableConformance1
242241
}
243242

0 commit comments

Comments
 (0)