xls
xls copied to clipboard
[DSLX] Better error message when for-loop results are unused
Coming from a non-dataflow-style loop it's easy to think we can just put a semicolon afterwards and that makes something happen:
for (i, accum) in range(u32:0, u32:4) {
...
}(init);
But really you want to capture the accum value or the loop effectively does nothing:
let accum = for (i, accum) in range(u32:0, u32:4) {
...
}(init);
We should make a nicer error message for this case where the user puts a semicolon and forgets to capture the result value with a "let". Right now it's a parse error expecting you to complete the function body (unexpected semi).