-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior
Description
Zig Version
0.15.0-dev.451+a843be44a
Steps to Reproduce and Observed Behavior
Run zig fmt on the following code,
const A = union(enum(u32)) {
//! Hello World!
};It incorrectly formats it to
const A = union(enum(u32)) {
//! Hello World!
//! Hello World!This applies to packed struct(T), union(T), union(enum(T)), and enum(T)
This happens since Ast.lastToken assumes that when these have no members, the only following tokens are ){}. This also means the bug may also observable in other parts of the compiler, but it is easiest to observe with zig fmt.
Expected Behavior
No change.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior