aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/tests.rs')
-rw-r--r--crates/ra_hir_ty/src/tests.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs
index 087edcc92..7e9547340 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -11,8 +11,13 @@ use std::fmt::Write;
11use std::sync::Arc; 11use std::sync::Arc;
12 12
13use hir_def::{ 13use hir_def::{
14 body::BodySourceMap, child_by_source::ChildBySource, db::DefDatabase, item_scope::ItemScope, 14 body::{BodySourceMap, SyntheticSyntax},
15 keys, nameres::CrateDefMap, AssocItemId, DefWithBodyId, LocalModuleId, Lookup, ModuleDefId, 15 child_by_source::ChildBySource,
16 db::DefDatabase,
17 item_scope::ItemScope,
18 keys,
19 nameres::CrateDefMap,
20 AssocItemId, DefWithBodyId, LocalModuleId, Lookup, ModuleDefId,
16}; 21};
17use hir_expand::InFile; 22use hir_expand::InFile;
18use insta::assert_snapshot; 23use insta::assert_snapshot;
@@ -67,20 +72,20 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
67 72
68 for (pat, ty) in inference_result.type_of_pat.iter() { 73 for (pat, ty) in inference_result.type_of_pat.iter() {
69 let syntax_ptr = match body_source_map.pat_syntax(pat) { 74 let syntax_ptr = match body_source_map.pat_syntax(pat) {
70 Some(sp) => { 75 Ok(sp) => {
71 sp.map(|ast| ast.either(|it| it.syntax_node_ptr(), |it| it.syntax_node_ptr())) 76 sp.map(|ast| ast.either(|it| it.syntax_node_ptr(), |it| it.syntax_node_ptr()))
72 } 77 }
73 None => continue, 78 Err(SyntheticSyntax) => continue,
74 }; 79 };
75 types.push((syntax_ptr, ty)); 80 types.push((syntax_ptr, ty));
76 } 81 }
77 82
78 for (expr, ty) in inference_result.type_of_expr.iter() { 83 for (expr, ty) in inference_result.type_of_expr.iter() {
79 let syntax_ptr = match body_source_map.expr_syntax(expr) { 84 let syntax_ptr = match body_source_map.expr_syntax(expr) {
80 Some(sp) => { 85 Ok(sp) => {
81 sp.map(|ast| ast.either(|it| it.syntax_node_ptr(), |it| it.syntax_node_ptr())) 86 sp.map(|ast| ast.either(|it| it.syntax_node_ptr(), |it| it.syntax_node_ptr()))
82 } 87 }
83 None => continue, 88 Err(SyntheticSyntax) => continue,
84 }; 89 };
85 types.push((syntax_ptr, ty)); 90 types.push((syntax_ptr, ty));
86 if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr) { 91 if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr) {