Skip to content

invalid destructure of type has incorrect error location #24149

@leecannon

Description

@leecannon

Zig Version

0.15.0-dev.769+4d7980645

Steps to Reproduce and Observed Behavior

pub fn main() void {
    const a, const b = struct { true, false };
    _ = a;
    _ = b;
}
$ zig build-exe main.zig
main.zig:1:5: error: expected type 'type', found 'bool'
pub fn main() void {
~~~~^~~~~~~~~~~~~~
referenced by:
    callMain [inlined]: /home/lee/.local/share/zigup/0.15.0-dev.769+4d7980645/files/lib/std/start.zig:666:22
    callMainWithArgs [inlined]: /home/lee/.local/share/zigup/0.15.0-dev.769+4d7980645/files/lib/std/start.zig:635:20
    posixCallMainAndExit: /home/lee/.local/share/zigup/0.15.0-dev.769+4d7980645/files/lib/std/start.zig:590:36
    2 reference(s) hidden; use '-freference-trace=5' to see all references

Expected Behavior

Error refers to line 2 of the file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions