-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
zig ast-check
produces an error on well-formed build.zig.zon
files
#22078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
|
While I agree that zon files are indeed not strictly zig files, I think it's pretty reasonable to expect zig's tooling to work with the family of zig file formats. Please see the note about This is a "regression" of the previous behavior (i.e. this error is not produced by zig 0.13 or some earlier versions of 0.14-dev). It seems very likely this was a side effect of #21817, but I haven't attempted to bisect it to prove that. |
This works around ziglang/zig#22078 (the ast-check behavior changed since the last successful CI run). Since we build as part of the job, this check isn't really necessary anyway, though it certainly is lighter-weight than trying to compile.
@mlugg would you mind taking a look at this? It's causing damage in the ecosystem which you can see above with the referenced commit "remove --ast-check from zig format". We don't want people to do that. It's definitely a regression from previous behavior: |
@andrewrk Sure thing, I'll take a look tomorrow (just heading to bed). The reason this is happening is because The obvious thing is that ZON files shouldn't go through |
Currently, `zig ast-check` fails on ZON files, because it tries to interpret the file as Zig source code. This commit introduces a new verification pass, `std.zig.ZonGen`, which applies to an AST in ZON mode. Like `AstGen`, this pass also converts the AST into a more helpful format. Rather than a sequence of instructions like `Zir`, the output format of `ZonGen` is a new datastructure called `Zoir`. This type is essentially a simpler form of AST, containing only the information required for consumers of ZON. It is also far more compact than `std.zig.Ast`, with the size generally being comparable to the size of the well-formatted source file. The emitted `Zoir` is currently not used aside from the `-t` option to `ast-check` which causes it to be dumped to stdout. However, in future, it can be used for comptime `@import` of ZON files, as well as for simpler handling of files like `build.zig.zon`, and even by other parts of the Zig Standard Library. Resolves: ziglang#22078
Currently, `zig ast-check` fails on ZON files, because it tries to interpret the file as Zig source code. This commit introduces a new verification pass, `std.zig.ZonGen`, which applies to an AST in ZON mode. Like `AstGen`, this pass also converts the AST into a more helpful format. Rather than a sequence of instructions like `Zir`, the output format of `ZonGen` is a new datastructure called `Zoir`. This type is essentially a simpler form of AST, containing only the information required for consumers of ZON. It is also far more compact than `std.zig.Ast`, with the size generally being comparable to the size of the well-formatted source file. The emitted `Zoir` is currently not used aside from the `-t` option to `ast-check` which causes it to be dumped to stdout. However, in future, it can be used for comptime `@import` of ZON files, as well as for simpler handling of files like `build.zig.zon`, and even by other parts of the Zig Standard Library. Resolves: ziglang#22078
Currently, `zig ast-check` fails on ZON files, because it tries to interpret the file as Zig source code. This commit introduces a new verification pass, `std.zig.ZonGen`, which applies to an AST in ZON mode. Like `AstGen`, this pass also converts the AST into a more helpful format. Rather than a sequence of instructions like `Zir`, the output format of `ZonGen` is a new datastructure called `Zoir`. This type is essentially a simpler form of AST, containing only the information required for consumers of ZON. It is also far more compact than `std.zig.Ast`, with the size generally being comparable to the size of the well-formatted source file. The emitted `Zoir` is currently not used aside from the `-t` option to `ast-check` which causes it to be dumped to stdout. However, in future, it can be used for comptime `@import` of ZON files, as well as for simpler handling of files like `build.zig.zon`, and even by other parts of the Zig Standard Library. Resolves: ziglang#22078
Zig Version
0.14.0-dev.2293+6d781e095
Steps to Reproduce and Observed Behavior
on a well-formed
build.zig.zon
(such as the one in this repository), instead of succeeding, produces the following error messageThis also happens with
zig fmt --ast-check
and is likely to be hit if you try to run that on all files in a project with e.g.zig fmt --ast-check --check .
Expected Behavior
zig should not disagree with itself about whether the structure of
build.zig.zon
is correct.The text was updated successfully, but these errors were encountered: