You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the addition of the turbofish operator (#3542) we should be able to use trait generics without them being bound to a parameter or return value.
I want to be able to use a trait generic to instantiate an object using its trait methods and then further use those trait methods. For example the following code should work (after #5041):
vezenovm
changed the title
Expression type is ambigious when using trait generics that instantiate variabels
Expression type is ambigious when using trait generics that instantiate variables
May 21, 2024
…ng identifiers (#5087)
# Description
## Problem\*
Resolves#5063
## Summary\*
After the turbofish PRs we want the ability to instantiate a variable
from a generic trait. This was possible but it required a redundant type
annotiation like such (assume `H` has been specified with a `where`
clause):
```rust
let hasher: H = H::default()
```
Similarly to trait generics, we now add type bindings from a trait
constraint if the trait impl is assumed to exist.
We now can just do:
```rust
let hasher = H::default()
```
## Additional Context
## Documentation\*
Check one:
- [X] 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.
Aim
After the addition of the turbofish operator (#3542) we should be able to use trait generics without them being bound to a parameter or return value.
I want to be able to use a trait generic to instantiate an object using its trait methods and then further use those trait methods. For example the following code should work (after #5041):
Expected Behavior
The program above should pass.
Bug
Instead when attempting to use the result of
H::default()
we get an errorExpression type is ambiguous
.To Reproduce
Project Impact
Blocker
Impact Context
This blocks us being able to document and advertise turbofish
Workaround
None
Workaround Description
No response
Additional Context
No response
Installation Method
None
Nargo Version
No response
NoirJS Version
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: