-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.zig fmt
Milestone
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
.)
rohlem
Metadata
Metadata
Assignees
Labels
frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.zig fmt