File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 2020#include " swift/Strings.h"
2121#include " swift/AST/ASTWalker.h"
2222#include " swift/AST/GenericEnvironment.h"
23+ #include " swift/AST/ImportCache.h"
2324#include " swift/AST/Initializer.h"
2425#include " swift/AST/ParameterList.h"
2526#include " swift/AST/ProtocolConformance.h"
@@ -686,11 +687,23 @@ static Optional<AttributedImport<ImportedModule>> findImportFor(
686687 if (!fromSourceFile)
687688 return None;
688689
690+ // Look to see if the owning module was directly imported.
689691 for (const auto &import : fromSourceFile->getImports ()) {
690692 if (import .module .importedModule == nominalModule)
691693 return import ;
692694 }
693695
696+ // Now look for transitive imports.
697+ auto &importCache = nominal->getASTContext ().getImportCache ();
698+ for (const auto &import : fromSourceFile->getImports ()) {
699+ auto &importSet = importCache.getImportSet (import .module .importedModule );
700+ for (const auto &transitive : importSet.getTransitiveImports ()) {
701+ if (transitive.importedModule == nominalModule) {
702+ return import ;
703+ }
704+ }
705+ }
706+
694707 return None;
695708}
696709
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+
3+ // FIXME: BEGIN -enable-source-import hackaround
4+ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -I %S/Inputs/custom-modules %s -verify -swift-version 6
5+
6+ // REQUIRES: objc_interop
7+ // REQUIRES: concurrency
8+ // REQUIRES: asserts
9+
10+ @_predatesConcurrency import Foundation
11+
12+ func acceptSendable< T: Sendable > ( _: T ) { }
13+
14+ func useSendable( ns: NSString ) {
15+ // Note: warning below is downgraded due to @_predatesConcurrency
16+ acceptSendable ( ns) // expected-warning{{type 'NSString' does not conform to the 'Sendable' protocol}}
17+ }
You can’t perform that action at this time.
0 commit comments