mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
feat: suggest lambda operator
This commit is contained in:
parent
8ada13cc3b
commit
1c0b1ba0af
2 changed files with 12 additions and 4 deletions
|
@ -246,6 +246,16 @@ fn to_expr_report<'a>(
|
||||||
Context::InNode(Node::WhenBranch, _pos, _) => {
|
Context::InNode(Node::WhenBranch, _pos, _) => {
|
||||||
return to_unexpected_arrow_report(alloc, lines, filename, *pos, start);
|
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([
|
vec![alloc.stack([
|
||||||
alloc.concat([
|
alloc.concat([
|
||||||
|
|
|
@ -5653,11 +5653,9 @@ All branches in an `if` must have the same type!
|
||||||
4│ main = 5 -> 3
|
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
|
id = \x -> x
|
||||||
Red -> "stop!"
|
|
||||||
Green -> "go!"
|
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue