Skip to content

Commit 5746322

Browse files
committed
Sema: Visit hoisted ExtensionDecls in extension binding
1 parent 5d602dc commit 5746322

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/Sema/TypeChecker.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,17 @@ void swift::bindExtensions(ModuleDecl &mod) {
215215
if (!SF)
216216
continue;
217217

218-
for (auto D : SF->getTopLevelDecls()) {
218+
auto visitTopLevelDecl = [&](Decl *D) {
219219
if (auto ED = dyn_cast<ExtensionDecl>(D))
220220
if (!tryBindExtension(ED))
221-
worklist.push_back(ED);
222-
}
221+
worklist.push_back(ED);;
222+
};
223+
224+
for (auto *D : SF->getTopLevelDecls())
225+
visitTopLevelDecl(D);
226+
227+
for (auto *D : SF->getHoistedDecls())
228+
visitTopLevelDecl(D);
223229
}
224230

225231
// Phase 2 - repeatedly go through the worklist and attempt to bind each

0 commit comments

Comments
 (0)