Update basic diagnostic capitalization/punctuation (#4328)

This is a primarily automated change:

- Search & replace for capitalization
-
`(CARBON_DIAGNOSTIC\((?:\n\s+)?\w+,(?:\n\s+)?\s\w+,(?:\n\s+)?\s")([A-Z])`
    - `$1\L$2`
- Search & replace for period
-
`(CARBON_DIAGNOSTIC\((?:\n\s+)?\w+,(?:\n\s+)?\s\w+,(?:\n\s+)?\s"(?:[^)]|\n)+)\.("[,)])`
    - `$1$2`
- Limited search & replace for `ERROR: ` -> `error: ` in streamed things
- Leaving a TODO for command_line because there's more cleanup that can
be done there
- Modify diagnostic_consumer.cpp
    - ERROR -> error
    - WARNING -> warning

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
Jon Ross-Perkins
2024-09-19 21:32:53 +00:00
committed by GitHub
co-authored by Richard Smith
parent 7f6d684b29
commit e7aebbe581
578 changed files with 2166 additions and 2173 deletions
@@ -9,16 +9,16 @@
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_address_of_error.carbon
fn Test() {
// CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+4]]:4: ERROR: Name `undeclared` not found.
// CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+4]]:4: error: name `undeclared` not found
// CHECK:STDERR: &undeclared;
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR:
&undeclared;
// CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+7]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+7]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &(&undeclared);
// CHECK:STDERR: ^
// CHECK:STDERR:
// CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+3]]:6: ERROR: Name `undeclared` not found.
// CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+3]]:6: error: name `undeclared` not found
// CHECK:STDERR: &(&undeclared);
// CHECK:STDERR: ^~~~~~~~~~
&(&undeclared);
+14 -14
View File
@@ -13,32 +13,32 @@ fn G() -> i32;
fn H() -> {.a: i32};
fn AddressOfLiteral() {
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &0;
// CHECK:STDERR: ^
// CHECK:STDERR:
&0;
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &true;
// CHECK:STDERR: ^
// CHECK:STDERR:
&true;
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &1.0;
// CHECK:STDERR: ^
// CHECK:STDERR:
&1.0;
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &"Hello";
// CHECK:STDERR: ^
// CHECK:STDERR:
&"Hello";
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &(1, 2);
// CHECK:STDERR: ^
// CHECK:STDERR:
&(1, 2);
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &{.a = 5};
// CHECK:STDERR: ^
// CHECK:STDERR:
@@ -46,17 +46,17 @@ fn AddressOfLiteral() {
}
fn AddressOfOperator() {
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &(true and false);
// CHECK:STDERR: ^
// CHECK:STDERR:
&(true and false);
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of a temporary object.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of a temporary object
// CHECK:STDERR: &H().a;
// CHECK:STDERR: ^
// CHECK:STDERR:
&H().a;
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &(not true);
// CHECK:STDERR: ^
// CHECK:STDERR:
@@ -64,7 +64,7 @@ fn AddressOfOperator() {
}
fn AddressOfCall() {
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &G();
// CHECK:STDERR: ^
// CHECK:STDERR:
@@ -72,12 +72,12 @@ fn AddressOfCall() {
}
fn AddressOfType() {
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &i32;
// CHECK:STDERR: ^
// CHECK:STDERR:
&i32;
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &(const i32*);
// CHECK:STDERR: ^
// CHECK:STDERR:
@@ -85,7 +85,7 @@ fn AddressOfType() {
}
fn AddressOfTupleElementValue() {
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+4]]:3: error: cannot take the address of non-reference expression
// CHECK:STDERR: &((1, 2).0);
// CHECK:STDERR: ^
// CHECK:STDERR:
@@ -93,7 +93,7 @@ fn AddressOfTupleElementValue() {
}
fn AddressOfParam(param: i32) {
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+3]]:26: ERROR: Cannot take the address of non-reference expression.
// CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+3]]:26: error: cannot take the address of non-reference expression
// CHECK:STDERR: var param_addr: i32* = &param;
// CHECK:STDERR: ^
var param_addr: i32* = &param;
+2 -2
View File
@@ -8,12 +8,12 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_error.carbon
// CHECK:STDERR: fail_deref_error.carbon:[[@LINE+4]]:15: ERROR: Name `undeclared` not found.
// CHECK:STDERR: fail_deref_error.carbon:[[@LINE+4]]:15: error: name `undeclared` not found
// CHECK:STDERR: let n: i32 = *undeclared;
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR:
let n: i32 = *undeclared;
// CHECK:STDERR: fail_deref_error.carbon:[[@LINE+3]]:15: ERROR: Name `undeclared` not found.
// CHECK:STDERR: fail_deref_error.carbon:[[@LINE+3]]:15: error: name `undeclared` not found
// CHECK:STDERR: let n2: i32 = undeclared->foo;
// CHECK:STDERR: ^~~~~~~~~~
let n2: i32 = undeclared->foo;
@@ -9,12 +9,12 @@
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_function.carbon
fn A() {
// CHECK:STDERR: fail_deref_function.carbon:[[@LINE+4]]:4: ERROR: Expression cannot be used as a value.
// CHECK:STDERR: fail_deref_function.carbon:[[@LINE+4]]:4: error: expression cannot be used as a value
// CHECK:STDERR: *A;
// CHECK:STDERR: ^
// CHECK:STDERR:
*A;
// CHECK:STDERR: fail_deref_function.carbon:[[@LINE+3]]:3: ERROR: Expression cannot be used as a value.
// CHECK:STDERR: fail_deref_function.carbon:[[@LINE+3]]:3: error: expression cannot be used as a value
// CHECK:STDERR: A->foo;
// CHECK:STDERR: ^
A->foo;
@@ -11,12 +11,12 @@
namespace A;
fn F() {
// CHECK:STDERR: fail_deref_namespace.carbon:[[@LINE+4]]:4: ERROR: Expression cannot be used as a value.
// CHECK:STDERR: fail_deref_namespace.carbon:[[@LINE+4]]:4: error: expression cannot be used as a value
// CHECK:STDERR: *A;
// CHECK:STDERR: ^
// CHECK:STDERR:
*A;
// CHECK:STDERR: fail_deref_namespace.carbon:[[@LINE+3]]:3: ERROR: Expression cannot be used as a value.
// CHECK:STDERR: fail_deref_namespace.carbon:[[@LINE+3]]:3: error: expression cannot be used as a value
// CHECK:STDERR: A->foo;
// CHECK:STDERR: ^
A->foo;
@@ -9,32 +9,32 @@
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon
fn Deref(n: i32) {
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:3: ERROR: Cannot dereference operand of non-pointer type `i32`.
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:3: error: cannot dereference operand of non-pointer type `i32`
// CHECK:STDERR: *n;
// CHECK:STDERR: ^
// CHECK:STDERR:
*n;
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:4: ERROR: Cannot apply `->` operator to non-pointer type `i32`.
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:4: error: cannot apply `->` operator to non-pointer type `i32`
// CHECK:STDERR: n->foo;
// CHECK:STDERR: ^~
// CHECK:STDERR:
n->foo;
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:3: ERROR: Cannot dereference operand of non-pointer type `()`.
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:3: error: cannot dereference operand of non-pointer type `()`
// CHECK:STDERR: *();
// CHECK:STDERR: ^
// CHECK:STDERR:
*();
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:5: ERROR: Cannot apply `->` operator to non-pointer type `()`.
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:5: error: cannot apply `->` operator to non-pointer type `()`
// CHECK:STDERR: ()->foo;
// CHECK:STDERR: ^~
// CHECK:STDERR:
()->foo;
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:3: ERROR: Cannot dereference operand of non-pointer type `{}`.
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:3: error: cannot dereference operand of non-pointer type `{}`
// CHECK:STDERR: *{};
// CHECK:STDERR: ^
// CHECK:STDERR:
*{};
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+3]]:5: ERROR: Cannot apply `->` operator to non-pointer type `{}`.
// CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+3]]:5: error: cannot apply `->` operator to non-pointer type `{}`
// CHECK:STDERR: {}->foo;
// CHECK:STDERR: ^~
{}->foo;
+3 -3
View File
@@ -8,15 +8,15 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_type.carbon
// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+7]]:8: ERROR: Cannot dereference operand of non-pointer type `type`.
// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+7]]:8: error: cannot dereference operand of non-pointer type `type`
// CHECK:STDERR: var p: *i32;
// CHECK:STDERR: ^
// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+4]]:8: To form a pointer type, write the `*` after the pointee type.
// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+4]]:8: to form a pointer type, write the `*` after the pointee type
// CHECK:STDERR: var p: *i32;
// CHECK:STDERR: ^
// CHECK:STDERR:
var p: *i32;
// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+3]]:12: ERROR: Cannot apply `->` operator to non-pointer type `type`.
// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+3]]:12: error: cannot apply `->` operator to non-pointer type `type`
// CHECK:STDERR: var p2: i32->foo;
// CHECK:STDERR: ^~
var p2: i32->foo;
+2 -2
View File
@@ -9,10 +9,10 @@
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_type_mismatch.carbon
fn ConstMismatch(p: const {}*) -> const ({}*) {
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+6]]:3: ERROR: Cannot implicitly convert from `const {}*` to `const ({}*)`.
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+6]]:3: error: cannot implicitly convert from `const {}*` to `const ({}*)`
// CHECK:STDERR: return p;
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:3: Type `const {}*` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:3: type `const {}*` does not implement interface `ImplicitAs`
// CHECK:STDERR: return p;
// CHECK:STDERR: ^~~~~~~~~
return p;