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:
Elias Mulhall 2024-09-03 22:27:45 -04:00
parent b515bfa77e
commit 19931ecd43
No known key found for this signature in database
GPG key ID: 8D1F3C219EAB45F2
10 changed files with 200 additions and 28 deletions

View file

@ -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!(