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

Go to definition in a union field with a name wrapped in @"" doesn't work. #2132

Open
Vexu opened this issue Jan 4, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@Vexu
Copy link
Contributor

Vexu commented Jan 4, 2025

Zig Version

0.14.0-dev.2598+b4da8eef2

ZLS Version

0.14.0-dev.329+19421e0f

Client / Code Editor / Extensions

vscode

Steps to Reproduce and Observed Behavior

Attempting to go to the definition of the b struct field in the @"b b b b" union field doesn't work unlike for the aaaa field or either field in a struct:

const U = union(enum) {
    aaaa: struct {
        a: u32,
    },
    @"b b b b": struct {
        b: u32,
    },
};

pub fn foo(u: U) u32 {
    return switch (u) {
        .aaaa => |aaaa| aaaa.a, // works
        .@"b b b b" => |@"b b b b"| @"b b b b".b, // doesn't work
        // .@"b b b b" => |bbbb| bbbb.b, // doesn't work either
    };
}

const S = struct {
    aaaa: struct {
        a: u32,
    },
    @"b b b b": struct {
        b: u32,
    },
};

pub fn bar(s: S) u32 {
    if (true) s.aaaa.a; // works
    return s.@"b b b b".b; // works
}

Expected Behavior

Got to definition works regardless of what the union field identifier is.

Relevant log output

No response

@Vexu Vexu added the bug Something isn't working label Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant