From 17540a6bd61aca7cceb6dcf83ebbf17cdc01578e Mon Sep 17 00:00:00 2001 From: collin Date: Thu, 13 Aug 2020 23:46:14 -0700 Subject: [PATCH] fix stack overflow error --- typed/src/expression.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/typed/src/expression.rs b/typed/src/expression.rs index bb57834136..edaab576e6 100644 --- a/typed/src/expression.rs +++ b/typed/src/expression.rs @@ -331,10 +331,16 @@ impl<'ast> From> for Expression { Box::new(Expression::from(*expression.right)), Span::from(expression.span), ), - BinaryOperation::Ne => Expression::Not( - Box::new(Expression::from(expression.clone())), - Span::from(expression.span), - ), + BinaryOperation::Ne => { + let span = Span::from(expression.span); + let negated = Expression::Eq( + Box::new(Expression::from(*expression.left)), + Box::new(Expression::from(*expression.right)), + span.clone(), + ); + + Expression::Not(Box::new(negated), span.clone()) + } BinaryOperation::Ge => Expression::Ge( Box::new(Expression::from(*expression.left)), Box::new(Expression::from(*expression.right)),