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

Pretty-print lets with surrounding braces #532

Merged
merged 2 commits into from
Jan 10, 2023
Merged

Conversation

RyanGlScott
Copy link
Contributor

The pretty-printer for letseq and letrec was not adding braces around the variables being bound, resulting in malformed pretty-printed output such as letseq hw = "Hello, World!";; .... After adding braces, this now becomes letseq { hw = "Hello, World!"; };, which is valid Bluespec code. Fixes #529.

In order to add a test case for this fix, I needed to add some machinery to the test suite to run bsv2bsc, which exercises the relevant code paths. Along the way, I fixed a bug in the bsc2bsv machinery (on which the bsv2bsc machinery is based), so this PR also fixes #531.

@RyanGlScott
Copy link
Contributor Author

RyanGlScott commented Jan 10, 2023

As discussed in #529 (comment), a more direct way to test these changes is to use bsc's -dparsed=<filename> approach, which makes use of bsc's prettyprinter without needing to use the internal bsv2bsc tool. I'll mark this PR as a draft until I get that set up.

I'll plan to revert the changes in this PR involving bsv2bsc. That being said, this PR also contains a fix for #531, which is useful independent of this PR. I've opened #533 (a separate PR) for that.

@RyanGlScott RyanGlScott marked this pull request as draft January 10, 2023 01:56
The pretty-printer for `letseq` and `letrec` was not adding braces around
the variables being bound, resulting in malformed pretty-printed output such as
`letseq hw =  "Hello, World!";; ...`. After adding braces, this now becomes
`letseq { hw =  "Hello, World!"; };`, which is valid Bluespec code.

Fixes B-Lang-org#529.
@RyanGlScott RyanGlScott marked this pull request as ready for review January 10, 2023 03:07
@RyanGlScott
Copy link
Contributor Author

I've pushed a new version that uses the -dparsed=<filename> option to test the fix.

@quark17 quark17 merged commit 5787b41 into B-Lang-org:main Jan 10, 2023
@quark17
Copy link
Collaborator

quark17 commented Jan 10, 2023

Merged! Thanks!

FYI, I made two changes before merging: I changed the file name to be descriptive of the feature that it's testing (the fact that it's related to a GitHub issue is conveyed in a comment in the .exp file), and I changed the module name. The latter change is not so important, but figured I'd tweak it to follow the convention used in most of the newer test files (that the module name should be predictable from the file name).

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.

b611 test case is broken Pretty-printing bug involving let and letseq
2 participants