[DSLX] Proc-scoped constants should be a parse error until they are supported
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
**Describe the bug**
Attempting to use a const value member of a proc in a local type definition produces "not constexpr" errors.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a DSLX file with the following contents:
```
pub proc constexpr_example {
const A_WIDTH = u32:32;
type A = uN[A_WIDTH];
ch_in: chan in;
config(ch_in: chan in) { (ch_in,) }
init { () }
next(state: ()) { () }
}
```
2. Try to run parsing & type-checking on this file.
You'll see an error of the form `NotConstantError: expr `A_WIDTH` is not constexpr.` reported on the line where we're defining `type A = ...`.
**Expected behavior**
We should report an error at the point where the proc-scoped `const` is declared, and it should be clear that the issue is that proc-scoped constants are not supported at this time.
Contributor guide
Assessment
This issue has not been assessed yet.