-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support impl Trait
in a parameter position
#4540
Labels
enhancement
New feature or request
Comments
Duplicate of #3771 See there for implementation notes |
5 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Apr 29, 2024
# 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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Noir already has limited support for
impl Trait
in a return type position. It should also supportimpl Trait
in a parameter position for consistency.Happy Case
impl Trait
in a parameter position is added.This is just sugar for a trait constraint on a generic parameter:
Project Impact
None
Impact Context
No response
Workaround
None
Workaround Description
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: