nightly-2024-02-14: feat: Allow type aliases to reference other aliases (#4353)
Pre-release
Pre-release
·
1572 commits
to master
since this release
# 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>