mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 20:42:01 +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:
+16
-16
@@ -8,87 +8,87 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/impl/fail_impl.carbon
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:10: error(ImplExpectedAs): expected `as` in `impl` declaration
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:10: error: expected `as` in `impl` declaration [ImplExpectedAs]
|
||||
// CHECK:STDERR: impl foo bar;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
impl foo bar;
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:12: error(ExpectedExpr): expected expression
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:12: error: expected expression [ExpectedExpr]
|
||||
// CHECK:STDERR: impl i32 as;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
impl i32 as;
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:18: error(ExpectedDeclSemiOrDefinition): `impl` declarations must either end with a `;` or have a `{ ... }` block for a definition
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:18: error: `impl` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition]
|
||||
// CHECK:STDERR: impl bool as bar unexpected;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
impl bool as bar unexpected;
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:6: error(ExpectedExpr): expected expression
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:6: error: expected expression [ExpectedExpr]
|
||||
// CHECK:STDERR: impl return as A;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
impl return as A;
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:6: error(ExpectedExpr): expected expression
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:6: error: expected expression [ExpectedExpr]
|
||||
// CHECK:STDERR: impl return B;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR:
|
||||
impl return B;
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+8]]:13: error(ImplExpectedAfterForall): expected `[` after `forall` in `impl` declaration
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+8]]:13: error: expected `[` after `forall` in `impl` declaration [ImplExpectedAfterForall]
|
||||
// CHECK:STDERR: impl forall f32;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:16: error(ImplExpectedAs): expected `as` in `impl` declaration
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:16: error: expected `as` in `impl` declaration [ImplExpectedAs]
|
||||
// CHECK:STDERR: impl forall f32;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
impl forall f32;
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:19: error(ImplExpectedAs): expected `as` in `impl` declaration
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:19: error: expected `as` in `impl` declaration [ImplExpectedAs]
|
||||
// CHECK:STDERR: impl forall [] u32;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
impl forall [] u32;
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+8]]:21: error(ExpectedBindingPattern): expected `:` or `:!` in binding pattern
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+8]]:21: error: expected `:` or `:!` in binding pattern [ExpectedBindingPattern]
|
||||
// CHECK:STDERR: impl forall [invalid] i8;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:25: error(ImplExpectedAs): expected `as` in `impl` declaration
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:25: error: expected `as` in `impl` declaration [ImplExpectedAs]
|
||||
// CHECK:STDERR: impl forall [invalid] i8;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
impl forall [invalid] i8;
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:13: error(ImplExpectedAfterForall): expected `[` after `forall` in `impl` declaration
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:13: error: expected `[` after `forall` in `impl` declaration [ImplExpectedAfterForall]
|
||||
// CHECK:STDERR: impl forall f16 as Quux;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
impl forall f16 as Quux;
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:30: error(ImplExpectedAs): expected `as` in `impl` declaration
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:30: error: expected `as` in `impl` declaration [ImplExpectedAs]
|
||||
// CHECK:STDERR: impl forall [T:! type] String;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
impl forall [T:! type] String;
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:26: error(ImplExpectedAs): expected `as` in `impl` declaration
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:26: error: expected `as` in `impl` declaration [ImplExpectedAs]
|
||||
// CHECK:STDERR: impl forall [T:! type] T missing_as;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
impl forall [T:! type] T missing_as;
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:39: error(ExpectedDeclSemiOrDefinition): `impl` declarations must either end with a `;` or have a `{ ... }` block for a definition
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:39: error: `impl` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition]
|
||||
// CHECK:STDERR: impl forall [T:! type] T as Interface extra;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR:
|
||||
impl forall [T:! type] T as Interface extra;
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:5: error(ExpectedExpr): expected expression
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:5: error: expected expression [ExpectedExpr]
|
||||
// CHECK:STDERR: impl;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
@@ -96,7 +96,7 @@ impl;
|
||||
|
||||
impl
|
||||
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+88]]:21: error(ExpectedExpr): expected expression
|
||||
// CHECK:STDERR: fail_impl.carbon:[[@LINE+88]]:21: error: expected expression [ExpectedExpr]
|
||||
// CHECK:STDERR: // CHECK:STDOUT: ]
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDOUT: - filename: fail_impl.carbon
|
||||
|
||||
@@ -18,7 +18,7 @@ impl bool as Interface {
|
||||
fn F();
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_out_of_line_member.carbon:[[@LINE+4]]:4: error(ExpectedDeclName): `fn` introducer should be followed by a name
|
||||
// CHECK:STDERR: fail_out_of_line_member.carbon:[[@LINE+4]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
|
||||
// CHECK:STDERR: fn (bool as Interface).F() {}
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
@@ -30,7 +30,7 @@ class C {
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK:STDERR: fail_out_of_line_member.carbon:[[@LINE+3]]:6: error(ExpectedDeclNameAfterPeriod): `.` should be followed by a name
|
||||
// CHECK:STDERR: fail_out_of_line_member.carbon:[[@LINE+3]]:6: error: `.` should be followed by a name [ExpectedDeclNameAfterPeriod]
|
||||
// CHECK:STDERR: fn C.(Self as Interface).F() {}
|
||||
// CHECK:STDERR: ^
|
||||
fn C.(Self as Interface).F() {}
|
||||
|
||||
Reference in New Issue
Block a user