Commit fa84636
committed
Merge #264: Add imports functionality
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: bec0d7437279dd45810cd8b13b48ba3921739d8c38f61d2f61401e419b32a2f4b31328df2c5596375fe8c69cabadc3e931a639ad833fe446918d1360091a447f64 files changed
Lines changed: 4010 additions & 181 deletions
File tree
- doc
- examples
- multiple_deps
- math
- merkle
- simple_multidep
- crypto
- math
- single_dep
- temp
- constants
- functional-tests
- error-test-cases
- cyclic-dependency
- lib
- file-not-found
- lib-not-found
- name-collision
- lib
- private-visibility
- lib
- type-alias-duplication
- lib
- valid-test-cases
- deep-reexport-chain
- lib
- diamond-dependency-resolution
- lib
- interleaved-waterfall
- auth
- db
- orch
- types
- leaky-signature
- lib
- module-simple
- lib
- multi-lib-facade
- api
- crypto
- math
- reexport-diamond
- lib
- fuzz/fuzz_targets
- src
- driver
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments