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

zig fmt: lossy switch #11131

Closed
nektro opened this issue Mar 12, 2022 · 0 comments
Closed

zig fmt: lossy switch #11131

nektro opened this issue Mar 12, 2022 · 0 comments
Labels
bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. zig fmt
Milestone

Comments

@nektro
Copy link
Contributor

nektro commented Mar 12, 2022

Zig Version

0.10.0-dev.1253+86a98b172

Steps to Reproduce

const std = @import("std");

const E = enum { a, b };

pub fn main() !void {
    var e = E.a;
    switch (e) {
        .a,
        // .b,
        => {},
    }
}

Expected Behavior

No change.

Actual Behavior

const std = @import("std");

const E = enum { a, b };

pub fn main() !void {
    var e = E.a;
    switch (e) {
        .a => {},
    }
}
@nektro nektro added the bug Observed behavior contradicts documented or intended behavior label Mar 12, 2022
@Vexu Vexu added contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. zig fmt labels Mar 12, 2022
@Vexu Vexu added this to the 0.10.0 milestone Mar 12, 2022
tiehuis pushed a commit to tiehuis/zig that referenced this issue Mar 19, 2022
Correct switch cases dropping comments in certain situations by
checking for the presence of the comment before collapsing to one line.
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 contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. zig fmt
Projects
None yet
Development

No branches or pull requests

2 participants