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

ICE on Struct type aliases #2502

Closed
alexvitkov opened this issue Aug 31, 2023 · 1 comment · Fixed by #2528
Closed

ICE on Struct type aliases #2502

alexvitkov opened this issue Aug 31, 2023 · 1 comment · Fixed by #2528
Labels
bug Something isn't working

Comments

@alexvitkov
Copy link
Contributor

alexvitkov commented Aug 31, 2023

Aim

This code panics with an internal compiler error:

struct Foo {}
type StillFoo = Foo;

fn main() {
    let foo: StillFoo = Foo {};
}

It's caused by the fact that we resolve type aliases before structs -- this example can be fixed by changing the resolution order (calling resolve_type_aliases before resolve_structs), however we can have both structs referencing typedefs and typedefs referencing structs, for which there's no trivial fix:

struct Foo {}
type StillFoo = Foo;

struct Bar {
    foo: StillFoo,
}

fn main() {
    let bar = Bar { foo: Foo{} };
}

Expected Behavior

The examples above work

Bug

ICE

Installation Method

Compiled from source

Would you like to submit a PR for this Issue?

Yes

@alexvitkov alexvitkov added the bug Something isn't working label Aug 31, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Aug 31, 2023
@yordanmadzhunkov
Copy link
Contributor

jfecher added a commit that referenced this issue Sep 1, 2023
jfecher added a commit that referenced this issue Sep 1, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Sep 1, 2023
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

Successfully merging a pull request may close this issue.

2 participants