Repository navigation
Fix DSLX ToBits derivation for arrays of tuples and empty tuples - #5300
Merged
copybara-service[bot] merged 1 commit intoNov 10, 2026
Merged
copybara-service[bot] merged 1 commit into
copybara-service[bot] merged 1 commit into
Conversation
Reuse the shared array element type when expanding tuple members. Return a zero-width value when concatenating an empty aggregate, including a nested unit or an empty struct. Add regressions for the bit order and result widths.
richmckeever
approved these changes
Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deriving
ToBitsfor a DSLX struct could crash the frontend when a field contained an array of tuples or a nested empty tuple.The tuple branch now uses the element type selected for the current expression. Array elements share a single type entry, so the second element of
(bool,)[2]previously read past that entry. Concatenating zero elements now producesuN[0]:0, which handles()inside an aggregate and preserves the existing result for an empty struct.The regression tests check that
[(true,), (false,)]packs tou2:0b10and that((), bool)packs to one bit for either Boolean value.Validation
//xls/dslx/type_system_v2:typecheck_module_v2_trait_testpassed in an optimized CI build.//xls/...wildcard onb50d71752. All 2,205 selected test targets passed (1,074 executed, 1,131 cached). The sweep excluded//xls/contrib/...,//xls/dev_tools/...,//xls/visualization/..., and five tests whose dependency graphs reach OpenROAD, Yosys, or Clang.