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

AstGen doesn't pass type to switch prong #11788

Closed
Vexu opened this issue Jun 3, 2022 · 0 comments · Fixed by #11800
Closed

AstGen doesn't pass type to switch prong #11788

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

Comments

@Vexu
Copy link
Member

Vexu commented Jun 3, 2022

test {
    var a: u32 = 0;
    var b: [2]u32 = undefined;
    b[0] = @as(u32, switch (a) {
        1 => 1,
        else => 0,
    });
}
a.zig:29:21: error: value with comptime only type 'comptime_int' depends on runtime control flow
    b[0] = @as(u32, switch (a) {
                    ^
a.zig:29:29: note: runtime control flow here
    b[0] = @as(u32, switch (a) {
                            ^

Related #11135

@Vexu Vexu added bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness. labels Jun 3, 2022
@Vexu Vexu added this to the 0.10.0 milestone Jun 3, 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