Wrong error generated in formatter (in parser) when missing constant definition inside parametric bindings (but not first)
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
**Describe the bug**
You get misleading parse errors like `"Expected start of an expression; got: {"` or `"Expected '}', got ','"` from xls/dslx/frontend/bindings.h:58 in the following cases:
**To Reproduce**
First error:
```
fn foo(a: u1) -> bits[M] {
(a as bits[M]) >> N
}
const BAR = u32:1;
fn main() -> u32 {
foo(u1:1)
}
```
Second error:
```
fn foo(a: u1) -> bits[M] {
(a as bits[M]) >> N
}
const BAR = u32:1;
fn main() -> u32 {
foo<{BAR + u32:1}, BAZ>(u1:1)
}
```
**Expected behavior**
Similar to the following example, I'd expect to get an error like: Cannot find a definition for name: "BAZ"
```
fn foo(a: u1) -> bits[M] {
(a as bits[M]) >> N
}
const BAR = u32:1;
fn main() -> u32 {
foo(u1:1)
}
```
Contributor guide
Assessment
This issue has not been assessed yet.