diff options
author | Josh Mcguigan <[email protected]> | 2020-03-01 14:25:38 +0000 |
---|---|---|
committer | Josh Mcguigan <[email protected]> | 2020-03-01 14:25:38 +0000 |
commit | f353625705854877a8347c3a46f15e294a9338e4 (patch) | |
tree | 5a595ce0b149a0565ab562165dcd44a1642c0319 /crates/ra_hir_ty/src/tests | |
parent | 6db2da4993d3956fc7c8ebf152963a132611426a (diff) |
match single prefix slice
Diffstat (limited to 'crates/ra_hir_ty/src/tests')
-rw-r--r-- | crates/ra_hir_ty/src/tests/patterns.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/patterns.rs b/crates/ra_hir_ty/src/tests/patterns.rs index 81d00c2af..fdc9dd180 100644 --- a/crates/ra_hir_ty/src/tests/patterns.rs +++ b/crates/ra_hir_ty/src/tests/patterns.rs | |||
@@ -137,6 +137,39 @@ fn test() { | |||
137 | } | 137 | } |
138 | 138 | ||
139 | #[test] | 139 | #[test] |
140 | fn infer_pattern_match_slice() { | ||
141 | assert_snapshot!( | ||
142 | infer(r#" | ||
143 | fn test() { | ||
144 | let slice: &[f64] = &[0.0]; | ||
145 | match slice { | ||
146 | &[a] => { | ||
147 | a; | ||
148 | } | ||
149 | _ => {} | ||
150 | } | ||
151 | } | ||
152 | "#), | ||
153 | @r###" | ||
154 | [11; 129) '{ ... } }': () | ||
155 | [21; 26) 'slice': &[f64] | ||
156 | [37; 43) '&[0.0]': &[f64; _] | ||
157 | [38; 43) '[0.0]': [f64; _] | ||
158 | [39; 42) '0.0': f64 | ||
159 | [49; 127) 'match ... }': () | ||
160 | [55; 60) 'slice': &[f64] | ||
161 | [71; 75) '&[a]': &[f64] | ||
162 | [72; 75) '[a]': [f64] | ||
163 | [73; 74) 'a': f64 | ||
164 | [79; 105) '{ ... }': () | ||
165 | [93; 94) 'a': f64 | ||
166 | [114; 115) '_': &[f64] | ||
167 | [119; 121) '{}': () | ||
168 | "### | ||
169 | ); | ||
170 | } | ||
171 | |||
172 | #[test] | ||
140 | fn infer_adt_pattern() { | 173 | fn infer_adt_pattern() { |
141 | assert_snapshot!( | 174 | assert_snapshot!( |
142 | infer(r#" | 175 | infer(r#" |