I was looking at the first ResultTryQuestion PR and realized I kept worrying about how we would ensure that ! and ? are kept in sync in their behavior.
Would anyone be opposed to me making a new PR that makes a combined AST node TrySuffix
that has an enum TryTarget { Task, Result }
field? This is strong coupling of the two suffix operators on purpose, so it seems better than hoping they don't come out of sync.
makes sense to me! :thumbs_up:
By the way, @Kiryl Dziamura there's a bug in the current ! -> Task.await
code:
❯ roc repl
The rockin' roc repl
────────────────────────
Enter an expression, or :help, or :q to quit.
» x = {
… y: 123,
… z: \a ->
… b = fix! a
… Task.ok (b * 2)
… }
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
I'll try to fix it in my PR, but I'll probably defer this to another PR to avoid making my PR much larger
https://github.com/roc-lang/roc/issues/7001
Last updated: Jul 06 2025 at 12:14 UTC