Skip to content
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 type wildcards (_) #5183

Closed
michaeljklein opened this issue Jun 5, 2024 · 1 comment · Fixed by #5275
Closed

Support type wildcards (_) #5183

michaeljklein opened this issue Jun 5, 2024 · 1 comment · Fixed by #5275
Assignees
Labels
enhancement New feature or request

Comments

@michaeljklein
Copy link
Contributor

Problem

Currently,

  1. When using turbofish with multiple arguments, e.g.
foo<A, B, 3, 12>
  1. When the return type is underconstrained, e.g. when deserializing from an array of Field's:
let deserialized: Vec<MyStruct> = input.deserialize();

(i.e. collect::<Vec<_>>())

This can require a lot of duplication when functions/traits have several generic arguments and makes the resulting code more fragile.

Happy Case

Support a type wildcard (_) that's equivalent to an unbound type variable and errors at monomorphization if still unbound:

foo<_, _, 3, 12>
let deserialized: Vec<_> = input.deserialize();

Project Impact

Nice-to-have

Impact Context

No response

Workaround

Yes

Workaround Description

Specify all of the arguments and types explicitly

Additional Context

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@michaeljklein michaeljklein added the enhancement New feature or request label Jun 5, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jun 5, 2024
@TomAFrench
Copy link
Member

See #4664

github-merge-queue bot pushed a commit that referenced this issue Jun 18, 2024
# Description

## Problem\*

Resolves #5183 

## Summary\*
Add support for wildcard type: `_`


## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [X] 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.
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants