aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r--crates/ra_hir/src/ty/tests.rs58
1 files changed, 58 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 2c7d94bce..c60e72abf 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -2838,6 +2838,64 @@ fn main() {
2838 ); 2838 );
2839} 2839}
2840 2840
2841#[test]
2842fn infer_path_quantified_macros_expanded() {
2843 assert_snapshot!(
2844 infer(r#"
2845#[macro_export]
2846macro_rules! foo {
2847 () => { 42i32 }
2848}
2849
2850mod m {
2851 pub use super::foo as bar;
2852}
2853
2854fn main() {
2855 let x = crate::foo!();
2856 let y = m::bar!();
2857}
2858"#),
2859 @r###"
2860 ![0; 5) '42i32': i32
2861 ![0; 5) '42i32': i32
2862 [111; 164) '{ ...!(); }': ()
2863 [121; 122) 'x': i32
2864 [148; 149) 'y': i32
2865 "###
2866 );
2867}
2868
2869#[test]
2870fn infer_type_value_macro_having_same_name() {
2871 assert_snapshot!(
2872 infer(r#"
2873#[macro_export]
2874macro_rules! foo {
2875 () => {
2876 mod foo {
2877 pub use super::foo;
2878 }
2879 };
2880 ($x:tt) => {
2881 $x
2882 };
2883}
2884
2885foo!();
2886
2887fn foo() {
2888 let foo = foo::foo!(42i32);
2889}
2890"#),
2891 @r###"
2892 ![0; 5) '42i32': i32
2893 [171; 206) '{ ...32); }': ()
2894 [181; 184) 'foo': i32
2895 "###
2896 );
2897}
2898
2841#[ignore] 2899#[ignore]
2842#[test] 2900#[test]
2843fn method_resolution_trait_before_autoref() { 2901fn method_resolution_trait_before_autoref() {