mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +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
+14
-18
@@ -70,8 +70,7 @@ Context::Context(const Lex::TokenizedBuffer& tokens, DiagnosticEmitter& emitter,
|
||||
}
|
||||
|
||||
auto Context::TODO(SemIRLoc loc, std::string label) -> bool {
|
||||
CARBON_DIAGNOSTIC(SemanticsTodo, Error, "Semantics TODO: `{0}`.",
|
||||
std::string);
|
||||
CARBON_DIAGNOSTIC(SemanticsTodo, Error, "semantics TODO: `{0}`", std::string);
|
||||
emitter_->Emit(loc, SemanticsTodo, std::move(label));
|
||||
return false;
|
||||
}
|
||||
@@ -202,9 +201,8 @@ auto Context::ReplaceInstBeforeConstantUse(SemIR::InstId inst_id,
|
||||
auto Context::DiagnoseDuplicateName(SemIRLoc dup_def, SemIRLoc prev_def)
|
||||
-> void {
|
||||
CARBON_DIAGNOSTIC(NameDeclDuplicate, Error,
|
||||
"Duplicate name being declared in the same scope.");
|
||||
CARBON_DIAGNOSTIC(NameDeclPrevious, Note,
|
||||
"Name is previously declared here.");
|
||||
"duplicate name being declared in the same scope");
|
||||
CARBON_DIAGNOSTIC(NameDeclPrevious, Note, "name is previously declared here");
|
||||
emitter_->Build(dup_def, NameDeclDuplicate)
|
||||
.Note(prev_def, NameDeclPrevious)
|
||||
.Emit();
|
||||
@@ -212,8 +210,7 @@ auto Context::DiagnoseDuplicateName(SemIRLoc dup_def, SemIRLoc prev_def)
|
||||
|
||||
auto Context::DiagnoseNameNotFound(SemIRLoc loc, SemIR::NameId name_id)
|
||||
-> void {
|
||||
CARBON_DIAGNOSTIC(NameNotFound, Error, "Name `{0}` not found.",
|
||||
SemIR::NameId);
|
||||
CARBON_DIAGNOSTIC(NameNotFound, Error, "name `{0}` not found", SemIR::NameId);
|
||||
emitter_->Emit(loc, NameNotFound, name_id);
|
||||
}
|
||||
|
||||
@@ -223,11 +220,11 @@ auto Context::NoteIncompleteClass(SemIR::ClassId class_id,
|
||||
CARBON_CHECK(!class_info.is_defined(), "Class is not incomplete");
|
||||
if (class_info.definition_id.is_valid()) {
|
||||
CARBON_DIAGNOSTIC(ClassIncompleteWithinDefinition, Note,
|
||||
"Class is incomplete within its definition.");
|
||||
"class is incomplete within its definition");
|
||||
builder.Note(class_info.definition_id, ClassIncompleteWithinDefinition);
|
||||
} else {
|
||||
CARBON_DIAGNOSTIC(ClassForwardDeclaredHere, Note,
|
||||
"Class was forward declared here.");
|
||||
"class was forward declared here");
|
||||
builder.Note(class_info.latest_decl_id(), ClassForwardDeclaredHere);
|
||||
}
|
||||
}
|
||||
@@ -238,12 +235,12 @@ auto Context::NoteUndefinedInterface(SemIR::InterfaceId interface_id,
|
||||
CARBON_CHECK(!interface_info.is_defined(), "Interface is not incomplete");
|
||||
if (interface_info.is_being_defined()) {
|
||||
CARBON_DIAGNOSTIC(InterfaceUndefinedWithinDefinition, Note,
|
||||
"Interface is currently being defined.");
|
||||
"interface is currently being defined");
|
||||
builder.Note(interface_info.definition_id,
|
||||
InterfaceUndefinedWithinDefinition);
|
||||
} else {
|
||||
CARBON_DIAGNOSTIC(InterfaceForwardDeclaredHere, Note,
|
||||
"Interface was forward declared here.");
|
||||
"interface was forward declared here");
|
||||
builder.Note(interface_info.latest_decl_id(), InterfaceForwardDeclaredHere);
|
||||
}
|
||||
}
|
||||
@@ -374,10 +371,10 @@ static auto DiagnoseInvalidQualifiedNameAccess(Context& context, SemIRLoc loc,
|
||||
auto class_info = context.classes().Get(class_type->class_id);
|
||||
|
||||
CARBON_DIAGNOSTIC(ClassInvalidMemberAccess, Error,
|
||||
"Cannot access {0} member `{1}` of type `{2}`.",
|
||||
"cannot access {0} member `{1}` of type `{2}`",
|
||||
SemIR::AccessKind, SemIR::NameId, SemIR::TypeId);
|
||||
CARBON_DIAGNOSTIC(ClassMemberDefinition, Note,
|
||||
"The {0} member `{1}` is defined here.", SemIR::AccessKind,
|
||||
"the {0} member `{1}` is defined here", SemIR::AccessKind,
|
||||
SemIR::NameId);
|
||||
|
||||
auto parent_type_id = class_info.self_type_id;
|
||||
@@ -491,7 +488,7 @@ auto Context::LookupQualifiedName(SemIRLoc loc, SemIR::NameId name_id,
|
||||
// Add test coverage once this is possible.
|
||||
CARBON_DIAGNOSTIC(
|
||||
NameAmbiguousDueToExtend, Error,
|
||||
"Ambiguous use of name `{0}` found in multiple extended scopes.",
|
||||
"ambiguous use of name `{0}` found in multiple extended scopes",
|
||||
SemIR::NameId);
|
||||
emitter_->Emit(loc, NameAmbiguousDueToExtend, name_id);
|
||||
// TODO: Add notes pointing to the scopes.
|
||||
@@ -554,9 +551,8 @@ static auto GetCorePackage(Context& context, SemIRLoc loc)
|
||||
}
|
||||
}
|
||||
|
||||
CARBON_DIAGNOSTIC(
|
||||
CoreNotFound, Error,
|
||||
"Package `Core` implicitly referenced here, but not found.");
|
||||
CARBON_DIAGNOSTIC(CoreNotFound, Error,
|
||||
"package `Core` implicitly referenced here, but not found");
|
||||
context.emitter().Emit(loc, CoreNotFound);
|
||||
return SemIR::NameScopeId::Invalid;
|
||||
}
|
||||
@@ -574,7 +570,7 @@ auto Context::LookupNameInCore(SemIRLoc loc, llvm::StringRef name)
|
||||
if (!inst_id.is_valid()) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
CoreNameNotFound, Error,
|
||||
"Name `Core.{0}` implicitly referenced here, but not found.",
|
||||
"name `Core.{0}` implicitly referenced here, but not found",
|
||||
SemIR::NameId);
|
||||
emitter_->Emit(loc, CoreNameNotFound, name_id);
|
||||
return SemIR::InstId::BuiltinError;
|
||||
|
||||
Reference in New Issue
Block a user