diff options
author | Florian Diebold <[email protected]> | 2019-01-26 22:48:01 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-01-26 22:48:01 +0000 |
commit | 77f92674f9a2ea8e8cd303d15710621a4f7839cb (patch) | |
tree | 769232968e82fc463b3c08c7108ff2394e01ed4a /crates/ra_hir/src/ty/tests.rs | |
parent | e40d8d40321b191ee82b8b07910f8a0898c8914c (diff) |
Handle cycles in type vars
This might be the cause of #587.
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index e1165f682..e34daa0f7 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -562,6 +562,33 @@ fn quux() { | |||
562 | ); | 562 | ); |
563 | } | 563 | } |
564 | 564 | ||
565 | #[test] | ||
566 | fn recursive_vars() { | ||
567 | check_inference( | ||
568 | "recursive_vars", | ||
569 | r#" | ||
570 | fn test() { | ||
571 | let y = unknown; | ||
572 | [y, &y]; | ||
573 | } | ||
574 | "#, | ||
575 | ); | ||
576 | } | ||
577 | |||
578 | #[test] | ||
579 | fn recursive_vars_2() { | ||
580 | check_inference( | ||
581 | "recursive_vars_2", | ||
582 | r#" | ||
583 | fn test() { | ||
584 | let x = unknown; | ||
585 | let y = unknown; | ||
586 | [(x, y), (&y, &x)]; | ||
587 | } | ||
588 | "#, | ||
589 | ); | ||
590 | } | ||
591 | |||
565 | fn infer(content: &str) -> String { | 592 | fn infer(content: &str) -> String { |
566 | let (db, _, file_id) = MockDatabase::with_single_file(content); | 593 | let (db, _, file_id) = MockDatabase::with_single_file(content); |
567 | let source_file = db.parse(file_id); | 594 | let source_file = db.parse(file_id); |