review: use parser suggestion

This commit is contained in:
Luca Cervello 2022-10-17 18:43:28 +02:00
parent 1c0b1ba0af
commit b39f0d98b7
No known key found for this signature in database
GPG key ID: 05180DD59F7580C4
2 changed files with 9 additions and 6 deletions

View file

@ -249,10 +249,11 @@ fn to_expr_report<'a>(
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")]),
alloc.reflow("Looks like you are trying to define a function. "),
alloc.reflow("In roc, functions are always written as a lambda, like "),
alloc
.parser_suggestion("increment = \\n -> n + 1")
.indent(4),
])]
}

View file

@ -5653,9 +5653,11 @@ All branches in an `if` must have the same type!
4 main = 5 -> 3
^^
Did you mean to define a function? Condider defining this as
Looks like you are trying to define a function.
id = \x -> x
In roc, functions are always written as a lambda, like
increment = \n -> n + 1
"###
);