Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds string representation methods (__repr__ and __str__) to union types and improves the formatting of struct string representations. The changes enhance debugging and display capabilities by providing hierarchical, tree-like output that shows all union members and their values.
- Adds
__str__and__repr__methods to union types to display all member fields with proper indentation - Updates struct formatting to use tree-like symbols and proper zero-padding for hex values
- Enhances scalar type string representation with more descriptive naming and formatting
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packtype/types/union.py | Implements __str__ and __repr__ methods for union display with tree formatting |
| packtype/types/scalar.py | Updates scalar string representation with descriptive naming and hex formatting |
| packtype/types/assembly.py | Improves struct formatting with tree symbols and proper hex padding |
| tests/pysyntax/test_union.py | Adds test coverage for union string representation |
| tests/pysyntax/test_struct.py | Adds test coverage for updated struct string representation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
OisinRobinson
approved these changes
Sep 18, 2025
Collaborator
OisinRobinson
left a comment
There was a problem hiding this comment.
With offline discussion about how the print looks these changes look good to me- Approved.
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.
Adds
__repr__and__str__to union to print out all members, also adjusts the formatting of structs to make it easier to follow: