Skip to content

Suggest .{} syntax when accidentally using {} #22402

@vegerot

Description

@vegerot

Zig Version

0.13.0

Steps to Reproduce and Observed Output

Correct code:

var position = raylib.Vector2{.x = 0, .y = 0};
// ...
position = .{.x = 42, .y = 69};

Wrong code

var position = raylib.Vector2{.x = 0, .y = 0};
// ...
position = {.x = 42, .y = 69};

Error message:
image

me/game.zig:361:98: error: expected ';' after statement
                        {.x = 42, .y = 69}

Expected Output

me/game.zig:42:69: error: start inferred structs with `.{`
                            .{.x = 42, .y = 69}

Metadata

Metadata

Assignees

No one assigned

    Labels

    error messageThis issue points out an error message that is unhelpful and should be improved.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions