aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests
diff options
context:
space:
mode:
authorJosh Mcguigan <[email protected]>2020-03-01 15:08:05 +0000
committerJosh Mcguigan <[email protected]>2020-03-01 15:35:15 +0000
commitd0e282f6b1a8c698212f7f76de2ff122e36e17a2 (patch)
tree8e7fc59e226b87b9fdec11a57f82f98992c9d396 /crates/ra_hir_ty/src/tests
parentf353625705854877a8347c3a46f15e294a9338e4 (diff)
handle arbitrary length slices
Diffstat (limited to 'crates/ra_hir_ty/src/tests')
-rw-r--r--crates/ra_hir_ty/src/tests/patterns.rs33
1 files changed, 24 insertions, 9 deletions
diff --git a/crates/ra_hir_ty/src/tests/patterns.rs b/crates/ra_hir_ty/src/tests/patterns.rs
index fdc9dd180..6a9413521 100644
--- a/crates/ra_hir_ty/src/tests/patterns.rs
+++ b/crates/ra_hir_ty/src/tests/patterns.rs
@@ -143,28 +143,43 @@ fn infer_pattern_match_slice() {
143fn test() { 143fn test() {
144 let slice: &[f64] = &[0.0]; 144 let slice: &[f64] = &[0.0];
145 match slice { 145 match slice {
146 &[] => {},
146 &[a] => { 147 &[a] => {
147 a; 148 a;
149 },
150 &[b, c] => {
151 b;
152 c;
148 } 153 }
149 _ => {} 154 _ => {}
150 } 155 }
151} 156}
152"#), 157"#),
153 @r###" 158 @r###"
154 [11; 129) '{ ... } }': () 159 [11; 210) '{ ... } }': ()
155 [21; 26) 'slice': &[f64] 160 [21; 26) 'slice': &[f64]
156 [37; 43) '&[0.0]': &[f64; _] 161 [37; 43) '&[0.0]': &[f64; _]
157 [38; 43) '[0.0]': [f64; _] 162 [38; 43) '[0.0]': [f64; _]
158 [39; 42) '0.0': f64 163 [39; 42) '0.0': f64
159 [49; 127) 'match ... }': () 164 [49; 208) 'match ... }': ()
160 [55; 60) 'slice': &[f64] 165 [55; 60) 'slice': &[f64]
161 [71; 75) '&[a]': &[f64] 166 [71; 74) '&[]': &[f64]
162 [72; 75) '[a]': [f64] 167 [72; 74) '[]': [f64]
163 [73; 74) 'a': f64 168 [78; 80) '{}': ()
164 [79; 105) '{ ... }': () 169 [90; 94) '&[a]': &[f64]
165 [93; 94) 'a': f64 170 [91; 94) '[a]': [f64]
166 [114; 115) '_': &[f64] 171 [92; 93) 'a': f64
167 [119; 121) '{}': () 172 [98; 124) '{ ... }': ()
173 [112; 113) 'a': f64
174 [134; 141) '&[b, c]': &[f64]
175 [135; 141) '[b, c]': [f64]
176 [136; 137) 'b': f64
177 [139; 140) 'c': f64
178 [145; 186) '{ ... }': ()
179 [159; 160) 'b': f64
180 [174; 175) 'c': f64
181 [195; 196) '_': &[f64]
182 [200; 202) '{}': ()
168 "### 183 "###
169 ); 184 );
170} 185}