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

Appending symbol table hashes to test expectations #2576

Merged
merged 8 commits into from
Sep 7, 2023

Conversation

evan-schott
Copy link
Contributor

Motivation

  • Currently, AST hashes are appended to test expectations after every relevant pass. This ensures that AST construction and updating is deterministic. This feature does the same for the symbol table.
  • This feature also allows for writing the symbol table to a JSON file. This enables optional visualization of the symbol table after the symbol table, type checking and loop unrolling passes.

Choices

  • I used a JSON representation for the symbol table as this makes the design more consistent with how the respective AST feature is implemented.
  • Initially I began by writing a generic trait for JSON serializing that could be implemented by both ast/lib.rs and common/symbol_table/mod.rs. This made things more complicated and required adding a new file, so I decided to copy the relevant methods into common/symbol_table/mod.rs instead.

compiler/compiler/src/compiler.rs Outdated Show resolved Hide resolved
compiler/compiler/src/compiler.rs Outdated Show resolved Hide resolved
compiler/compiler/tests/utilities/mod.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Merging #2576 (a3c8bb4) into testnet3 (b6fff89) will decrease coverage by 0.12%.
The diff coverage is 77.41%.

@@             Coverage Diff              @@
##           testnet3    #2576      +/-   ##
============================================
- Coverage     80.09%   79.98%   -0.12%     
============================================
  Files           159      160       +1     
  Lines          5321     5381      +60     
  Branches       5321     5381      +60     
============================================
+ Hits           4262     4304      +42     
- Misses         1059     1077      +18     
Files Changed Coverage Δ
errors/src/errors/ast/ast_errors.rs 30.00% <0.00%> (-12.86%) ⬇️
compiler/passes/src/common/symbol_table/mod.rs 88.70% <64.70%> (-9.12%) ⬇️
compiler/compiler/src/compiler.rs 86.66% <89.47%> (-1.91%) ⬇️
compiler/ast/src/lib.rs 81.08% <100.00%> (ø)
compiler/compiler/tests/compile.rs 92.10% <100.00%> (-4.77%) ⬇️
compiler/compiler/tests/execute.rs 91.93% <100.00%> (+4.00%) ⬆️
compiler/compiler/tests/utilities/mod.rs 89.28% <100.00%> (+0.97%) ⬆️
.../passes/src/common/symbol_table/function_symbol.rs 82.35% <100.00%> (ø)
.../passes/src/common/symbol_table/variable_symbol.rs 100.00% <100.00%> (ø)

... and 14 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@d0cd d0cd left a comment

Choose a reason for hiding this comment

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

LGTM!

@d0cd d0cd merged commit b47fac0 into testnet3 Sep 7, 2023
15 of 16 checks passed
@d0cd d0cd deleted the feat/hash-symbol-table branch September 7, 2023 20:35
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