From 7744cd41e2ad79c1b36d3d9fccd3bc0dbfd9e2d9 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Tue, 7 May 2019 17:35:45 +0200 Subject: Reduce Chalk max_size parameter, add test for slow case --- crates/ra_hir/src/ty/tests.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'crates/ra_hir/src/ty/tests.rs') 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()<|>; } ); } +#[test] +fn method_resolution_slow() { + // this can get quite slow if we set the solver size limit too high + let t = type_at( + r#" +//- /main.rs +trait Send {} + +struct S1; impl Send for S1; +struct S2; impl Send for S2; +struct U1; + +trait Trait { fn method(self); } + +struct X1 {} +impl Send for X1 where A: Send, B: Send {} + +struct S {} + +trait Fn {} + +impl Trait for S where C: Fn, B: Send {} + +fn test() { (S {}).method()<|>; } +"#, + ); + assert_eq!(t, "{unknown}"); +} + fn type_at_pos(db: &MockDatabase, pos: FilePosition) -> String { let file = db.parse(pos.file_id); let expr = algo::find_node_at_offset::(file.syntax(), pos.offset).unwrap(); -- cgit v1.2.3