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

generic parameters are not available in trait methods #3479

Closed
ghost opened this issue Nov 12, 2023 · 1 comment
Closed

generic parameters are not available in trait methods #3479

ghost opened this issue Nov 12, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Nov 12, 2023

Aim

trait Clone2 {
    fn clone(self) -> Self;
}

trait Getter<T> where T: Clone2 {
    fn get(self) -> T;
}

impl Getter<u64> for u64 {
    fn get(self) -> u64 { self }
}

Expected Behavior

ERROR `u64: Clone2` is not satisfied

Bug

error: Could not resolve 'T' in path
  ┌─ /hello/src/main.nr:6:21
  │
6 │     fn get(self) -> T;
  │                     -
  │

To Reproduce

Installation Method

Compiled from source

Nargo Version

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@ghost ghost added the bug Something isn't working label Nov 12, 2023
@jfecher
Copy link
Contributor

jfecher commented Jan 4, 2024

Duplicate of #3471

@jfecher jfecher marked this as a duplicate of #3471 Jan 4, 2024
@jfecher jfecher closed this as completed Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

1 participant