ponyc
ponyc copied to clipboard
Unhelpful error message for variable capture in match expressions
When a let or var is omitted from a variable capture in a match expression, as shown by this code:
actor Main
new create(env: Env) =>
let a: (I64 | None) = 7
env.out.print(match a
| n: I64 => n.string()
else ""
end)
the compiler gives this error:
Error:
/home/theodus/dev/wat/main.pony:6:19: syntax error: unterminated match expression
env.out.print(match a
^
Info:
/home/theodus/dev/wat/main.pony:7:10: expected terminating end before here
| n: I64 => n.string()
^
It should probably be changed to something like "variable capture requires let or var declaration".