diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-15 23:05:28 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-15 23:05:28 +0000 |
commit | 68d320a680b5df802b2c3e7dad5d890e3309ed60 (patch) | |
tree | f38fafe9cbc4efea5574afa6c40a0fea403bf34c /crates/ra_hir/src/expr.rs | |
parent | ab46f8abf195a78c018d8b23896eb920d16b028b (diff) | |
parent | a2b6d3da30020421c97100d7c8699a3b4f8cd6fb (diff) |
Merge #544
544: Implement rudimentary type inference for unary operators r=marcusklaas a=marcusklaas
Co-authored-by: Marcus Klaas de Vries <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/expr.rs')
-rw-r--r-- | crates/ra_hir/src/expr.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 4e8dc0c54..663338844 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -182,7 +182,7 @@ pub enum Expr { | |||
182 | }, | 182 | }, |
183 | UnaryOp { | 183 | UnaryOp { |
184 | expr: ExprId, | 184 | expr: ExprId, |
185 | op: Option<UnaryOp>, | 185 | op: UnaryOp, |
186 | }, | 186 | }, |
187 | BinaryOp { | 187 | BinaryOp { |
188 | lhs: ExprId, | 188 | lhs: ExprId, |
@@ -612,8 +612,11 @@ impl ExprCollector { | |||
612 | } | 612 | } |
613 | ast::ExprKind::PrefixExpr(e) => { | 613 | ast::ExprKind::PrefixExpr(e) => { |
614 | let expr = self.collect_expr_opt(e.expr()); | 614 | let expr = self.collect_expr_opt(e.expr()); |
615 | let op = e.op(); | 615 | if let Some(op) = e.op() { |
616 | self.alloc_expr(Expr::UnaryOp { expr, op }, syntax_ptr) | 616 | self.alloc_expr(Expr::UnaryOp { expr, op }, syntax_ptr) |
617 | } else { | ||
618 | self.alloc_expr(Expr::Missing, syntax_ptr) | ||
619 | } | ||
617 | } | 620 | } |
618 | ast::ExprKind::LambdaExpr(e) => { | 621 | ast::ExprKind::LambdaExpr(e) => { |
619 | let mut args = Vec::new(); | 622 | let mut args = Vec::new(); |