Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expr::TaskAwaitBang expression was not completely removed in desugar_value_def_suffixed #234

Open
lukewilliamboswell opened this issue Jul 29, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@lukewilliamboswell
Copy link
Collaborator

$ roc broken.roc
An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: <https://github.com/roc-lang/roc/issues/new/choose>
a Expr::TaskAwaitBang expression was not completely removed in desugar_value_def_suffixed
Location: crates/compiler/can/src/expr.rs:1130:41
app [main] {
    cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.13.0/nW9yMRtZuCYf1Oa9vbE5XoirMwzLbtoSgv7NGhUlqYA.tar.br",
}

import cli.Stdout
import cli.Arg
import cli.Task exposing [Task]

main =
    Arg.list! {}
    |> List.dropFirst 1
    |> List.mapTry Str.toU8Checked
    |> Task.fromResult!
    |> List.sum
    |> \total -> "Sum of numbers: $(Num.toStr total)"
    |> Stdout.line!
@lukewilliamboswell lukewilliamboswell added the bug Something isn't working label Jul 29, 2024
@Lubsch
Copy link

Lubsch commented Aug 2, 2024

Can also replicate with e.g.

app [main] {
    cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.12.0/Lb8EgiejTUzbggO2HVVuPJFkwvvsfW6LojkLR20kTVE.tar.br"
}

import cli.Stdout
import cli.Cmd
import cli.Task exposing [Task]

main =
    Cmd.new "ls"
        |> Cmd.output
        |> Task.onErr! \CmdOutputError _ -> Task.err (Exit 1 "")
        |> .stdout
        |> Str.fromUtf8
        |> Task.fromResult!
        |> Stdout.write!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants