diff options
author | Edwin Cheng <[email protected]> | 2019-12-03 11:33:48 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-12-06 15:48:45 +0000 |
commit | 76ff5b7c15b2c4e85895a49e5859e546d1d6227e (patch) | |
tree | c7787cb5e4f1eae6c2946d880c9cdc6337535317 /crates/ra_hir_ty/src/tests | |
parent | a25e8cff6755c1a0c46ee3690dcd75b641c0b3e4 (diff) |
Add tests
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#" |