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

ambiguous enum field access does not error #19970

Closed
nektro opened this issue May 14, 2024 · 1 comment
Closed

ambiguous enum field access does not error #19970

nektro opened this issue May 14, 2024 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@nektro
Copy link
Contributor

nektro commented May 14, 2024

Zig Version

0.13.0-dev.210+c37872bcf

Steps to Reproduce and Observed Behavior

const std = @import("std");

test {
    const E = enum {
        foo,
        bar,

        pub const foo: u8 = 4;
        pub const qux: u8 = 7;
    };
    std.log.warn("{}", .{E.foo});
}
❯ zig test test.zig
Test [1/1] test_0... [default] (warn): 4
All 1 tests passed.

Expected Behavior

compile error saying E.foo is ambiguous.
E.bar accesses field
E.qux accesses decl

@nektro nektro added the bug Observed behavior contradicts documented or intended behavior label May 14, 2024
@Vexu
Copy link
Member

Vexu commented May 19, 2024

Solution for this covered in this accepted proposal #959 (comment)

@Vexu Vexu closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
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
Projects
None yet
Development

No branches or pull requests

2 participants