diff options
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 5d7bc25cc..09c8644f7 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -334,6 +334,29 @@ 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]; | ||
347 | let e = [d, d]; | ||
348 | let f = [e, e]; | ||
349 | |||
350 | // we have not infered these case yet. | ||
351 | let g = [1, 2]; | ||
352 | let h = ["a", "b"]; | ||
353 | let b = [a, ["b"]]; | ||
354 | } | ||
355 | "#, | ||
356 | "array.txt", | ||
357 | ); | ||
358 | } | ||
359 | |||
337 | fn infer(content: &str) -> String { | 360 | fn infer(content: &str) -> String { |
338 | let (db, _, file_id) = MockDatabase::with_single_file(content); | 361 | let (db, _, file_id) = MockDatabase::with_single_file(content); |
339 | let source_file = db.source_file(file_id); | 362 | let source_file = db.source_file(file_id); |