Skip to content

Commit 973af64

Browse files
committed
allow users to shadow declarations in the _Concurrency module
1 parent c2b13cd commit 973af64

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/AST/NameLookup.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,21 @@ static void recordShadowedDeclsAfterTypeMatch(
510510
}
511511
}
512512

513+
// Next, prefer any other module over the _Concurrency module.
514+
if (auto concurModule = ctx.getLoadedModule(ctx.Id_Concurrency)) {
515+
if ((firstModule == concurModule) != (secondModule == concurModule)) {
516+
// If second module is _Concurrency, then it is shadowed by first.
517+
if (secondModule == concurModule) {
518+
shadowed.insert(secondDecl);
519+
continue;
520+
}
521+
522+
// Otherwise, the first declaration is shadowed by the second.
523+
shadowed.insert(firstDecl);
524+
break;
525+
}
526+
}
527+
513528
// The Foundation overlay introduced Data.withUnsafeBytes, which is
514529
// treated as being ambiguous with SwiftNIO's Data.withUnsafeBytes
515530
// extension. Apply a special-case name shadowing rule to use the

0 commit comments

Comments
 (0)