Feature: more typing - #513
Draft
PigBrainOverflow wants to merge 9 commits into
Draft
Conversation
Contributor
|
Thanks for putting this together!
I agree that regression testing should be added in a separate PR, and that defining exactly what "no worse" means is quite hard. Some thoughts:
|
fdxmw
reviewed
Aug 24, 2026
fdxmw
left a comment
Contributor
There was a problem hiding this comment.
There are also some formatting errors, you should be able to reproduce them with uv run just presubmit
| zs[i].next <<= zs[i - 1] | ||
| regs = [pyrtl.Register(rwidth) for _ in range(ntaps - 1)] | ||
| for i, reg in enumerate(regs): | ||
| reg.next <<= x if i == 0 else regs[i - 1] |
Contributor
There was a problem hiding this comment.
Hmm, I find this harder to read than the original. What do you think about something like this?
regs = [pyrtl.Register(rwidth) for _ in range(ntaps - 1)]
regs[0].next <<= x
for prev, curr in itertools.pairwise(regs):
curr.next <<= prev
zs = [x, *regs]
Author
There was a problem hiding this comment.
Cool! It's clearer. I will adopt it
PigBrainOverflow
marked this pull request as draft
August 24, 2026 19:46
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.
#511
Register.nextsetter annotation to reflect that augmented assignment passes aRegister._Nextobject back through the setter.match_bitwidth's return type toIterator[WireVector], matching its current generator-based implementation.concat_list's parameter type fromlist[WireVectorLike]toSequence[WireVectorLike].The typing changes are annotation-only and do not change runtime behavior.
This PR focuses only on fixing the identified type annotations. I have not added repository-wide type-regression testing yet, since doing that robustly is a substantially larger piece of work.
A useful regression test would first require choosing a representative baseline and defining what it means for the typing state to become "no worse." This is not necessarily equivalent to comparing the number of diagnostics: a future change might eliminate several existing errors while introducing a smaller number of different errors, and it is not obvious whether that should be considered an improvement or a regression.
It would therefore be better to design the baseline and comparison policy separately, rather than introducing a fragile diagnostic-counting test as part of this PR.