diff options
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 5d7bc25cc..affd63a85 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -334,6 +334,32 @@ fn test(x: &str, y: isize) { | |||
334 | ); | 334 | ); |
335 | } | 335 | } |
336 | 336 | ||
337 | #[test] | ||
338 | fn infer_array() { | ||
339 | check_inference( | ||
340 | r#" | ||
341 | fn test(x: &str, y: isize) { | ||
342 | let a = [x]; | ||
343 | let b = [a, a]; | ||
344 | let c = [b, b]; | ||
345 | |||
346 | let d = [y, 1, 2, 3]; | ||
347 | let d = [1, y, 2, 3]; | ||
348 | let e = [y]; | ||
349 | let f = [d, d]; | ||
350 | let g = [e, e]; | ||
351 | |||
352 | let h = [1, 2]; | ||
353 | let i = ["a", "b"]; | ||
354 | |||
355 | let b = [a, ["b"]]; | ||
356 | let x: [u8; 0] = []; | ||
357 | } | ||
358 | "#, | ||
359 | "array.txt", | ||
360 | ); | ||
361 | } | ||
362 | |||
337 | fn infer(content: &str) -> String { | 363 | fn infer(content: &str) -> String { |
338 | let (db, _, file_id) = MockDatabase::with_single_file(content); | 364 | let (db, _, file_id) = MockDatabase::with_single_file(content); |
339 | let source_file = db.source_file(file_id); | 365 | let source_file = db.source_file(file_id); |