Repository navigation
Improve assertions for instructions by introducing "pretty" instructions - #4423
Merged
Merged
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Benchstat comparison
Results
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
turbolent
marked this pull request as ready for review
January 30, 2026 20:06
SupunS
approved these changes
Feb 10, 2026
Co-authored-by: Supun Setunga <supun.setunga@gmail.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
6 tasks done
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.
Description
Currently the tests for the compiler assert that the compiler generates specific instructions, and instructions use indices for types, constants, locals, etc. That makes the assertions brittle, as changes in the way that the compiler allocates types, constant, locals, etc. in a different order "physically" breaks the tests, though semantically nothing changes.
Add (automatically generated) "pretty" equivalents for all instruction types, where the operands are not indices, but specific Go types (e.g. a type operand is a
bbq.StaticTypeinstead of auint16).Finally, refactor the tests to assert pretty instructions. There are a lot of changes, but given we did not change anything in the compiler code, the new code cannot be incorrect as it must re-assert what was already previously asserted.
I verified the changed by using
git diff --word-diff --word-diff-regex='.' -- bbq/compiler/compiler_test.gowhile making the changes.masterbranchFiles changedin the Github PR explorer