Skip to content

Commit 950c5bb

Browse files
authored
Merge pull request #64915 from DougGregor/visit-aux-decls-of-class-members-twice
2 parents 0acd38d + b842d01 commit 950c5bb

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,9 +1821,13 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
18211821

18221822
void visit(Decl *decl) {
18231823
// Visit auxiliary decls first.
1824-
decl->visitAuxiliaryDecls([&](Decl *auxiliaryDecl) {
1825-
this->visit(auxiliaryDecl);
1826-
});
1824+
// We don't do this for members of classes because it happens as part of
1825+
// visiting their ABI members.
1826+
if (!isa<ClassDecl>(decl->getDeclContext())) {
1827+
decl->visitAuxiliaryDecls([&](Decl *auxiliaryDecl) {
1828+
this->visit(auxiliaryDecl);
1829+
});
1830+
}
18271831

18281832
if (auto *Stats = getASTContext().Stats)
18291833
++Stats->getFrontendCounters().NumDeclsTypechecked;

test/Macros/macro_expand_peers.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ func useCompletionHandlerG(s: S, _ body: @escaping (String) -> Void) {
6969
}
7070
}
7171

72+
class C {
73+
@addCompletionHandler
74+
func f(a: Int, for b: String, _ value: Double) async -> String {
75+
return b
76+
}
77+
}
78+
79+
7280
@addCompletionHandler
7381
func f(a: Int, for b: String, _ value: Double) async -> String {
7482
return b

0 commit comments

Comments
 (0)