Change AST to match the functionality of the Driver#284
Merged
KyrylR merged 1 commit intoBlockstreamResearch:dev/importsfrom Apr 21, 2026
Merged
Conversation
KyrylR
reviewed
Apr 15, 2026
|
|
||
| mod linearization; | ||
| mod resolve_order; | ||
| pub mod resolve_order; |
Collaborator
There was a problem hiding this comment.
Suggested change
| pub mod resolve_order; | |
| pub(crate) mod resolve_order; |
?
5db3887 to
8924e31
Compare
a56022e to
539cf0a
Compare
539cf0a to
e1cd84e
Compare
Collaborator
|
|
Collaborator
|
Could we document that |
e1cd84e to
af536d0
Compare
KyrylR
reviewed
Apr 21, 2026
Comment on lines
+589
to
+592
| assert_eq!( | ||
| self.file_id, MAIN_MODULE, | ||
| "The 'main' function must be defined in the entry point file" | ||
| ); |
Collaborator
There was a problem hiding this comment.
Not sure if it is a good idea to panic here
af536d0 to
0fc6ca3
Compare
KyrylR
approved these changes
Apr 21, 2026
delta1
added a commit
that referenced
this pull request
Apr 23, 2026
8b12ac6 fix: internal error inside resolution.rs and add error tests (Sdoba16) da1240a test: add functional tests (Sdoba16) 7df36e7 feat: add `--dep` flag and connect driver to overall execution flow, add examples (LesterEvSe) 857cc5a feat: change ast.rs to match the functionality of the driver (LesterEvSe) fda737f fix: resolution data structure and alias architecture (LesterEvSe) 260d844 feat: add and test import aliases (LesterEvSe) 8300fe5 feat: add linearize and build functionality to the driver, fix `Error` enum a bit (LesterEvSe) f5999f2 feat: Added linearization algorithm (Sdoba16) 056a359 feat: implement `DependencyGraph` inside `driver.rs` file and change parse trait to the `SourceFile` (LesterEvSe) e2604f3 feat: add data structure for dependency resolution (LesterEvSe) 2064542 feat: add `SourceFile` to the `RichError` and change the `ErrorCollector` (LesterEvSe) 80ae099 feat: add import errors (LesterEvSe) 3c7d4c3 feat: implement resolution.rs utils (LesterEvSe) 7ddeed2 feat: add pub and use keywords and parse them (LesterEvSe) Pull request description: ## Motivation (copied from #258) The main goal of this PR is to enable an analogue of the OpenZeppelin library to exist in the SimplicityHL ecosystem. By introducing official compiler support for imports, we significantly increase code reusability and speed up application development. For projects heavily focused on security, this also allows developers to eventually "flatten" the code and audit all functions without external dependencies. ## Checklist - [x] **Visibility:** Added `pub` and `pub use` to control local scope versus re-exporting. - [x] **Import Syntax:** Implemented parsing and resolution for `use m::name;` and explicit aliasing (`as`). - [x] **Collision Handling:** Enforced strict errors for local scope collisions, utilizing linearization for resolving re-export conflicts. - [x] **Transitive Dependencies**: Add support for libraries importing other libraries. - [x] **Documentation:** Сode comments are updated accordingly. - [x] **Quality Assurance:** Code is formatted, all tests pass, and CI shows no errors. Related PRs (in order of the merge): #260, #256, #265, #266, #269, #278, #279, #280, #283, #287, #284, #289 ACKs for top commit: KyrylR: ACK 8b12ac6; code review and test runs (see #260, #256, #265, #266, #269, #278, #279, #280, #283, #287, #284, #289) delta1: ACK 8b12ac6; tested locally Tree-SHA512: bec0d7437279dd45810cd8b13b48ba3921739d8c38f61d2f61401e419b32a2f4b31328df2c5596375fe8c69cabadc3e931a639ad833fe446918d1360091a447f
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.
DependencyGraphto prevent the usage of magic numbers.AST currently has some issues with processing source files properly, so they are not used and have been deleted along with the
ResolvedFilestructure.I hope this will be fixed when the
ErrorCollectoris recoded to support multiple files better.