File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 1+
2+ public struct Task {
3+ public var someProperty : String = " 123 "
4+ public init ( ) { }
5+ }
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+ // RUN: %target-swift-frontend -emit-module -emit-module-path %t/ShadowsConcur.swiftmodule -module-name ShadowsConcur %S/Inputs/ShadowsConcur.swift
3+ // RUN: %target-typecheck-verify-swift -I %t -enable-experimental-concurrency
4+ // REQUIRES: concurrency
5+
6+
7+ import ShadowsConcur
8+
9+ func f( _ t : Task ) -> Bool {
10+ return t. someProperty == " 123 "
11+ }
12+
13+ func g( _: _Concurrency . Task ) { }
You can’t perform that action at this time.
0 commit comments