diff options
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index f0793bfb4..6f8d8fa49 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -2581,6 +2581,35 @@ fn test() { foo.call()<|>; } | |||
2581 | ); | 2581 | ); |
2582 | } | 2582 | } |
2583 | 2583 | ||
2584 | #[test] | ||
2585 | fn method_resolution_slow() { | ||
2586 | // this can get quite slow if we set the solver size limit too high | ||
2587 | let t = type_at( | ||
2588 | r#" | ||
2589 | //- /main.rs | ||
2590 | trait Send {} | ||
2591 | |||
2592 | struct S1; impl Send for S1; | ||
2593 | struct S2; impl Send for S2; | ||
2594 | struct U1; | ||
2595 | |||
2596 | trait Trait { fn method(self); } | ||
2597 | |||
2598 | struct X1<A, B> {} | ||
2599 | impl<A, B> Send for X1<A, B> where A: Send, B: Send {} | ||
2600 | |||
2601 | struct S<B, C> {} | ||
2602 | |||
2603 | trait Fn {} | ||
2604 | |||
2605 | impl<B, C> Trait for S<B, C> where C: Fn, B: Send {} | ||
2606 | |||
2607 | fn test() { (S {}).method()<|>; } | ||
2608 | "#, | ||
2609 | ); | ||
2610 | assert_eq!(t, "{unknown}"); | ||
2611 | } | ||
2612 | |||
2584 | fn type_at_pos(db: &MockDatabase, pos: FilePosition) -> String { | 2613 | fn type_at_pos(db: &MockDatabase, pos: FilePosition) -> String { |
2585 | let file = db.parse(pos.file_id); | 2614 | let file = db.parse(pos.file_id); |
2586 | let expr = algo::find_node_at_offset::<ast::Expr>(file.syntax(), pos.offset).unwrap(); | 2615 | let expr = algo::find_node_at_offset::<ast::Expr>(file.syntax(), pos.offset).unwrap(); |