Fix proc-macro attributes being shadowed by their functions in IDE layer

This commit is contained in:
Lukas Wirth 2021-11-08 14:31:46 +01:00
parent c5c11b87cc
commit 26419c0379
4 changed files with 36 additions and 14 deletions

View file

@ -329,6 +329,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
self.imp.resolve_path(path)
}
pub fn resolve_path_as_macro(&self, path: &ast::Path) -> Option<MacroDef> {
self.imp.resolve_path_as_macro(path)
}
pub fn resolve_extern_crate(&self, extern_crate: &ast::ExternCrate) -> Option<Crate> {
self.imp.resolve_extern_crate(extern_crate)
}
@ -845,6 +849,12 @@ impl<'db> SemanticsImpl<'db> {
self.analyze(path.syntax()).resolve_path(self.db, path)
}
// FIXME: This shouldn't exist, but is currently required to always resolve attribute paths in
// the IDE layer due to namespace collisions
fn resolve_path_as_macro(&self, path: &ast::Path) -> Option<MacroDef> {
self.analyze(path.syntax()).resolve_path_as_macro(self.db, path)
}
fn resolve_extern_crate(&self, extern_crate: &ast::ExternCrate) -> Option<Crate> {
let krate = self.scope(extern_crate.syntax()).krate()?;
krate.dependencies(self.db).into_iter().find_map(|dep| {