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 in match expression when numeric constants do not have type specified #6288

Open
ironcev opened this issue Jul 21, 2024 · 0 comments
Open
Labels
bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler General compiler. Should eventually become more specific as the issue is triaged

Comments

@ironcev
Copy link
Member

ironcev commented Jul 21, 2024

This code:

script;

struct S {
    x: u64,
}

fn main() {
    let s = S { x: 0 };
    let _ = match s {
        S { x: 0 } => 0,
        S { x: 0u64 } => 0,
        _ => 0,
    };
}

produces the following internal compiler error:

Internal compiler error: expected all patterns to be of the same type

When both zeros are 0 or both are 0u64, as expected, the code compiles without errors.

@ironcev ironcev added bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels Jul 21, 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 compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler General compiler. Should eventually become more specific as the issue is triaged
Projects
None yet
Development

No branches or pull requests

1 participant