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

@unionInit should get its type from its result location #19377

Open
nektro opened this issue Mar 21, 2024 · 1 comment
Open

@unionInit should get its type from its result location #19377

nektro opened this issue Mar 21, 2024 · 1 comment
Labels
frontend Tokenization, parsing, AstGen, Sema, and Liveness. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone

Comments

@nektro
Copy link
Contributor

nektro commented Mar 21, 2024

Zig Version

0.12.0-dev.3381+7057bffc1

Steps to Reproduce and Observed Behavior

@unionInit(comptime Union: type, comptime active_field_name: []const u8, init_expr) Union

Expected Behavior

@unionInit(comptime active_field_name: []const u8, init_expr) Union
const U = union(enum) {
    a: u32,
    b: u16,
    c: u64,
};

test {
    const x: U = @unionInit("a", 0);
    _ = x;
}

natural continuation of #5909

@nektro nektro added the bug Observed behavior contradicts documented or intended behavior label Mar 21, 2024
@xdBronch
Copy link
Contributor

also meshes well with WIP changes to make @fieldParentPtr do the same

@Vexu Vexu added the frontend Tokenization, parsing, AstGen, Sema, and Liveness. label Mar 21, 2024
@Vexu Vexu added this to the 0.13.0 milestone Mar 21, 2024
@Vexu Vexu added enhancement Solving this issue will likely involve adding new logic or components to the codebase. and removed bug Observed behavior contradicts documented or intended behavior labels Mar 21, 2024
@mlugg mlugg added proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. and removed enhancement Solving this issue will likely involve adding new logic or components to the codebase. labels Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Tokenization, parsing, AstGen, Sema, and Liveness. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned.
Projects
None yet
Development

No branches or pull requests

4 participants