aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests.rs
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-06-22 14:07:06 +0100
committerJonas Schievink <[email protected]>2020-06-24 15:53:16 +0100
commit4b03b39d5b4b00daffb120a4d2d9ea4a55a9a7ac (patch)
tree85431e53ce86bbcf16ba9b38fcc5f2ad27378722 /crates/ra_hir_ty/src/tests.rs
parentb94caeb88b4aab7219d4b2f5c8c6c668199247fb (diff)
draw the rest of the owl
Diffstat (limited to 'crates/ra_hir_ty/src/tests.rs')
-rw-r--r--crates/ra_hir_ty/src/tests.rs16
1 files changed, 11 insertions, 5 deletions
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(
67 panic!("Can't find expression") 67 panic!("Can't find expression")
68} 68}
69 69
70fn type_at(content: &str) -> String { 70fn type_at(ra_fixture: &str) -> String {
71 let (db, file_pos) = TestDB::with_position(content); 71 let (db, file_pos) = TestDB::with_position(ra_fixture);
72 type_at_pos(&db, file_pos) 72 type_at_pos(&db, file_pos)
73} 73}
74 74
@@ -164,13 +164,19 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
164 visit_module(&db, &crate_def_map, module.local_id, &mut |it| defs.push(it)); 164 visit_module(&db, &crate_def_map, module.local_id, &mut |it| defs.push(it));
165 defs.sort_by_key(|def| match def { 165 defs.sort_by_key(|def| match def {
166 DefWithBodyId::FunctionId(it) => { 166 DefWithBodyId::FunctionId(it) => {
167 it.lookup(&db).ast_id.to_node(&db).syntax().text_range().start() 167 let loc = it.lookup(&db);
168 let tree = db.item_tree(loc.id.file_id);
169 tree.source(&db, loc.id.value).syntax().text_range().start()
168 } 170 }
169 DefWithBodyId::ConstId(it) => { 171 DefWithBodyId::ConstId(it) => {
170 it.lookup(&db).ast_id.to_node(&db).syntax().text_range().start() 172 let loc = it.lookup(&db);
173 let tree = db.item_tree(loc.id.file_id);
174 tree.source(&db, loc.id.value).syntax().text_range().start()
171 } 175 }
172 DefWithBodyId::StaticId(it) => { 176 DefWithBodyId::StaticId(it) => {
173 it.lookup(&db).ast_id.to_node(&db).syntax().text_range().start() 177 let loc = it.lookup(&db);
178 let tree = db.item_tree(loc.id.file_id);
179 tree.source(&db, loc.id.value).syntax().text_range().start()
174 } 180 }
175 }); 181 });
176 for def in defs { 182 for def in defs {