diff options
author | Jonas Schievink <[email protected]> | 2020-09-12 20:15:00 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-09-12 20:15:00 +0100 |
commit | 2de6eb7bc852d096d2f09b7efe2469317bd86c9c (patch) | |
tree | 9b3adb3428309fa2ae32efd1dc5f9af3c8c46c8f /crates/hir_ty | |
parent | c8623461a57e7882ac47b5da13a1a03efa58f603 (diff) |
Add box pattern test
Diffstat (limited to 'crates/hir_ty')
-rw-r--r-- | crates/hir_ty/src/tests/patterns.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/patterns.rs b/crates/hir_ty/src/tests/patterns.rs index aeb191c79..6a965ac4f 100644 --- a/crates/hir_ty/src/tests/patterns.rs +++ b/crates/hir_ty/src/tests/patterns.rs | |||
@@ -654,3 +654,28 @@ fn slice_tail_pattern() { | |||
654 | "#]], | 654 | "#]], |
655 | ); | 655 | ); |
656 | } | 656 | } |
657 | |||
658 | #[test] | ||
659 | fn box_pattern() { | ||
660 | check_infer( | ||
661 | r#" | ||
662 | #[lang = "owned_box"] | ||
663 | pub struct Box<T>(T); | ||
664 | |||
665 | fn foo(params: Box<i32>) { | ||
666 | match params { | ||
667 | box integer => {} | ||
668 | } | ||
669 | } | ||
670 | "#, | ||
671 | expect![[r#" | ||
672 | 52..58 'params': Box<i32> | ||
673 | 70..124 '{ ... } }': () | ||
674 | 76..122 'match ... }': () | ||
675 | 82..88 'params': Box<i32> | ||
676 | 99..110 'box integer': Box<i32> | ||
677 | 103..110 'integer': i32 | ||
678 | 114..116 '{}': () | ||
679 | "#]], | ||
680 | ); | ||
681 | } | ||