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

Stage2 result location cannot handle store to inferred from nested switch #11135

Closed
Vexu opened this issue Mar 12, 2022 · 0 comments · Fixed by #11733
Closed

Stage2 result location cannot handle store to inferred from nested switch #11135

Vexu opened this issue Mar 12, 2022 · 0 comments · Fixed by #11733
Labels
bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone

Comments

@Vexu
Copy link
Member

Vexu commented Mar 12, 2022

test {
    var a: error{ A, B }!u64 = 0;
    var b = a catch |err| switch (err) {
        error.A => 0,
        else => unreachable,
    };
    _ = b;
}

0 gets emitted to AIR as comptime_int which then causes coerce to hit unreachable when a value of comptime_int is not comptime known.

Happens in dwarf.zig when calling std.debug.dumpCurrentStackTrace on linux but is easily avoided with a simple cast.

error.MissingDebugInfo => 0,

@Vexu Vexu added bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness. labels Mar 12, 2022
@Vexu Vexu added this to the 0.10.0 milestone Mar 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant