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

@ -246,6 +246,18 @@ impl SourceAnalyzer {
}
}
pub(crate) fn resolve_path_as_macro(
&self,
db: &dyn HirDatabase,
path: &ast::Path,
) -> Option<MacroDef> {
// This must be a normal source file rather than macro file.
let hygiene = Hygiene::new(db.upcast(), self.file_id);
let ctx = body::LowerCtx::with_hygiene(db.upcast(), &hygiene);
let hir_path = Path::from_src(path.clone(), &ctx)?;
resolve_hir_path_as_macro(db, &self.resolver, &hir_path)
}
pub(crate) fn resolve_path(
&self,
db: &dyn HirDatabase,