mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Move diagnostic kind name to the end of the diagnostic. (#4437)
Also surround it in square brackets rather than parentheses. This matches the format used by Clang and GCC, and means diagnostics will still match the `file:line:col: error: ` pattern used by some IDE tools. Before: ```console fail_builtins.carbon:11:11: error(AliasRequiresNameRef): alias initializer must be a name reference ``` After: ```console fail_builtins.carbon:11:11: error: alias initializer must be a name reference [AliasRequiresNameRef] ``` Also tighten up test regex to only match on `STDERR` lines that list a file name.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
fn F() {
|
||||
return x
|
||||
// CHECK:STDERR: fail_expr_no_semi.carbon:[[@LINE+3]]:1: error(ExpectedStatementSemi): `return` statements must end with a `;`
|
||||
// CHECK:STDERR: fail_expr_no_semi.carbon:[[@LINE+3]]:1: error: `return` statements must end with a `;` [ExpectedStatementSemi]
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
}
|
||||
|
||||
+2
-2
@@ -10,11 +10,11 @@
|
||||
|
||||
fn F() {
|
||||
return
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+7]]:1: error(ExpectedExpr): expected expression
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+7]]:1: error: expected expression [ExpectedExpr]
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+3]]:1: error(ExpectedStatementSemi): `return` statements must end with a `;`
|
||||
// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+3]]:1: error: `return` statements must end with a `;` [ExpectedStatementSemi]
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/return/fail_returned_no_var.carbon
|
||||
|
||||
fn F() -> String {
|
||||
// CHECK:STDERR: fail_returned_no_var.carbon:[[@LINE+3]]:12: error(ExpectedVarAfterReturned): expected `var` after `returned`
|
||||
// CHECK:STDERR: fail_returned_no_var.carbon:[[@LINE+3]]:12: error: expected `var` after `returned` [ExpectedVarAfterReturned]
|
||||
// CHECK:STDERR: returned fn G() -> i32;
|
||||
// CHECK:STDERR: ^~
|
||||
returned fn G() -> i32;
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
fn F() {
|
||||
return var
|
||||
// CHECK:STDERR: fail_var_no_semi.carbon:[[@LINE+3]]:1: error(ExpectedStatementSemi): `return` statements must end with a `;`
|
||||
// CHECK:STDERR: fail_var_no_semi.carbon:[[@LINE+3]]:1: error: `return` statements must end with a `;` [ExpectedStatementSemi]
|
||||
// CHECK:STDERR: }
|
||||
// CHECK:STDERR: ^
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user