Skip to content

Commit

Permalink
Merge pull request #7133 from nathanKramer/link-to-operators-tutorial
Browse files Browse the repository at this point in the history
Link to operators tutorial in unknown operator error message
  • Loading branch information
Anton-4 authored Oct 7, 2024
2 parents 6cb2501 + d35da49 commit f1a1f57
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
10 changes: 6 additions & 4 deletions crates/compiler/load/tests/test_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4299,8 +4299,9 @@ mod test_reporting {
4│ f :: I64
^^
I have no specific suggestion for this operator, see TODO for the full
list of operators in Roc.
I have no specific suggestion for this operator, see
https://www.roc-lang.org/tutorial#operator-desugaring-table for the
full list of operators in Roc.
"#
);

Expand Down Expand Up @@ -6052,8 +6053,9 @@ All branches in an `if` must have the same type!
5│ 5 ** 3
^^
I have no specific suggestion for this operator, see TODO for the full
list of operators in Roc.
I have no specific suggestion for this operator, see
https://www.roc-lang.org/tutorial#operator-desugaring-table for the
full list of operators in Roc.
"#
);

Expand Down
7 changes: 5 additions & 2 deletions crates/reporting/src/error/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,11 @@ fn to_expr_report<'a>(
alloc.reflow(" instead."),
],
_ => vec![
alloc.reflow("I have no specific suggestion for this operator, "),
alloc.reflow("see TODO for the full list of operators in Roc."),
alloc.reflow("I have no specific suggestion for this operator, see "),
alloc.parser_suggestion(
"https://www.roc-lang.org/tutorial#operator-desugaring-table ",
),
alloc.reflow("for the full list of operators in Roc."),
],
};

Expand Down
2 changes: 2 additions & 0 deletions www/content/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -2326,6 +2326,8 @@ Here are various Roc expressions involving operators, and what they desugar to.
| `!a` | `Bool.not a` |
| <code>a \|> f</code> | `f a` |
| <code>f a b \|> g x y</code> | `g (f a b) x y` |
| `f!` | [see example](https://www.roc-lang.org/examples/DesugaringAwait/README.html) |
| `f?` | [see example](https://www.roc-lang.org/examples/DesugaringTry/README.html) |

</section>
<script type="text/javascript" src="/builtins/search.js" defer></script>

0 comments on commit f1a1f57

Please sign in to comment.