[dslx:fe] Error message should be better when we backtrack due to e.g. symbol resolution error
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
**Describe the bug**
With this snippet:
```dslx
fn f() -> u32 { X + Y }
fn main() {
f();
}
```
you get: `Expected '}', got ','` because we backtrack from the symbol resolution error to the `<` and treat that as a less-than operator and then expect the end of the function after the body expression.
If you put the literal in braces:
```dslx
fn f() -> u32 { X + Y }
fn main() {
f<{u32:42}, DOES_NOT_EXIST>();
}
```
you get: `Expected start of an expression; got: {`
Presumably because we don't accept a block expression in the binary right hand side position (although that surprises me as well).
I can only decipher what's happening here because I know the backtracking pops up and goes straight into the "this must be a comparison operator" attempt. I think there's some easier things we can do to make clearer what's happening and some harder ones, but in this case I think we ideally want the "DOES_NOT_EXIST symbol could not be resolved" error to be the propagated, even if we attempt to parse down both backtracking paths.
Contributor guide
Assessment
This issue has not been assessed yet.