Skip to content

unhelpful error when operand to error set merge is runtime #24150

Open
@xdBronch

Description

@xdBronch

Zig Version

0.15.0-dev.762+3208c80f2

Steps to Reproduce and Observed Output

|| is often mistakenly used instead of or by newcomers to zig

pub fn main() void {
    var foo = true;
    _ = &foo;
    _ = foo || foo;
}
a.zig:4:9: error: unable to resolve comptime value
    _ = foo || foo;
        ^~~
a.zig:4:9: note: types must be comptime-known

this gives no real explanation as to why anything needs to be comptime since type seemingly isn't used

Expected Output

the error should give a more helpful message similar to here in the runtime case

Metadata

Metadata

Assignees

No one assigned

    Labels

    error messageThis issue points out an error message that is unhelpful and should be improved.frontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions