Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix display #101

Merged

Conversation

uncomputable
Copy link
Collaborator

Fixes how modules and values are displayed.

simfony::Arguments and simfony::WitnessValues can be printed as
`mod param { ... }` and `mod witness { ... }`, respectively.
We almost never need this, but when we do, it is helpful to print the
module items `const NAME: TYPE = Value` in order of `NAME`.

Because simfony::Arguments and simfony::WitnessValues internally use
HashMap, their keys are not sorted. Manually sorting the keys is
computationally expensive, but we rarely need this code. Printing modules
is basically only required for the web IDE and it is not required for the
Simfony compiler itself. The Simfony compiler benefits from the armotized
complexity of the HashMap operations.
The implementation of fmt::Display for Value loops over each inner value
in (verbose) pre-order. This makes it hard to display a larger value in
a custom way while hiding its inner values.

The updated implementation tries to parse a Simfony array as a non-empty
byte array. If this succeeds, the bytes are displayed as hex and a flag
is set to true. The flag hides the inner values of the array, which have
already been printed. At the end, the flag is set to false again.
Copy link
Contributor

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 66d4462; successfully ran local tests

@uncomputable uncomputable merged commit 980a2e1 into BlockstreamResearch:master Nov 26, 2024
12 checks passed
@uncomputable uncomputable deleted the 2024-11-fix-display branch November 26, 2024 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants