Value from const array used in loop range fails assertion in the typechecker #1664
Labels
dslx
DSLX (domain specific language) implementation / front-end
enhancement
New feature or request
ux
User experience (end-user invoking XLS and its related tools)
Describe the bug
Typechecking fails on an internal assertion when a value from an array declared as const is used in a for loop range construct, e.g:
Indexing array
FOO
with a constant doesn't trigger this bug, it must be indexed using a non-const, e.g. loop iterator to trigger it.To Reproduce
Steps to reproduce the behavior:
bazel run //xls/modules/zstd:const_array_value_as_range
Expected behavior
Assertion in typechecker shouldn't fail and a more user-friendly message should be reported: one that mentions that
foobar
needs to be constexpr and perhaps suggests usingunroll_for!
for the outer loop instead.Additional context
This was discovered while working on DSLX tests for the ZSTD decoder in #1654. It's not a blocker as using
unroll_for!
correctly makesi
constexpr (and by extensionfoobar
as well) and hence solves the issue.The text was updated successfully, but these errors were encountered: