From 832ca81a8c3fc44e1f37e1293f13633aeef5748b Mon Sep 17 00:00:00 2001 From: rvcas Date: Tue, 28 Nov 2023 19:19:56 -0500 Subject: [PATCH] fix(lsp): when desugaring and/or chains we should use the whole span of the chain for the generated BinOp locations --- crates/aiken-lang/src/expr.rs | 3 ++- crates/aiken-lang/src/tipo/expr.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/aiken-lang/src/expr.rs b/crates/aiken-lang/src/expr.rs index 65f7480c..dccc9aaa 100644 --- a/crates/aiken-lang/src/expr.rs +++ b/crates/aiken-lang/src/expr.rs @@ -365,7 +365,8 @@ impl TypedExpr { TypedExpr::BinOp { left, right, .. } => left .find_node(byte_index) - .or_else(|| right.find_node(byte_index)), + .or_else(|| right.find_node(byte_index)) + .or(Some(Located::Expression(self))), TypedExpr::Assignment { value, pattern, .. } => pattern .find_node(byte_index, &value.tipo()) diff --git a/crates/aiken-lang/src/tipo/expr.rs b/crates/aiken-lang/src/tipo/expr.rs index c542fb23..2c642ae4 100644 --- a/crates/aiken-lang/src/tipo/expr.rs +++ b/crates/aiken-lang/src/tipo/expr.rs @@ -1661,7 +1661,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> { .into_iter() .rev() .reduce(|acc, typed_expression| TypedExpr::BinOp { - location: Span::empty(), + location, tipo: bool(), name, left: typed_expression.into(),