···67056705 location: &'ast SrcSpan,
67066706 type_: &'ast Arc<Type>,
67076707 expression: &'ast Option<Box<TypedExpr>>,
67086708+ message: &'ast Option<Box<TypedExpr>>,
67086709 ) {
67096710 // We also want to trigger the action if we're hovering over the expression
67106711 // being printed. So we create a unique span starting from the start of echo
···67456746 }
67466747 }
6747674867486748- ast::visit::visit_typed_expr_echo(self, location, type_, expression);
67496749+ ast::visit::visit_typed_expr_echo(self, location, type_, expression, message);
67496750 }
6750675167516752 fn visit_typed_pipeline_assignment(&mut self, assignment: &'ast TypedPipelineAssignment) {
+5-3
compiler-core/src/parse.rs
···547547 }
548548 }
549549550550- Some((start, Token::Echo, end)) => {
550550+ Some((start, Token::Echo, echo_end)) => {
551551 self.advance();
552552 if context == ExpressionUnitContext::FollowingPipe {
553553 // If an echo is used as a step in a pipeline (`|> echo`)
554554 // then it cannot be followed by an expression.
555555 let message = self.maybe_parse_as_message()?;
556556- let end = message.as_ref().map_or(end, |m| m.location().end);
556556+ let end = message.as_ref().map_or(echo_end, |m| m.location().end);
557557 UntypedExpr::Echo {
558558 location: SrcSpan { start, end },
559559+ keyword_end: echo_end,
559560 expression: None,
560561 message,
561562 }
···567568 // stop analysis from happening everywhere and be fault
568569 // tolerant like everything else.
569570 let expression = self.parse_expression()?;
570570- let end = expression.as_ref().map_or(end, |e| e.location().end);
571571+ let end = expression.as_ref().map_or(echo_end, |e| e.location().end);
571572572573 let message = self.maybe_parse_as_message()?;
573574 let end = message.as_ref().map_or(end, |m| m.location().end);
574575575576 UntypedExpr::Echo {
576577 location: SrcSpan { start, end },
578578+ keyword_end: echo_end,
577579 expression: expression.map(Box::new),
578580 message,
579581 }
···11+---
22+source: compiler-core/src/type_/tests/errors.rs
33+expression: echo as 1
44+---
55+----- SOURCE CODE
66+echo as 1
77+88+----- ERROR
99+error: Invalid echo use
1010+ ┌─ /src/one/two.gleam:1:1
1111+ │
1212+1 │ echo as 1
1313+ │ ^^^^ I was expecting a value after this
1414+1515+The `echo` keyword should be followed by a value to print.
1616+1717+error: Type mismatch
1818+ ┌─ /src/one/two.gleam:1:9
1919+ │
2020+1 │ echo as 1
2121+ │ ^
2222+2323+Expected type:
2424+2525+ String
2626+2727+Found type:
2828+2929+ Int
···11+---
22+source: compiler-core/src/type_/tests/errors.rs
33+expression: "echo as \"wibble\""
44+---
55+----- SOURCE CODE
66+echo as "wibble"
77+88+----- ERROR
99+error: Invalid echo use
1010+ ┌─ /src/one/two.gleam:1:1
1111+ │
1212+1 │ echo as "wibble"
1313+ │ ^^^^ I was expecting a value after this
1414+1515+The `echo` keyword should be followed by a value to print.