-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle multiple imports in the same file (#3903)
# Description ## Problem\* Resolves #3889 ## Summary\* An import of an imported object in the same file would not work because the imports are added to the module after they are resolved. To fix this we simply process the imports one-by-one. ## Additional Context ## Documentation\* Check one: - [X] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [X] I have tested the changes locally. - [X] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
Showing
5 changed files
with
85 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "regression_3889" | ||
version = "0.1.0" | ||
type = "bin" | ||
authors = [""] | ||
|
||
[dependencies] |
10 changes: 10 additions & 0 deletions
10
test_programs/execution_success/regression_3889/Prover.toml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[works] | ||
a = "5" | ||
|
||
[fails] | ||
a = "6" | ||
|
||
|
||
[also_fails] | ||
a = "7" | ||
|
23 changes: 23 additions & 0 deletions
23
test_programs/execution_success/regression_3889/src/main.nr
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
mod Foo { | ||
struct NewType{ | ||
a: Field, | ||
} | ||
} | ||
|
||
mod Bar { | ||
use crate::Foo::NewType as BarStruct; | ||
use crate::Foo::NewType; | ||
} | ||
|
||
mod Baz { | ||
struct Works { | ||
a: Field, | ||
} | ||
use crate::Bar::BarStruct; | ||
use crate::Bar::NewType; | ||
} | ||
|
||
|
||
fn main(works: Baz::Works, fails: Baz::BarStruct, also_fails: Bar::NewType) -> pub Field { | ||
works.a + fails.a + also_fails.a | ||
} |