aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty
diff options
context:
space:
mode:
authoruHOOCCOOHu <[email protected]>2019-09-06 19:44:26 +0100
committeruHOOCCOOHu <[email protected]>2019-09-08 18:34:53 +0100
commit26b092bd3b431559d7aafbf42882f978c0bb3dab (patch)
tree194c41ab1320730d7f08823127404056e235cf2e /crates/ra_hir/src/ty
parente0f305a6bf710f64f789f909da93a8c362823b67 (diff)
Resolve textual scoped macros inside item
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r--crates/ra_hir/src/ty/tests.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index c4bddde85..f2d5b115e 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -2803,6 +2803,41 @@ fn main() {
2803 ); 2803 );
2804} 2804}
2805 2805
2806#[test]
2807fn infer_textual_scoped_macros_expanded() {
2808 assert_snapshot!(
2809 infer(r#"
2810struct Foo(Vec<i32>);
2811
2812#[macro_use]
2813mod m {
2814 macro_rules! foo {
2815 ($($item:expr),*) => {
2816 {
2817 Foo(vec![$($item,)*])
2818 }
2819 };
2820 }
2821}
2822
2823fn main() {
2824 let x = foo!(1,2);
2825 let y = crate::foo!(1,2);
2826}
2827"#),
2828 @r###"
2829 ![0; 17) '{Foo(v...,2,])}': Foo
2830 ![1; 4) 'Foo': Foo({unknown}) -> Foo
2831 ![1; 16) 'Foo(vec![1,2,])': Foo
2832 ![5; 15) 'vec![1,2,]': {unknown}
2833 [195; 251) '{ ...,2); }': ()
2834 [205; 206) 'x': Foo
2835 [228; 229) 'y': {unknown}
2836 [232; 248) 'crate:...!(1,2)': {unknown}
2837 "###
2838 );
2839}
2840
2806#[ignore] 2841#[ignore]
2807#[test] 2842#[test]
2808fn method_resolution_trait_before_autoref() { 2843fn method_resolution_trait_before_autoref() {