aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-12-20 15:41:32 +0000
committerFlorian Diebold <[email protected]>2019-12-20 17:16:11 +0000
commit2a8c9100bfb1294a469bc039a5b9597eabed7073 (patch)
treeae4e2dd0ae2c62baf79ec1197f5ec5f94a7645e5 /crates/ra_hir_def
parentcfc50ff160d0af2ce5cd931c6d41161abfdb2fbd (diff)
Handle closure return types
Fixes #2547.
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r--crates/ra_hir_def/src/body/lower.rs3
-rw-r--r--crates/ra_hir_def/src/expr.rs1
2 files changed, 3 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 853e17bae..be5d17d85 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -372,8 +372,9 @@ where
372 arg_types.push(type_ref); 372 arg_types.push(type_ref);
373 } 373 }
374 } 374 }
375 let ret_type = e.ret_type().and_then(|r| r.type_ref()).map(TypeRef::from_ast);
375 let body = self.collect_expr_opt(e.body()); 376 let body = self.collect_expr_opt(e.body());
376 self.alloc_expr(Expr::Lambda { args, arg_types, body }, syntax_ptr) 377 self.alloc_expr(Expr::Lambda { args, arg_types, ret_type, body }, syntax_ptr)
377 } 378 }
378 ast::Expr::BinExpr(e) => { 379 ast::Expr::BinExpr(e) => {
379 let lhs = self.collect_expr_opt(e.lhs()); 380 let lhs = self.collect_expr_opt(e.lhs());
diff --git a/crates/ra_hir_def/src/expr.rs b/crates/ra_hir_def/src/expr.rs
index 6fad80a8d..a75ef9970 100644
--- a/crates/ra_hir_def/src/expr.rs
+++ b/crates/ra_hir_def/src/expr.rs
@@ -143,6 +143,7 @@ pub enum Expr {
143 Lambda { 143 Lambda {
144 args: Vec<PatId>, 144 args: Vec<PatId>,
145 arg_types: Vec<Option<TypeRef>>, 145 arg_types: Vec<Option<TypeRef>>,
146 ret_type: Option<TypeRef>,
146 body: ExprId, 147 body: ExprId,
147 }, 148 },
148 Tuple { 149 Tuple {