diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs index dbd5935c95..a09fb2d4ca 100644 --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -246,6 +246,16 @@ fn to_expr_report<'a>( Context::InNode(Node::WhenBranch, _pos, _) => { return to_unexpected_arrow_report(alloc, lines, filename, *pos, start); } + + Context::InDef(_pos) => { + vec![alloc.stack([ + alloc.concat([alloc.reflow( + "Did you mean to define a function? Condider defining this as", + )]), + alloc.vcat(vec![alloc.text("id = \\x -> x")]), + ])] + } + _ => { vec![alloc.stack([ alloc.concat([ diff --git a/crates/reporting/tests/test_reporting.rs b/crates/reporting/tests/test_reporting.rs index 27f86c654b..95bace9579 100644 --- a/crates/reporting/tests/test_reporting.rs +++ b/crates/reporting/tests/test_reporting.rs @@ -5653,11 +5653,9 @@ All branches in an `if` must have the same type! 4│ main = 5 -> 3 ^^ - The arrow -> is only used to define cases in a `when`. + Did you mean to define a function? Condider defining this as - when color is - Red -> "stop!" - Green -> "go!" + id = \x -> x "### );