aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r--crates/ra_hir/src/ty.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 13ee6cb27..92de9842c 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -211,7 +211,6 @@ impl fmt::Display for Ty {
211} 211}
212 212
213pub fn type_for_fn(db: &impl HirDatabase, f: Function) -> Cancelable<Ty> { 213pub fn type_for_fn(db: &impl HirDatabase, f: Function) -> Cancelable<Ty> {
214 eprintln!("type_for_fn {:?}", f.fn_id);
215 let syntax = f.syntax(db); 214 let syntax = f.syntax(db);
216 let node = syntax.borrowed(); 215 let node = syntax.borrowed();
217 // TODO we ignore type parameters for now 216 // TODO we ignore type parameters for now
@@ -397,7 +396,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
397 Ty::Unknown 396 Ty::Unknown
398 } 397 }
399 ast::Expr::CallExpr(e) => { 398 ast::Expr::CallExpr(e) => {
400 let _callee_ty = if let Some(e) = e.expr() { 399 let callee_ty = if let Some(e) = e.expr() {
401 self.infer_expr(e)? 400 self.infer_expr(e)?
402 } else { 401 } else {
403 Ty::Unknown 402 Ty::Unknown
@@ -408,7 +407,16 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
408 self.infer_expr(arg)?; 407 self.infer_expr(arg)?;
409 } 408 }
410 } 409 }
411 Ty::Unknown 410 match callee_ty {
411 Ty::FnPtr(sig) => {
412 sig.output.clone()
413 }
414 _ => {
415 // not callable
416 // TODO report an error?
417 Ty::Unknown
418 }
419 }
412 } 420 }
413 ast::Expr::MethodCallExpr(e) => { 421 ast::Expr::MethodCallExpr(e) => {
414 let _receiver_ty = if let Some(e) = e.expr() { 422 let _receiver_ty = if let Some(e) = e.expr() {