Commit 014009a730
Changed files (2)
lib
std
lib/std/zig/parse.zig
@@ -286,7 +286,7 @@ const Parser = struct {
.keyword_comptime => switch (p.token_tags[p.tok_i + 1]) {
.l_brace => {
if (doc_comment) |some| {
- try p.warnMsg(.{ .tag = .test_doc_comment, .token = some });
+ try p.warnMsg(.{ .tag = .comptime_doc_comment, .token = some });
}
const comptime_token = p.nextToken();
const block = p.parseBlock() catch |err| switch (err) {
lib/std/zig/parser_test.zig
@@ -4210,6 +4210,18 @@ test "zig fmt: remove newlines surrounding doc comment within container decl" {
);
}
+test "zig fmt: invalid else branch statement" {
+ try testError(
+ \\/// This is a doc comment for a comptime block.
+ \\comptime {}
+ \\/// This is a doc comment for a test
+ \\test "This is my test" {}
+ , &[_]Error{
+ .comptime_doc_comment,
+ .test_doc_comment,
+ });
+}
+
test "zig fmt: invalid else branch statement" {
try testError(
\\comptime {