| ... | ... | @@ -6056,6 +6056,25 @@ test "zig fmt: indentation of comments within catch, else, orelse" { |
| 6056 | 6056 | ); |
| 6057 | 6057 | } |
| 6058 | 6058 | |
| 6059 | test "zig fmt: canonicalize cast builtins" { |
| 6060 | try testTransform( |
| 6061 | \\const foo = @alignCast(@ptrCast(bar)); |
| 6062 | \\const baz = @constCast(@ptrCast(@addrSpaceCast(@volatileCast(@alignCast(bar))))); |
| 6063 | \\ |
| 6064 | , |
| 6065 | \\const foo = @ptrCast(@alignCast(bar)); |
| 6066 | \\const baz = @ptrCast(@alignCast(@addrSpaceCast(@constCast(@volatileCast(bar))))); |
| 6067 | \\ |
| 6068 | ); |
| 6069 | } |
| 6070 | |
| 6071 | test "zig fmt: do not canonicalize invalid cast builtins" { |
| 6072 | try testCanonical( |
| 6073 | \\const foo = @alignCast(@volatileCast(@ptrCast(@alignCast(bar)))); |
| 6074 | \\ |
| 6075 | ); |
| 6076 | } |
| 6077 | |
| 6059 | 6078 | test "recovery: top level" { |
| 6060 | 6079 | try testError( |
| 6061 | 6080 | \\test "" {inline} |