Repository navigation
Rewrite how OneShotCfg.build_modes gets constructed - #158
Merged
Merged
Conversation
rswarbrick
force-pushed
the
one-shot-build-modes
branch
from
April 2, 2026 19:09
01105a0 to
0dab3f0
Compare
AlexJones0
reviewed
Apr 2, 2026
AlexJones0
reviewed
Apr 2, 2026
rswarbrick
force-pushed
the
one-shot-build-modes
branch
2 times, most recently
from
April 4, 2026 17:40
72db86b to
a39dcd6
Compare
AlexJones0
approved these changes
Apr 6, 2026
AlexJones0
left a comment
Contributor
There was a problem hiding this comment.
LGTM, modulo a few nits.
rswarbrick
force-pushed
the
one-shot-build-modes
branch
2 times, most recently
from
April 6, 2026 20:51
7459809 to
ca34a98
Compare
This is equivalent to the code before (although the call sites get slightly nicer). The important thing is that a type checker can now tell more about the type of the created mode objects: if I call BuildMode.create_modes(...), the type checker can tell that I create a list of BuildMode objects (rather than only knowing that they are Mode objects). Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
This is a bit tricky because self.build_modes comes from parsing an hjson dictionary and is actually a list of dictionaries that describe build modes. These get parsed and converted to BuildMode objects by Mode.create_modes. I've written a rather silly loose check that makes sure the types look reasonable, which is enough to let us convince Pyright to allow the code to claim the correct eventual types. Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
rswarbrick
force-pushed
the
one-shot-build-modes
branch
from
April 7, 2026 15:50
ca34a98 to
4b2d4bc
Compare
AlexJones0
approved these changes
Apr 7, 2026
AlexJones0
left a comment
Contributor
There was a problem hiding this comment.
Thanks, this is a very nice improvement.
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.
This is a bit tricky because self.build_modes comes from parsing an hjson dictionary and is actually a list of dictionaries that describe build modes.
These get parsed and converted to BuildMode objects by Mode.create_modes.
I've written a rather silly loose check that makes sure the types look reasonable, which is enough to let us convince Pyright to allow the code to claim the correct eventual types.
This commit also fixes an incorrect type in the second argument to create_modes.