From 61825d5dab7c6777985fe8ba59d098882cd6d79c Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 1 Dec 2019 21:25:13 -0500 Subject: [PATCH] Fix Nested BinOp bug in Infixes --- src/can/operator.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/can/operator.rs b/src/can/operator.rs index d4ddca6043..bab913cdb4 100644 --- a/src/can/operator.rs +++ b/src/can/operator.rs @@ -104,14 +104,7 @@ pub fn desugar<'a>(arena: &'a Bump, loc_expr: &'a Located>) -> &'a Loca value: Closure(loc_patterns, desugar(arena, loc_ret)), }) } - BinOp(_) => desugar_bin_op(arena, loc_expr), - Nested(BinOp(op)) => desugar_bin_op( - arena, - arena.alloc(Located { - value: BinOp(op), - region: loc_expr.region, - }), - ), + BinOp(_) | Nested(BinOp(_)) => desugar_bin_op(arena, loc_expr), Defs(defs, loc_ret) | Nested(Defs(defs, loc_ret)) => { let mut desugared_defs = Vec::with_capacity_in(defs.len(), arena); @@ -621,7 +614,8 @@ impl<'a> Iterator for Infixes<'a> { .remaining_expr .take() .map(|loc_expr| match loc_expr.value { - Expr::BinOp((left, loc_op, right)) => { + Expr::BinOp((left, loc_op, right)) + | Expr::Nested(Expr::BinOp((left, loc_op, right))) => { self.remaining_expr = Some(right); self.next_op = Some(loc_op.clone());