mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Protect the operator/precedencegroup lookup code against modules that
import themselves. It's not clear to me whether this situation is really intended, but this does fix build modules with this strange situation.
This commit is contained in:
@@ -1008,8 +1008,13 @@ lookupOperatorDeclForName(const FileUnit &File, SourceLoc Loc, Identifier Name,
|
||||
// Record whether they come from re-exported modules.
|
||||
// FIXME: We ought to prefer operators elsewhere in this module before we
|
||||
// check imports.
|
||||
auto ownModule = SF.getParentModule();
|
||||
ImportedOperatorsMap<OP_DECL> importedOperators;
|
||||
for (auto &imported : SourceFile::Impl::getImportsForSourceFile(SF)) {
|
||||
// Protect against source files that contrive to import their own modules.
|
||||
if (imported.first.second == ownModule)
|
||||
continue;
|
||||
|
||||
bool isExported =
|
||||
imported.second.contains(SourceFile::ImportFlags::Exported);
|
||||
if (!includePrivate && !isExported)
|
||||
|
||||
Reference in New Issue
Block a user