From 4b03b39d5b4b00daffb120a4d2d9ea4a55a9a7ac Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 22 Jun 2020 15:07:06 +0200 Subject: draw the rest of the owl --- crates/ra_hir_ty/src/tests.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir_ty/src') diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs index 1fe05c70c..e82f2c11e 100644 --- a/crates/ra_hir_ty/src/tests.rs +++ b/crates/ra_hir_ty/src/tests.rs @@ -67,8 +67,8 @@ fn type_at_pos_displayed( panic!("Can't find expression") } -fn type_at(content: &str) -> String { - let (db, file_pos) = TestDB::with_position(content); +fn type_at(ra_fixture: &str) -> String { + let (db, file_pos) = TestDB::with_position(ra_fixture); type_at_pos(&db, file_pos) } @@ -164,13 +164,19 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String { visit_module(&db, &crate_def_map, module.local_id, &mut |it| defs.push(it)); defs.sort_by_key(|def| match def { DefWithBodyId::FunctionId(it) => { - it.lookup(&db).ast_id.to_node(&db).syntax().text_range().start() + let loc = it.lookup(&db); + let tree = db.item_tree(loc.id.file_id); + tree.source(&db, loc.id.value).syntax().text_range().start() } DefWithBodyId::ConstId(it) => { - it.lookup(&db).ast_id.to_node(&db).syntax().text_range().start() + let loc = it.lookup(&db); + let tree = db.item_tree(loc.id.file_id); + tree.source(&db, loc.id.value).syntax().text_range().start() } DefWithBodyId::StaticId(it) => { - it.lookup(&db).ast_id.to_node(&db).syntax().text_range().start() + let loc = it.lookup(&db); + let tree = db.item_tree(loc.id.file_id); + tree.source(&db, loc.id.value).syntax().text_range().start() } }); for def in defs { -- cgit v1.2.3