[DSLX] Better error message when for-loop results are unused
Open
dslx
enhancement
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
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).
Contributor guide
Assessment
This issue has not been assessed yet.