diff options
Diffstat (limited to 'crates/ra_hir_ty/src/tests')
-rw-r--r-- | crates/ra_hir_ty/src/tests/macros.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs index 9c29a054e..812f171db 100644 --- a/crates/ra_hir_ty/src/tests/macros.rs +++ b/crates/ra_hir_ty/src/tests/macros.rs | |||
@@ -211,6 +211,35 @@ pub fn baz() -> usize { 31usize } | |||
211 | } | 211 | } |
212 | 212 | ||
213 | #[test] | 213 | #[test] |
214 | fn infer_type_value_non_legacy_macro_use_as() { | ||
215 | assert_snapshot!( | ||
216 | infer(r#" | ||
217 | mod m { | ||
218 | macro_rules! _foo { | ||
219 | ($x:ident) => { type $x = u64; } | ||
220 | } | ||
221 | pub(crate) use _foo as foo; | ||
222 | } | ||
223 | |||
224 | m::foo!(foo); | ||
225 | use foo as bar; | ||
226 | fn f() -> bar { 0 } | ||
227 | fn main() { | ||
228 | let _a = f(); | ||
229 | } | ||
230 | "#), | ||
231 | @r###" | ||
232 | [159; 164) '{ 0 }': u64 | ||
233 | [161; 162) '0': u64 | ||
234 | [175; 199) '{ ...f(); }': () | ||
235 | [187; 189) '_a': u64 | ||
236 | [193; 194) 'f': fn f() -> u64 | ||
237 | [193; 196) 'f()': u64 | ||
238 | "### | ||
239 | ); | ||
240 | } | ||
241 | |||
242 | #[test] | ||
214 | fn infer_builtin_macros_line() { | 243 | fn infer_builtin_macros_line() { |
215 | assert_snapshot!( | 244 | assert_snapshot!( |
216 | infer(r#" | 245 | infer(r#" |