aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2021-01-04 02:53:31 +0000
committerEdwin Cheng <[email protected]>2021-01-07 05:08:32 +0000
commit76f2b9d2ef797fb995f1bd2706a7e609d014a67a (patch)
treef8f81c7afd64167746a40a576e63fcd234c14b5b /crates/hir_ty/src
parentb47c63a4bcefe93be3e5fe97b2a57489f13da493 (diff)
Proper handling $crate Take 2
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r--crates/hir_ty/src/tests/macros.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/macros.rs b/crates/hir_ty/src/tests/macros.rs
index 1953da7be..c64f0b5b5 100644
--- a/crates/hir_ty/src/tests/macros.rs
+++ b/crates/hir_ty/src/tests/macros.rs
@@ -371,6 +371,37 @@ expand!();
371} 371}
372 372
373#[test] 373#[test]
374fn infer_macro_with_dollar_crate_in_def_site() {
375 check_types(
376 r#"
377//- /main.rs crate:main deps:foo
378use foo::expand;
379
380macro_rules! list {
381 ($($tt:tt)*) => { $($tt)* }
382}
383
384fn test() {
385 let r = expand!();
386 r;
387 //^ u128
388}
389
390//- /lib.rs crate:foo
391#[macro_export]
392macro_rules! expand {
393 () => { list!($crate::m!()) };
394}
395
396#[macro_export]
397macro_rules! m {
398 () => { 0u128 };
399}
400"#,
401 );
402}
403
404#[test]
374fn infer_type_value_non_legacy_macro_use_as() { 405fn infer_type_value_non_legacy_macro_use_as() {
375 check_infer( 406 check_infer(
376 r#" 407 r#"