mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
make error messages prettier
Error messages never contain periods or grave accents. Get rid of the periods and use apostrophes instead in probably the only two error messages that had them.
This commit is contained in:
parent
08d534e8d8
commit
56fad6a195
4 changed files with 7 additions and 7 deletions
|
|
@ -323,7 +323,7 @@ pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void {
|
|||
.asterisk_after_ptr_deref => {
|
||||
// Note that the token will point at the `.*` but ideally the source
|
||||
// location would point to the `*` after the `.*`.
|
||||
return stream.writeAll("'.*' cannot be followed by '*'. Are you missing a space?");
|
||||
return stream.writeAll("'.*' cannot be followed by '*'; are you missing a space?");
|
||||
},
|
||||
.chained_comparison_operators => {
|
||||
return stream.writeAll("comparison operators cannot be chained");
|
||||
|
|
@ -526,7 +526,7 @@ pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void {
|
|||
return stream.writeAll("expected field initializer");
|
||||
},
|
||||
.mismatched_binary_op_whitespace => {
|
||||
return stream.print("binary operator `{s}` has whitespace on one side, but not the other.", .{tree.tokenTag(parse_error.token).lexeme().?});
|
||||
return stream.print("binary operator '{s}' has whitespace on one side, but not the other", .{tree.tokenTag(parse_error.token).lexeme().?});
|
||||
},
|
||||
.invalid_ampersand_ampersand => {
|
||||
return stream.writeAll("ambiguous use of '&&'; use 'and' for logical AND, or change whitespace to ' & &' for bitwise AND");
|
||||
|
|
|
|||
|
|
@ -4299,12 +4299,12 @@ fn fnDeclInner(
|
|||
&[_]u32{
|
||||
try astgen.errNoteNode(
|
||||
type_expr,
|
||||
"if this is a name, annotate its type '{s}: T'",
|
||||
"if this is a name, annotate its type: '{s}: T'",
|
||||
.{identifier_str},
|
||||
),
|
||||
try astgen.errNoteNode(
|
||||
type_expr,
|
||||
"if this is a type, give it a name '<name>: {s}'",
|
||||
"if this is a type, give it a name: 'name: {s}'",
|
||||
.{identifier_str},
|
||||
),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ fn foo() void {
|
|||
// backend=stage2
|
||||
// target=native
|
||||
//
|
||||
// :2:28: error: '.*' cannot be followed by '*'. Are you missing a space?
|
||||
// :2:28: error: '.*' cannot be followed by '*'; are you missing a space?
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@ fn f1(x) u64 {
|
|||
// :1:7: error: missing parameter name
|
||||
// :4:7: error: missing parameter name
|
||||
// :7:7: error: missing parameter name or type
|
||||
// :7:7: note: if this is a name, annotate its type 'x: T'
|
||||
// :7:7: note: if this is a type, give it a name '<name>: x'
|
||||
// :7:7: note: if this is a name, annotate its type: 'x: T'
|
||||
// :7:7: note: if this is a type, give it a name: 'name: x'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue