So I have discovered a bug where a function which conditionally returns a list will produce an unhandled parse error:
── UNHANDLED PARSE ERROR in Utils.roc ────────────────────
I got stuck while parsing this:
1│ module [if_else_list]
2│
3│ if_else_list : U8 -> List U8
4│ if_else_list |in|
^
Here's the internal parse problem:
UnexpectedTopLevelExpr(@52)
module [if_else_list]
if_else_list : U32 -> List U8
if_else_list |in|
if in < 1 then
[]
else
[1]
same for:
if_else_list |in|
when in is
num if num < 1 -> []
_ -> [1]
You're missing an equals sign before the args list
Can code gud.
Ian McLerran has marked this topic as resolved.
Could be a better error message though
True that!
Last updated: Jul 06 2025 at 12:14 UTC