diff options
author | Aleksey Kladov <[email protected]> | 2019-03-26 10:09:39 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-03-26 10:20:54 +0000 |
commit | 5270bca5f72fa65f0515be776e06d3d6a4d1efca (patch) | |
tree | fa1b8b8ac66713ba29b676e1c2fdd4c4357f24ff /crates/ra_hir/src/nameres/tests | |
parent | dc94f3612583c5e960b334761ad0c18d328840ea (diff) |
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!
Diffstat (limited to 'crates/ra_hir/src/nameres/tests')
-rw-r--r-- | crates/ra_hir/src/nameres/tests/incremental.rs | 23 |
1 files changed, 8 insertions, 15 deletions
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() { | |||
90 | ); | 90 | ); |
91 | } | 91 | } |
92 | 92 | ||
93 | // It would be awesome to make this work, but it's unclear how | ||
94 | #[test] | 93 | #[test] |
95 | #[ignore] | 94 | fn typing_inside_a_macro_should_not_invalidate_def_map() { |
96 | fn typing_inside_a_function_inside_a_macro_should_not_invalidate_def_map() { | ||
97 | check_def_map_is_not_recomputed( | 95 | check_def_map_is_not_recomputed( |
98 | " | 96 | " |
99 | //- /lib.rs | 97 | //- /lib.rs |
98 | macro_rules! m { | ||
99 | ($ident:ident) => { | ||
100 | struct Foo; | ||
101 | } | ||
102 | } | ||
100 | mod foo; | 103 | mod foo; |
101 | 104 | ||
102 | use crate::foo::bar::Baz; | ||
103 | |||
104 | //- /foo/mod.rs | 105 | //- /foo/mod.rs |
105 | pub mod bar; | 106 | pub mod bar; |
106 | 107 | ||
107 | //- /foo/bar.rs | 108 | //- /foo/bar.rs |
108 | <|> | 109 | <|> |
109 | salsa::query_group! { | 110 | m!(X); |
110 | trait Baz { | ||
111 | fn foo() -> i32 { 1 + 1 } | ||
112 | } | ||
113 | } | ||
114 | ", | 111 | ", |
115 | " | 112 | " |
116 | salsa::query_group! { | 113 | m!(Y); |
117 | trait Baz { | ||
118 | fn foo() -> i32 { 92 } | ||
119 | } | ||
120 | } | ||
121 | ", | 114 | ", |
122 | ); | 115 | ); |
123 | } | 116 | } |