ir_convert should recognize inline array as valid RHS const expr in proc config functions
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
**Describe the bug**
In the context of a proc `config` function, it seems that `ir_convert` doesn't recognize inline array definitions as const expr .
**To Reproduce**
Attempting to convert the following proc:
```
import float32;
type F32 = float32::F32;
const F32_0 = float32::zero(false);
const F32_2 = F32 { sign: false, bexp: u8:128, fraction: u23:0 };
proc matmul {
weight: F32[u32:4][u32:4];
config() {
let weights = F32[u32:4][u32:4]:[
[F32_2, F32_0, F32_0, F32_0], [F32_0, F32_2, F32_0, F32_0], [F32_0, F32_0, F32_2, F32_0],
[F32_0, F32_0, F32_0, F32_2],
];
(weights,)
}
init { () }
next(state: ()) {
()
}
}
```
will produce the following error:
```
Error: INTERNAL: Let RHS not evaluated as constexpr: weights : F32[u32:4][u32:4]:[[F32_2, F32_0, F32_0, F32_0], [F32_0, F32_2, F32_0, F32_0], [F32_0, F32_0, F32_2, F32_0], [F32_0, F32_0, F32_0, F32_2]]
```
**Expected behavior**
ir_convert infer the `const expr`-ness for the array let binding.
Contributor guide
Assessment
This issue has not been assessed yet.