Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/langref/invalid_doc-comment.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
//! top-level doc-comment
const std = @import("std");

// obj=expected type expression, found 'a document comment'
// obj=expected type expression, found 'a top-level document comment'
3 changes: 2 additions & 1 deletion lib/std/zig/tokenizer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ pub const Token = struct {
.eof => "EOF",
.builtin => "a builtin function",
.number_literal => "a number literal",
.doc_comment, .container_doc_comment => "a document comment",
.doc_comment => "a document comment",
.container_doc_comment => "a top-level document comment",
else => unreachable,
};
}
Expand Down
2 changes: 1 addition & 1 deletion lib/std/zon/parse.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ test "std.zon comments" {
\\// comment
, &diag, .{}));
try std.testing.expectFmt(
"1:1: error: expected expression, found 'a document comment'\n",
"1:1: error: expected expression, found 'a top-level document comment'\n",
"{f}",
.{diag},
);
Expand Down
2 changes: 1 addition & 1 deletion test/cases/compile_errors/@import_zon_doc_comment.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export fn entry() void {
// error
// imports=zon/doc_comment.zon
//
// doc_comment.zon:1:1: error: expected expression, found 'a document comment'
// doc_comment.zon:1:1: error: expected expression, found 'a top-level document comment'
8 changes: 8 additions & 0 deletions test/cases/compile_errors/top_level_doc_comment.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pub const foo = 5;

//! This is main.
pub fn main() void {}

// error
//
// 1:19: error: expected type expression, found 'a top-level document comment'