File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -286,7 +286,7 @@ const Parser = struct {
286286 .keyword_comptime = > switch (p .token_tags [p .tok_i + 1 ]) {
287287 .l_brace = > {
288288 if (doc_comment ) | some | {
289- try p .warnMsg (.{ .tag = .test_doc_comment , .token = some });
289+ try p .warnMsg (.{ .tag = .comptime_doc_comment , .token = some });
290290 }
291291 const comptime_token = p .nextToken ();
292292 const block = p .parseBlock () catch | err | switch (err ) {
Original file line number Diff line number Diff line change @@ -4210,6 +4210,18 @@ test "zig fmt: remove newlines surrounding doc comment within container decl" {
42104210 );
42114211}
42124212
4213+ test "zig fmt: invalid else branch statement" {
4214+ try testError (
4215+ \\/// This is a doc comment for a comptime block.
4216+ \\comptime {}
4217+ \\/// This is a doc comment for a test
4218+ \\test "This is my test" {}
4219+ , &[_ ]Error {
4220+ .comptime_doc_comment ,
4221+ .test_doc_comment ,
4222+ });
4223+ }
4224+
42134225test "zig fmt: invalid else branch statement" {
42144226 try testError (
42154227 \\comptime {
You can’t perform that action at this time.
0 commit comments