use really correct resolver for expressions

This commit is contained in:
Aleksey Kladov 2019-04-13 00:44:47 +03:00
parent 20013de2ab
commit 0fd93bc14a
9 changed files with 27 additions and 13 deletions

View file

@ -132,7 +132,7 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Option<String> {
.ancestors()
.take_while(|it| it.range() == leaf_node.range())
.find(|&it| ast::Expr::cast(it).is_some() || ast::Pat::cast(it).is_some())?;
let analyzer = hir::SourceAnalyzer::new(db, frange.file_id, node);
let analyzer = hir::SourceAnalyzer::new(db, frange.file_id, node, None);
let ty = if let Some(ty) = ast::Expr::cast(node).and_then(|e| analyzer.type_of(db, e)) {
ty
} else if let Some(ty) = ast::Pat::cast(node).and_then(|p| analyzer.type_of_pat(db, p)) {