aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-05-07 16:35:45 +0100
committerFlorian Diebold <[email protected]>2019-05-11 15:21:20 +0100
commit7744cd41e2ad79c1b36d3d9fccd3bc0dbfd9e2d9 (patch)
tree0943a0bfd0ce6d61d28730a37130907507fdc9d1 /crates/ra_hir/src/ty/tests.rs
parentd8cd0e36f5288dd4c14fb5a07b73533d88f29788 (diff)
Reduce Chalk max_size parameter, add test for slow case
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r--crates/ra_hir/src/ty/tests.rs29
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]
2585fn 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
2590trait Send {}
2591
2592struct S1; impl Send for S1;
2593struct S2; impl Send for S2;
2594struct U1;
2595
2596trait Trait { fn method(self); }
2597
2598struct X1<A, B> {}
2599impl<A, B> Send for X1<A, B> where A: Send, B: Send {}
2600
2601struct S<B, C> {}
2602
2603trait Fn {}
2604
2605impl<B, C> Trait for S<B, C> where C: Fn, B: Send {}
2606
2607fn test() { (S {}).method()<|>; }
2608"#,
2609 );
2610 assert_eq!(t, "{unknown}");
2611}
2612
2584fn type_at_pos(db: &MockDatabase, pos: FilePosition) -> String { 2613fn 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();