Parametric values are flagging an issue in const_assert! as not being registered as constexpr -- I think this happens when we provide an incomplete set of parametrics -- the phantom parametric probably resolves to a ParametricSymbol (which we have intent to rip out) but the body of the function is still being evaluated for constexprs somehow. cc @richmckeever
To Reproduce
$ ~/opt/xlsynth/latest/dslx_interpreter_main reverse_chunks.x
reverse_chunks.x:19:3-19:36
0017:
0018: fn reverse_chunks<N: u32, FLAT: u32>(x: bits[FLAT]) -> bits[FLAT] {
0019: const_assert!(FLAT % N == u32:0); // Ensure FLAT is a multiple of N.
~~~~~~~~^-------------------------------^ TypeInferenceError: const_assert! expression is not constexpr
0020: const NUM_CHUNKS = FLAT / N;
$ ~/opt/xlsynth/latest/dslx_interpreter_main reverse_chunks.x
reverse_chunks.x:2:3-2:36
0001: fn f<N: u32, FLAT: u32>(x: bits[FLAT]) {
0002: const_assert!(FLAT % N == u32:0);
~~~~~~~~^-------------------------------^ TypeInferenceError: const_assert! expression is not constexpr
0003: }
0004:
Expected behavior
I'd expect this expression to be constexpr as the parametric values are compile-time constant, or to flag that not enough parametrics were provided to instantiate the function.
Describe the bug
Parametric values are flagging an issue in
const_assert!
as not being registered as constexpr -- I think this happens when we provide an incomplete set of parametrics -- the phantom parametric probably resolves to aParametricSymbol
(which we have intent to rip out) but the body of the function is still being evaluated for constexprs somehow. cc @richmckeeverTo Reproduce
Minimal reproducer:
Expected behavior I'd expect this expression to be constexpr as the parametric values are compile-time constant, or to flag that not enough parametrics were provided to instantiate the function.