Improve Display for Value in several ways#328
Merged
apoelstra merged 7 commits intoBlockstreamResearch:masterfrom Dec 11, 2025
Merged
Improve Display for Value in several ways#328apoelstra merged 7 commits intoBlockstreamResearch:masterfrom
Display for Value in several ways#328apoelstra merged 7 commits intoBlockstreamResearch:masterfrom
Conversation
ValueRef is a &-reference with a bit of small metadata attached. It should be Copy just like &Value is.
These all conceptually work on references to values, so they should be available from a ValueRef.
KyrylR
reviewed
Dec 11, 2025
| @@ -746,33 +768,63 @@ impl fmt::Display for Value { | |||
| // a unit is displayed simply as 0 or 1. | |||
Contributor
There was a problem hiding this comment.
This comment seems stale after the DispUnlessUnit removal
KyrylR
approved these changes
Dec 11, 2025
2b71572 to
3890c47
Compare
Contributor
|
ACK 3890c47 |
Previously we would display left branches as 0 and right branches as 1, and had a special case where if the child node was unit, we would not display the inner (ε) to reduce noise. Now that we special-case all bitstrings, in particular bitstrings of length 1, this special-case is unnecessary and actually confusing. Now if we encounter a sum type we know it's *not* a bit and it would be clearer to indicate it as L or R, and if the child is a unit, we should unconditionally display that.
This was annoying me.
3890c47 to
5e5fbe2
Compare
Collaborator
Author
|
@KyrylR sorry, I messed up and one of my commits didn't pass tests because I updated a unit test in the wrong commit. Fixed. |
Contributor
|
ACK 5e5fbe2 |
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.
Now we:
0b0xL(...)orR(...)rather than0...or1...As an example of the improvement, consider this sample output from
StderrTracker. Previously we hadNow we have
I would like to get this in before #327.