mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +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
|
@ -3295,6 +3295,18 @@ fn dbg_inside_string() {
|
|||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn pizza_dbg() {
|
||||
indoc!(
|
||||
r#"
|
||||
1
|
||||
|> dbg
|
||||
|> Num.add 2
|
||||
|> dbg
|
||||
"#
|
||||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn linked_list_reverse() {
|
||||
indoc!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue