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

Cannot use type aliases of primitive types in paths #6398

Open
asterite opened this issue Oct 30, 2024 · 0 comments
Open

Cannot use type aliases of primitive types in paths #6398

asterite opened this issue Oct 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@asterite
Copy link
Collaborator

Aim

Similar to #4469 but extracted as a different issue as this is slightly more difficult to implement (it probably requires rewriting how paths are solved) and it's also maybe less common.

The idea is that this works:

type MyField = Field;

fn main() {
    let _ = MyField::add(1, 2);
}

We do allow Field::add(1, 2), but that's parsed as a TypePath. In this case MyField::add would be a regular path, but the tricky thing is that we need to resolve the alias and look up the method in that aliased type. And generics could follow MyField, for example in an alias like type Array<T> = [T], so the method we end up looking up is relative to the given generics. So, path lookup is mixed with type resolution, which is not how it currently works.

Expected Behavior

The above snippet (and more complex ones) work.

Bug

The above doesn't compile.

To Reproduce

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Nargo Version

No response

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@asterite asterite added the bug Something isn't working label Oct 30, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Oct 30, 2024
@asterite asterite mentioned this issue Oct 30, 2024
5 tasks
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
Status: 📋 Backlog
Development

No branches or pull requests

1 participant