mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Support passing values into dbg
with the pipe operator
In order to desugar `dbg` in a pipeline we need to allow a bare `dbg` node in desugaring and only report it as an error if the bare node survives to the next step of canonicalization. This means we move the error code out of `desugar_expr` and into `canonicalize_expr`. This is much simpler to do now that these functions use the same `env` struct, since previously we would have had to pass down extra args to `canonicalize_expr`. Sharing the `env` struct means that we also don't have to worry about calculating `line_info` more than once.
This commit is contained in:
parent
b515bfa77e
commit
19931ecd43
10 changed files with 200 additions and 28 deletions
|
@ -0,0 +1 @@
|
|||
1 |> dbg
|
|
@ -0,0 +1,16 @@
|
|||
SpaceAfter(
|
||||
BinOps(
|
||||
[
|
||||
(
|
||||
@0-1 Num(
|
||||
"1",
|
||||
),
|
||||
@2-4 Pizza,
|
||||
),
|
||||
],
|
||||
@5-8 Dbg,
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
1 |> dbg
|
|
@ -442,6 +442,7 @@ mod test_snapshots {
|
|||
pass/pattern_as_spaces.expr,
|
||||
pass/pattern_with_space_in_parens.expr, // https://github.com/roc-lang/roc/issues/929
|
||||
pass/pizza_bang.moduledefs,
|
||||
pass/pizza_dbg.expr,
|
||||
pass/plus_if.expr,
|
||||
pass/plus_when.expr,
|
||||
pass/pos_inf_float.expr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue