Skip to content

zig fmt fails to canonicalize @ptrCast and @alignCast #24106

Open
@andrewrk

Description

@andrewrk

Zig Version

0.15.0-dev.699+2543e2d97

Steps to Reproduce and Observed Behavior

pub fn example() void {
    const x: bool = @ptrCast(@alignCast(1));
    const y: bool = @alignCast(@ptrCast(1));
    _ = x;
    _ = y;
}
zig fmt test.zig

does nothing

Expected Behavior

Expected zig fmt to rewrite the file to either:

pub fn example() void {
    const x: bool = @ptrCast(@alignCast(1));
    const y: bool = @ptrCast(@alignCast(1));
    _ = x;
    _ = y;
}

or

pub fn example() void {
    const x: bool = @alignCast(@ptrCast(1));
    const y: bool = @alignCast(@ptrCast(1));
    _ = x;
    _ = y;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.zig fmt

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions