Open
Description
Zig Version
0.12.0-dev.5+fc6e57568
Steps to Reproduce and Observed Behavior
$ echo 'const A = enum { @"_", _ }; const B = union(enum) { @"_", _ };' > test.zig
$ zig fmt test.zig
test.zig
$ cat test.zig
const A = enum { @"_", _ };
const B = union(enum) { _, _ };
Expected Behavior
I expected zig fmt to treat @"_"
in enum
and union(enum)
the same:
const A = enum { @"_", _ };
const B = union(enum) { @"_", _ };
The behavior was changed for enums in #15617 (cc @jacobly0).
(Although this seems like an obscure corner case, it actually matters for my project. I'm writing a Markdown parser, and enjoy naming my token variants like .@"* * *"
instead of e.g. .thematic_break
, since that's a needless extra mapping you have to keep in your head. So I want to use .@"_"
, not .emphasis
.)