diff options
Diffstat (limited to 'crates/hir_ty/src/tests')
-rw-r--r-- | crates/hir_ty/src/tests/macros.rs | 23 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/patterns.rs | 22 |
2 files changed, 45 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/macros.rs b/crates/hir_ty/src/tests/macros.rs index c1e605740..12951fb16 100644 --- a/crates/hir_ty/src/tests/macros.rs +++ b/crates/hir_ty/src/tests/macros.rs | |||
@@ -607,6 +607,29 @@ fn bar() -> u32 {0} | |||
607 | } | 607 | } |
608 | 608 | ||
609 | #[test] | 609 | #[test] |
610 | fn infer_builtin_macros_include_child_mod() { | ||
611 | check_types( | ||
612 | r#" | ||
613 | //- /main.rs | ||
614 | #[rustc_builtin_macro] | ||
615 | macro_rules! include {() => {}} | ||
616 | |||
617 | include!("f/foo.rs"); | ||
618 | |||
619 | fn main() { | ||
620 | bar::bar(); | ||
621 | } //^ u32 | ||
622 | |||
623 | //- /f/foo.rs | ||
624 | pub mod bar; | ||
625 | |||
626 | //- /f/bar.rs | ||
627 | pub fn bar() -> u32 {0} | ||
628 | "#, | ||
629 | ); | ||
630 | } | ||
631 | |||
632 | #[test] | ||
610 | fn infer_builtin_macros_include_str() { | 633 | fn infer_builtin_macros_include_str() { |
611 | check_types( | 634 | check_types( |
612 | r#" | 635 | r#" |
diff --git a/crates/hir_ty/src/tests/patterns.rs b/crates/hir_ty/src/tests/patterns.rs index 5da19ba5f..85a28e76b 100644 --- a/crates/hir_ty/src/tests/patterns.rs +++ b/crates/hir_ty/src/tests/patterns.rs | |||
@@ -658,6 +658,28 @@ fn slice_tail_pattern() { | |||
658 | fn box_pattern() { | 658 | fn box_pattern() { |
659 | check_infer( | 659 | check_infer( |
660 | r#" | 660 | r#" |
661 | pub struct Global; | ||
662 | #[lang = "owned_box"] | ||
663 | pub struct Box<T, A = Global>(T); | ||
664 | |||
665 | fn foo(params: Box<i32>) { | ||
666 | match params { | ||
667 | box integer => {} | ||
668 | } | ||
669 | } | ||
670 | "#, | ||
671 | expect![[r#" | ||
672 | 83..89 'params': Box<i32, Global> | ||
673 | 101..155 '{ ... } }': () | ||
674 | 107..153 'match ... }': () | ||
675 | 113..119 'params': Box<i32, Global> | ||
676 | 130..141 'box integer': Box<i32, Global> | ||
677 | 134..141 'integer': i32 | ||
678 | 145..147 '{}': () | ||
679 | "#]], | ||
680 | ); | ||
681 | check_infer( | ||
682 | r#" | ||
661 | #[lang = "owned_box"] | 683 | #[lang = "owned_box"] |
662 | pub struct Box<T>(T); | 684 | pub struct Box<T>(T); |
663 | 685 | ||