mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:24:42 +01:00
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:
co-authored by
Richard Smith
parent
7f6d684b29
commit
e7aebbe581
@@ -77,7 +77,7 @@ auto HandleParseNode(Context& context, Parse::InfixOperatorEqualId node_id)
|
||||
lhs_cat != SemIR::ExprCategory::DurableRef &&
|
||||
lhs_cat != SemIR::ExprCategory::Error) {
|
||||
CARBON_DIAGNOSTIC(AssignmentToNonAssignable, Error,
|
||||
"Expression is not assignable.");
|
||||
"expression is not assignable");
|
||||
context.emitter().Emit(lhs_node, AssignmentToNonAssignable);
|
||||
}
|
||||
// TODO: Destroy the old value before reinitializing. This will require
|
||||
@@ -231,13 +231,13 @@ auto HandleParseNode(Context& context, Parse::PrefixOperatorAmpId node_id)
|
||||
break;
|
||||
case SemIR::ExprCategory::EphemeralRef:
|
||||
CARBON_DIAGNOSTIC(AddrOfEphemeralRef, Error,
|
||||
"Cannot take the address of a temporary object.");
|
||||
"cannot take the address of a temporary object");
|
||||
context.emitter().Emit(TokenOnly(node_id), AddrOfEphemeralRef);
|
||||
value_id = SemIR::InstId::BuiltinError;
|
||||
break;
|
||||
default:
|
||||
CARBON_DIAGNOSTIC(AddrOfNonRef, Error,
|
||||
"Cannot take the address of non-reference expression.");
|
||||
"cannot take the address of non-reference expression");
|
||||
context.emitter().Emit(TokenOnly(node_id), AddrOfNonRef);
|
||||
value_id = SemIR::InstId::BuiltinError;
|
||||
break;
|
||||
@@ -263,7 +263,7 @@ auto HandleParseNode(Context& context, Parse::PrefixOperatorConstId node_id)
|
||||
if (context.insts().Get(value_id).kind() == SemIR::ConstType::Kind) {
|
||||
CARBON_DIAGNOSTIC(RepeatedConst, Warning,
|
||||
"`const` applied repeatedly to the same type has no "
|
||||
"additional effect.");
|
||||
"additional effect");
|
||||
context.emitter().Emit(node_id, RepeatedConst);
|
||||
}
|
||||
auto inner_type_id = ExprAsType(context, node_id, value_id);
|
||||
@@ -306,7 +306,7 @@ auto HandleParseNode(Context& context, Parse::PrefixOperatorStarId node_id)
|
||||
[&context, &node_id](SemIR::TypeId not_pointer_type_id) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
DerefOfNonPointer, Error,
|
||||
"Cannot dereference operand of non-pointer type `{0}`.",
|
||||
"cannot dereference operand of non-pointer type `{0}`",
|
||||
SemIR::TypeId);
|
||||
|
||||
auto builder = context.emitter().Build(
|
||||
@@ -316,7 +316,7 @@ auto HandleParseNode(Context& context, Parse::PrefixOperatorStarId node_id)
|
||||
if (not_pointer_type_id == SemIR::TypeId::TypeType) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
DerefOfType, Note,
|
||||
"To form a pointer type, write the `*` after the pointee type.");
|
||||
"to form a pointer type, write the `*` after the pointee type");
|
||||
builder.Note(TokenOnly(node_id), DerefOfType);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user