Skip to content

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

Description

@Vexu
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,

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions