mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Implement proper shadowing rules for qualified lookup.
This required a general reworking of the algorithm for qualified name lookup. Originally, qualified lookup only applied to a module -- not to its exports. This meant that "Cocoa.NSWindow" would fail, so that was changed to grovel through all exported modules looking for decls if the top-level module didn't provide any. Now, we actually do a breadth-based search, stopping at each level if decls are provided for a given name. We also now prefer scoped imports to unscoped imports, so "import abcde" and "import struct asdf.D" will result in a (qualified) reference to 'D' being unambiguous. Not working yet: - Shadowing for unqualified lookup. - Shadowing by types, so that overloads from this module can merge with overloads from its exports. Swift SVN r7014
This commit is contained in:
@@ -215,6 +215,12 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
/// Returns true if the two access paths contain the same chain of
|
||||
/// identifiers.
|
||||
///
|
||||
/// Source locations are ignored here.
|
||||
static bool isSameAccessPath(AccessPathTy lhs, AccessPathTy rhs);
|
||||
|
||||
static bool classof(const DeclContext *DC) {
|
||||
return DC->isModuleContext();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user