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

an ICE happening when we call a closure result from if/else #2154

Closed
alehander92 opened this issue Aug 3, 2023 · 0 comments · Fixed by #2146
Closed

an ICE happening when we call a closure result from if/else #2154

alehander92 opened this issue Aug 3, 2023 · 0 comments · Fixed by #2146
Labels
bug Something isn't working

Comments

@alehander92
Copy link
Contributor

Aim

To fix this and make it run without an error: an example by @jfecher in #1959 (comment)

fn main() {
    let x: u32 = 32;

    let f = if x > 2 {
        || x
    } else {
        || x + 2342
    };

    dep::std::println(f());
}

Expected Behavior

pass without errors

Bug

this lead to an ICE related to tuples and SSA:
If nodes have a fn type when a closure is returned, while monomorphization rewrites mean, the actual type should be a Tuple: happening when we call a closure preserved in a variable, resulting from such an if.

To Reproduce

No response

Installation Method

Compiled from source

Nargo Version

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

Yes

Support Needs

No response

@alehander92 alehander92 added the bug Something isn't working label Aug 3, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Aug 3, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Aug 4, 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.

1 participant