-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow type aliases to reference other aliases (#4353)
# Description ## Problem\* Resolves <!-- Link to GitHub Issue --> ## Summary\* Allows type aliases to reference other aliases, using the dependency graph to error if there are ever cycles. To prevent infinite recursion in the type checker, aliases now have their own `Type::Alias` node which is used to set the inner aliased type to `Type::Error` in the case of a cycle to break the cycle. ## Additional Context Example error: ``` error: Dependency cycle found ┌─ /home/user/Code/Noir/noir/short/src/main.nr:2:1 │ 2 │ type B = A; │ ---------- 'B' recursively depends on itself: B -> A -> B │ ``` ## Documentation\* Check one: - [ ] No documentation needed. - [x] 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. --------- Co-authored-by: kevaundray <kevtheappdev@gmail.com>
- Loading branch information
1 parent
39af6cc
commit c44ef14
Showing
11 changed files
with
190 additions
and
55 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
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
Oops, something went wrong.