From 5270bca5f72fa65f0515be776e06d3d6a4d1efca Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 26 Mar 2019 13:09:39 +0300 Subject: store macro def inside macro id This solves the problem of "macro expansion can't call into name resolution, because name resolution calls back into macro expansion" Because we store macro def as a part of call id, macro expansion just knows the def! --- crates/ra_hir/src/nameres/tests/incremental.rs | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'crates/ra_hir/src/nameres/tests/incremental.rs') diff --git a/crates/ra_hir/src/nameres/tests/incremental.rs b/crates/ra_hir/src/nameres/tests/incremental.rs index 698781923..a059634e2 100644 --- a/crates/ra_hir/src/nameres/tests/incremental.rs +++ b/crates/ra_hir/src/nameres/tests/incremental.rs @@ -90,34 +90,27 @@ fn adding_inner_items_should_not_invalidate_def_map() { ); } -// It would be awesome to make this work, but it's unclear how #[test] -#[ignore] -fn typing_inside_a_function_inside_a_macro_should_not_invalidate_def_map() { +fn typing_inside_a_macro_should_not_invalidate_def_map() { check_def_map_is_not_recomputed( " //- /lib.rs + macro_rules! m { + ($ident:ident) => { + struct Foo; + } + } mod foo; - use crate::foo::bar::Baz; - //- /foo/mod.rs pub mod bar; //- /foo/bar.rs <|> - salsa::query_group! { - trait Baz { - fn foo() -> i32 { 1 + 1 } - } - } + m!(X); ", " - salsa::query_group! { - trait Baz { - fn foo() -> i32 { 92 } - } - } + m!(Y); ", ); } -- cgit v1.2.3