-
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.
feat: add de-sugaring for
impl Trait
in function parameters (#4919)
# Description ## Problem\* Resolves #4540 ## Summary\* In the resolver, when `x: impl Trait` is encountered as a function parameter, it is desugared to: ```rust fn function_name<T_impl_trait>(x: T_impl_trait) where T_impl_trait: Trait ``` ## Additional Context In the current iteration of this PR, `T[func_id]_impl_[trait_name]` is checked for collisions and incremented (`T[func_id]_impl_[trait_name]_N`) until there's no collision. Note that this PR adds a few ~unrelated cases where `TraitAsType` could have arguments that were previously skipped: https://github.com/noir-lang/noir/pull/4919/files#diff-52c7ae61478bab09a4d23320128eead3a88cde6a7be16fb8b070b5512d690bbdR1203 ## Documentation\* Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** 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
1 parent
8a3c7f1
commit 8aad2e4
Showing
8 changed files
with
166 additions
and
17 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
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,3 @@ | ||
fn func_name(x: impl Eq) {} | ||
|
||
fn func_name<T>(x: impl Eq, y: T) where T: SomeTrait + Eq {} |
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,3 @@ | ||
fn func_name(x: impl Eq) {} | ||
|
||
fn func_name<T>(x: impl Eq, y: T) where T: SomeTrait + Eq {} |