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
+3 -3
View File
@@ -43,7 +43,7 @@ static auto ResolveCalleeInCall(Context& context, SemIR::LocId loc_id,
"{0} argument(s) passed to {1} expecting "
"{2} argument(s).",
int, llvm::StringLiteral, int);
CARBON_DIAGNOSTIC(InCallToEntity, Note, "Calling {0} declared here.",
CARBON_DIAGNOSTIC(InCallToEntity, Note, "calling {0} declared here",
llvm::StringLiteral);
context.emitter()
.Build(loc_id, CallArgCountMismatch, arg_ids.size(),
@@ -128,7 +128,7 @@ auto PerformCall(Context& context, SemIR::LocId loc_id, SemIR::InstId callee_id,
default: {
if (!callee_function.is_error) {
CARBON_DIAGNOSTIC(CallToNonCallable, Error,
"Value of type `{0}` is not callable.",
"value of type `{0}` is not callable",
SemIR::TypeId);
context.emitter().Emit(loc_id, CallToNonCallable,
context.insts().Get(callee_id).type_id());
@@ -154,7 +154,7 @@ auto PerformCall(Context& context, SemIR::LocId loc_id, SemIR::InstId callee_id,
DiagnosticAnnotationScope annotate_diagnostics(
&context.emitter(), [&](auto& builder) {
CARBON_DIAGNOSTIC(IncompleteReturnTypeHere, Note,
"Return type declared here.");
"return type declared here");
builder.Note(callable.return_storage_id, IncompleteReturnTypeHere);
});
return CheckFunctionReturnType(context, callee_id, callable,
+19 -19
View File
@@ -789,7 +789,7 @@ static auto DiagnoseMissingDefinitions(Context& context,
Context::DiagnosticEmitter& emitter)
-> void {
CARBON_DIAGNOSTIC(MissingDefinitionInImpl, Error,
"No definition found for declaration in impl file");
"no definition found for declaration in impl file");
for (SemIR::InstId decl_inst_id : context.definitions_required()) {
SemIR::Inst decl_inst = context.insts().Get(decl_inst_id);
CARBON_KIND_SWITCH(context.insts().Get(decl_inst_id)) {
@@ -983,8 +983,8 @@ static auto TrackImport(Map<ImportKey, UnitInfo*>& api_map,
explicit_import_map->Insert(import_key, import.node_id);
!insert_result.is_inserted()) {
CARBON_DIAGNOSTIC(RepeatedImport, Error,
"Library imported more than once.");
CARBON_DIAGNOSTIC(FirstImported, Note, "First import here.");
"library imported more than once");
CARBON_DIAGNOSTIC(FirstImported, Note, "first import here");
unit_info.emitter.Build(import.node_id, RepeatedImport)
.Note(insert_result.value(), FirstImported)
.Emit();
@@ -1014,9 +1014,9 @@ static auto TrackImport(Map<ImportKey, UnitInfo*>& api_map,
// `impl`.
if (is_same_library) {
CARBON_DIAGNOSTIC(ExplicitImportApi, Error,
"Explicit import of `api` from `impl` file is "
"redundant with implicit import.");
CARBON_DIAGNOSTIC(ImportSelf, Error, "File cannot import itself.");
"explicit import of `api` from `impl` file is "
"redundant with implicit import");
CARBON_DIAGNOSTIC(ImportSelf, Error, "file cannot import itself");
bool is_impl = !packaging || packaging->is_impl;
unit_info.emitter.Emit(import.node_id,
is_impl ? ExplicitImportApi : ImportSelf);
@@ -1028,7 +1028,7 @@ static auto TrackImport(Map<ImportKey, UnitInfo*>& api_map,
if (is_file_implicit_main && is_import_implicit_current_package &&
is_import_default_library) {
CARBON_DIAGNOSTIC(ImportMainDefaultLibrary, Error,
"Cannot import `Main//default`.");
"cannot import `Main//default`");
unit_info.emitter.Emit(import.node_id, ImportMainDefaultLibrary);
return;
@@ -1040,7 +1040,7 @@ static auto TrackImport(Map<ImportKey, UnitInfo*>& api_map,
if (is_same_package || (is_file_implicit_main && is_explicit_main)) {
CARBON_DIAGNOSTIC(
ImportCurrentPackageByName, Error,
"Imports from the current package must omit the package name.");
"imports from the current package must omit the package name");
unit_info.emitter.Emit(import.node_id, ImportCurrentPackageByName);
return;
}
@@ -1048,7 +1048,7 @@ static auto TrackImport(Map<ImportKey, UnitInfo*>& api_map,
// Diagnose explicit imports from `Main`.
if (is_explicit_main) {
CARBON_DIAGNOSTIC(ImportMainPackage, Error,
"Cannot import `Main` from other packages.");
"cannot import `Main` from other packages");
unit_info.emitter.Emit(import.node_id, ImportMainPackage);
return;
}
@@ -1088,8 +1088,8 @@ static auto TrackImport(Map<ImportKey, UnitInfo*>& api_map,
// The imported api is missing.
package_imports.has_load_error = true;
CARBON_DIAGNOSTIC(LibraryApiNotFound, Error,
"Corresponding API for '{0}' not found.", std::string);
CARBON_DIAGNOSTIC(ImportNotFound, Error, "Imported API '{0}' not found.",
"corresponding API for '{0}' not found", std::string);
CARBON_DIAGNOSTIC(ImportNotFound, Error, "imported API '{0}' not found",
std::string);
unit_info.emitter.Emit(
import.node_id,
@@ -1117,10 +1117,10 @@ static auto BuildApiMapAndDiagnosePackaging(
// APIs.
if (import_key.first == ExplicitMainName) {
CARBON_DIAGNOSTIC(ExplicitMainPackage, Error,
"`Main//default` must omit `package` declaration.");
"`Main//default` must omit `package` declaration");
CARBON_DIAGNOSTIC(
ExplicitMainLibrary, Error,
"Use `library` declaration in `Main` package libraries.");
"use `library` declaration in `Main` package libraries");
unit_info.emitter.Emit(packaging->names.node_id,
import_key.second.empty() ? ExplicitMainPackage
: ExplicitMainLibrary);
@@ -1140,13 +1140,13 @@ static auto BuildApiMapAndDiagnosePackaging(
insert_result.value()->unit->tokens->source().filename();
if (packaging) {
CARBON_DIAGNOSTIC(DuplicateLibraryApi, Error,
"Library's API previously provided by `{0}`.",
"library's API previously provided by `{0}`",
std::string);
unit_info.emitter.Emit(packaging->names.node_id, DuplicateLibraryApi,
prev_filename.str());
} else {
CARBON_DIAGNOSTIC(DuplicateMainApi, Error,
"Main//default previously provided by `{0}`.",
"`Main//default` previously provided by `{0}`",
std::string);
// Use the invalid node because there's no node to associate with.
unit_info.emitter.Emit(Parse::NodeId::Invalid, DuplicateMainApi,
@@ -1166,7 +1166,7 @@ static auto BuildApiMapAndDiagnosePackaging(
auto want_ext = is_impl ? ImplExt : ApiExt;
if (is_api_with_impl_ext || !filename.ends_with(want_ext)) {
CARBON_DIAGNOSTIC(IncorrectExtension, Error,
"File extension of `{0}` required for `{1}`.",
"file extension of `{0}` required for `{1}`",
llvm::StringLiteral, Lex::TokenKind);
auto diag = unit_info.emitter.Build(
packaging ? packaging->names.node_id : Parse::NodeId::Invalid,
@@ -1174,7 +1174,7 @@ static auto BuildApiMapAndDiagnosePackaging(
is_impl ? Lex::TokenKind::Impl : Lex::TokenKind::Api);
if (is_api_with_impl_ext) {
CARBON_DIAGNOSTIC(IncorrectExtensionImplNote, Note,
"File extension of `{0}` only allowed for `{1}`.",
"file extension of `{0}` only allowed for `{1}`",
llvm::StringLiteral, Lex::TokenKind);
diag.Note(Parse::NodeId::Invalid, IncorrectExtensionImplNote, ImplExt,
Lex::TokenKind::Impl);
@@ -1270,8 +1270,8 @@ auto CheckParseTrees(
} else {
// The import hasn't been checked, indicating a cycle.
CARBON_DIAGNOSTIC(ImportCycleDetected, Error,
"Import cannot be used due to a cycle. Cycle "
"must be fixed to import.");
"import cannot be used due to a cycle; cycle "
"must be fixed to import");
unit_info.emitter.Emit(import_it->names.node_id,
ImportCycleDetected);
// Make this look the same as an import which wasn't found.
+14 -18
View File
@@ -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;
+22 -22
View File
@@ -234,10 +234,10 @@ static auto ConvertTupleToArray(Context& context, SemIR::TupleType tuple_type,
if (tuple_elem_types.size() != array_bound) {
CARBON_DIAGNOSTIC(
ArrayInitFromLiteralArgCountMismatch, Error,
"Cannot initialize array of {0} element(s) from {1} initializer(s).",
"cannot initialize array of {0} element(s) from {1} initializer(s)",
uint64_t, size_t);
CARBON_DIAGNOSTIC(ArrayInitFromExprArgCountMismatch, Error,
"Cannot initialize array of {0} element(s) from tuple "
"cannot initialize array of {0} element(s) from tuple "
"with {1} element(s).",
uint64_t, size_t);
context.emitter().Emit(value_loc_id,
@@ -318,7 +318,7 @@ static auto ConvertTupleToTuple(Context& context, SemIR::TupleType src_type,
// Check that the tuples are the same size.
if (src_elem_types.size() != dest_elem_types.size()) {
CARBON_DIAGNOSTIC(TupleInitElementCountMismatch, Error,
"Cannot initialize tuple of {0} element(s) from tuple "
"cannot initialize tuple of {0} element(s) from tuple "
"with {1} element(s).",
size_t, size_t);
context.emitter().Emit(value_loc_id, TupleInitElementCountMismatch,
@@ -406,7 +406,7 @@ static auto ConvertStructToStructOrClass(Context& context,
// exist in the destination or vice versa in the diagnostic.
if (src_elem_fields.size() != dest_elem_fields.size()) {
CARBON_DIAGNOSTIC(StructInitElementCountMismatch, Error,
"Cannot initialize {0} with {1} field(s) from struct "
"cannot initialize {0} with {1} field(s) from struct "
"with {2} field(s).",
llvm::StringLiteral, size_t, size_t);
context.emitter().Emit(
@@ -460,14 +460,14 @@ static auto ConvertStructToStructOrClass(Context& context,
if (literal_elems_id.is_valid()) {
CARBON_DIAGNOSTIC(
StructInitMissingFieldInLiteral, Error,
"Missing value for field `{0}` in struct initialization.",
"missing value for field `{0}` in struct initialization",
SemIR::NameId);
context.emitter().Emit(value_loc_id, StructInitMissingFieldInLiteral,
dest_field.name_id);
} else {
CARBON_DIAGNOSTIC(StructInitMissingFieldInConversion, Error,
"Cannot convert from struct type `{0}` to `{1}`: "
"missing field `{2}` in source type.",
"cannot convert from struct type `{0}` to `{1}`: "
"missing field `{2}` in source type",
SemIR::TypeId, SemIR::TypeId, SemIR::NameId);
context.emitter().Emit(
value_loc_id, StructInitMissingFieldInConversion, value.type_id(),
@@ -535,8 +535,8 @@ static auto ConvertStructToClass(Context& context, SemIR::StructType src_type,
auto& dest_class_info = context.classes().Get(dest_type.class_id);
if (dest_class_info.inheritance_kind == SemIR::Class::Abstract) {
CARBON_DIAGNOSTIC(ConstructionOfAbstractClass, Error,
"Cannot construct instance of abstract class. "
"Consider using `partial {0}` instead.",
"cannot construct instance of abstract class; "
"consider using `partial {0}` instead",
SemIR::TypeId);
context.emitter().Emit(value_id, ConstructionOfAbstractClass,
target.type_id);
@@ -909,7 +909,7 @@ static auto PerformCopy(Context& context, SemIR::InstId expr_id)
// TODO: We don't yet have rules for whether and when a class type is
// copyable, or how to perform the copy.
CARBON_DIAGNOSTIC(CopyOfUncopyableType, Error,
"Cannot copy value of type `{0}`.", SemIR::TypeId);
"cannot copy value of type `{0}`", SemIR::TypeId);
context.emitter().Emit(expr_id, CopyOfUncopyableType, type_id);
return SemIR::InstId::BuiltinError;
}
@@ -931,7 +931,7 @@ auto Convert(Context& context, SemIR::LocId loc_id, SemIR::InstId expr_id,
// We should provide a better diagnostic for inappropriate use of
// namespace names, and allow use of functions as values.
CARBON_DIAGNOSTIC(UseOfNonExprAsValue, Error,
"Expression cannot be used as a value.");
"expression cannot be used as a value");
context.emitter().Emit(expr_id, UseOfNonExprAsValue);
return SemIR::InstId::BuiltinError;
}
@@ -939,13 +939,13 @@ auto Convert(Context& context, SemIR::LocId loc_id, SemIR::InstId expr_id,
// We can only perform initialization for complete types.
if (!context.TryToCompleteType(target.type_id, [&] {
CARBON_DIAGNOSTIC(IncompleteTypeInInit, Error,
"Initialization of incomplete type `{0}`.",
"initialization of incomplete type `{0}`",
SemIR::TypeId);
CARBON_DIAGNOSTIC(IncompleteTypeInValueConversion, Error,
"Forming value of incomplete type `{0}`.",
"forming value of incomplete type `{0}`",
SemIR::TypeId);
CARBON_DIAGNOSTIC(IncompleteTypeInConversion, Error,
"Invalid use of incomplete type `{0}`.",
"invalid use of incomplete type `{0}`",
SemIR::TypeId);
return context.emitter().Build(loc_id,
target.is_initializer()
@@ -978,10 +978,10 @@ auto Convert(Context& context, SemIR::LocId loc_id, SemIR::InstId expr_id,
};
expr_id = BuildUnaryOperator(context, loc_id, op, expr_id, [&] {
CARBON_DIAGNOSTIC(ImplicitAsConversionFailure, Error,
"Cannot implicitly convert from `{0}` to `{1}`.",
"cannot implicitly convert from `{0}` to `{1}`",
SemIR::TypeId, SemIR::TypeId);
CARBON_DIAGNOSTIC(ExplicitAsConversionFailure, Error,
"Cannot convert from `{0}` to `{1}` with `as`.",
"cannot convert from `{0}` to `{1}` with `as`",
SemIR::TypeId, SemIR::TypeId);
return context.emitter().Build(loc_id,
target.kind == ConversionTarget::ExplicitAs
@@ -1126,7 +1126,7 @@ auto ConvertForExplicitAs(Context& context, Parse::NodeId as_node,
{.kind = ConversionTarget::ExplicitAs, .type_id = type_id});
}
CARBON_DIAGNOSTIC(InCallToFunction, Note, "Calling function declared here.");
CARBON_DIAGNOSTIC(InCallToFunction, Note, "calling function declared here");
// Convert the object argument in a method call to match the `self` parameter.
static auto ConvertSelf(Context& context, SemIR::LocId call_loc_id,
@@ -1137,7 +1137,7 @@ static auto ConvertSelf(Context& context, SemIR::LocId call_loc_id,
SemIR::InstId self_id) -> SemIR::InstId {
if (!self_id.is_valid()) {
CARBON_DIAGNOSTIC(MissingObjectInMethodCall, Error,
"Missing object argument in method call.");
"missing object argument in method call");
context.emitter()
.Build(call_loc_id, MissingObjectInMethodCall)
.Note(callee_loc, InCallToFunction)
@@ -1149,7 +1149,7 @@ static auto ConvertSelf(Context& context, SemIR::LocId call_loc_id,
&context.emitter(), [&](auto& builder) {
CARBON_DIAGNOSTIC(
InCallToFunctionSelf, Note,
"Initializing `{0}` parameter of method declared here.",
"initializing `{0}` parameter of method declared here",
llvm::StringLiteral);
builder.Note(self_param_id, InCallToFunctionSelf,
addr_pattern ? llvm::StringLiteral("addr self")
@@ -1168,7 +1168,7 @@ static auto ConvertSelf(Context& context, SemIR::LocId call_loc_id,
break;
default:
CARBON_DIAGNOSTIC(AddrSelfIsNonRef, Error,
"`addr self` method cannot be invoked on a value.");
"`addr self` method cannot be invoked on a value");
context.emitter().Emit(TokenOnly(call_loc_id), AddrSelfIsNonRef);
return SemIR::InstId::BuiltinError;
}
@@ -1228,7 +1228,7 @@ auto ConvertCallArgs(Context& context, SemIR::LocId call_loc_id,
&context.emitter(), [&](auto& builder) {
CARBON_DIAGNOSTIC(
InCallToFunctionParam, Note,
"Initializing parameter {0} of function declared here.", int);
"initializing parameter {0} of function declared here", int);
builder.Note(callee.callee_loc, InCallToFunctionParam,
diag_param_index + 1);
});
@@ -1281,7 +1281,7 @@ auto ExprAsType(Context& context, SemIR::LocId loc_id, SemIR::InstId value_id)
auto type_const_id = context.constant_values().Get(type_inst_id);
if (!type_const_id.is_constant()) {
CARBON_DIAGNOSTIC(TypeExprEvaluationFailure, Error,
"Cannot evaluate type expression.");
"cannot evaluate type expression");
context.emitter().Emit(loc_id, TypeExprEvaluationFailure);
return SemIR::TypeId::Error;
}
+9 -9
View File
@@ -140,8 +140,8 @@ auto DeclNameStack::AddName(NameContext name_context, SemIR::InstId target_id,
// TODO: Point at the declaration for the scoped entity.
CARBON_DIAGNOSTIC(
QualifiedDeclOutsideScopeEntity, Error,
"Out-of-line declaration requires a declaration in "
"scoped entity.");
"out-of-line declaration requires a declaration in "
"scoped entity");
context_->emitter().Emit(name_context.loc_id,
QualifiedDeclOutsideScopeEntity);
}
@@ -312,7 +312,7 @@ static auto DiagnoseQualifiedDeclInIncompleteClassScope(Context& context,
SemIR::ClassId class_id)
-> void {
CARBON_DIAGNOSTIC(QualifiedDeclInIncompleteClassScope, Error,
"Cannot declare a member of incomplete class `{0}`.",
"cannot declare a member of incomplete class `{0}`",
SemIR::TypeId);
auto builder =
context.emitter().Build(loc, QualifiedDeclInIncompleteClassScope,
@@ -327,7 +327,7 @@ static auto DiagnoseQualifiedDeclInUndefinedInterfaceScope(
Context& context, SemIRLoc loc, SemIR::InterfaceId interface_id,
SemIR::InstId interface_inst_id) -> void {
CARBON_DIAGNOSTIC(QualifiedDeclInUndefinedInterfaceScope, Error,
"Cannot declare a member of undefined interface `{0}`.",
"cannot declare a member of undefined interface `{0}`",
std::string);
auto builder = context.emitter().Build(
loc, QualifiedDeclInUndefinedInterfaceScope,
@@ -345,9 +345,9 @@ static auto DiagnoseQualifiedDeclInImportedPackage(Context& context,
SemIRLoc import_loc)
-> void {
CARBON_DIAGNOSTIC(QualifiedDeclOutsidePackage, Error,
"Imported packages cannot be used for declarations.");
"imported packages cannot be used for declarations");
CARBON_DIAGNOSTIC(QualifiedDeclOutsidePackageSource, Note,
"Package imported here.");
"package imported here");
context.emitter()
.Build(use_loc, QualifiedDeclOutsidePackage)
.Note(import_loc, QualifiedDeclOutsidePackageSource)
@@ -360,10 +360,10 @@ static auto DiagnoseQualifiedDeclInNonScope(Context& context, SemIRLoc use_loc,
SemIRLoc non_scope_entity_loc)
-> void {
CARBON_DIAGNOSTIC(QualifiedNameInNonScope, Error,
"Name qualifiers are only allowed for entities that "
"provide a scope.");
"name qualifiers are only allowed for entities that "
"provide a scope");
CARBON_DIAGNOSTIC(QualifiedNameNonScopeEntity, Note,
"Referenced non-scope entity declared here.");
"referenced non-scope entity declared here");
context.emitter()
.Build(use_loc, QualifiedNameInNonScope)
.Note(non_scope_entity_loc, QualifiedNameNonScopeEntity)
+5 -5
View File
@@ -79,7 +79,7 @@ class DeductionWorklist {
static auto NoteGenericHere(Context& context, SemIR::GenericId generic_id,
Context::DiagnosticBuilder& diag) -> void {
CARBON_DIAGNOSTIC(DeductionGenericHere, Note,
"While deducing parameters of generic declared here.");
"while deducing parameters of generic declared here");
diag.Note(context.generics().Get(generic_id).decl_id, DeductionGenericHere);
}
@@ -141,7 +141,7 @@ auto DeduceGenericCallArguments(
param_id)) {
CARBON_DIAGNOSTIC(
InitializingGenericParam, Note,
"Initializing generic parameter `{0}` declared here.",
"initializing generic parameter `{0}` declared here",
SemIR::NameId);
builder.Note(
param_id, InitializingGenericParam,
@@ -188,8 +188,8 @@ auto DeduceGenericCallArguments(
result_arg_ids[index.index] != arg_const_inst_id) {
// TODO: Include the two different deduced values.
CARBON_DIAGNOSTIC(DeductionInconsistent, Error,
"Inconsistent deductions for value of generic "
"parameter `{0}`.",
"inconsistent deductions for value of generic "
"parameter `{0}`",
SemIR::NameId);
auto diag = context.emitter().Build(loc_id, DeductionInconsistent,
entity_name.name_id);
@@ -221,7 +221,7 @@ auto DeduceGenericCallArguments(
auto entity_name_id =
context.insts().GetAs<SemIR::AnyBindName>(binding_id).entity_name_id;
CARBON_DIAGNOSTIC(DeductionIncomplete, Error,
"Cannot deduce value for generic parameter `{0}`.",
"cannot deduce value for generic parameter `{0}`",
SemIR::NameId);
auto diag = context.emitter().Build(
loc_id, DeductionIncomplete,
+13 -14
View File
@@ -512,7 +512,7 @@ static auto PerformArrayIndex(EvalContext& eval_context, SemIR::Inst inst)
.Get(bound->int_id)
.ule(index_val.getZExtValue())) {
CARBON_DIAGNOSTIC(ArrayIndexOutOfBounds, Error,
"Array index `{0}` is past the end of type `{1}`.",
"array index `{0}` is past the end of type `{1}`",
TypedInt, SemIR::TypeId);
eval_context.emitter().Emit(
index_inst.index_id, ArrayIndexOutOfBounds,
@@ -553,7 +553,7 @@ static auto ValidateIntType(Context& context, SemIRLoc loc,
(context.types().IsSignedInt(bit_width->type_id) &&
bit_width_val.isNegative())) {
CARBON_DIAGNOSTIC(IntWidthNotPositive, Error,
"Integer type width of {0} is not positive.", TypedInt);
"integer type width of {0} is not positive", TypedInt);
context.emitter().Emit(
loc, IntWidthNotPositive,
{.type = bit_width->type_id, .value = bit_width_val});
@@ -564,8 +564,8 @@ static auto ValidateIntType(Context& context, SemIRLoc loc,
constexpr int MaxIntWidth = 1 << 23;
if (bit_width_val.ugt(MaxIntWidth)) {
CARBON_DIAGNOSTIC(IntWidthTooLarge, Error,
"Integer type width of {0} is greater than the "
"maximum supported width of {1}.",
"integer type width of {0} is greater than the "
"maximum supported width of {1}",
TypedInt, int);
context.emitter().Emit(loc, IntWidthTooLarge,
{.type = bit_width->type_id, .value = bit_width_val},
@@ -598,7 +598,7 @@ static auto ValidateFloatBitWidth(Context& context, SemIRLoc loc,
return true;
}
CARBON_DIAGNOSTIC(CompileTimeFloatBitWidth, Error, "Bit width must be 64.");
CARBON_DIAGNOSTIC(CompileTimeFloatBitWidth, Error, "bit width must be 64");
context.emitter().Emit(loc, CompileTimeFloatBitWidth);
return false;
}
@@ -617,7 +617,7 @@ static auto ValidateFloatType(Context& context, SemIRLoc loc,
// Issues a diagnostic for a compile-time division by zero.
static auto DiagnoseDivisionByZero(Context& context, SemIRLoc loc) -> void {
CARBON_DIAGNOSTIC(CompileTimeDivisionByZero, Error, "Division by zero.");
CARBON_DIAGNOSTIC(CompileTimeDivisionByZero, Error, "division by zero");
context.emitter().Emit(loc, CompileTimeDivisionByZero);
}
@@ -634,7 +634,7 @@ static auto PerformBuiltinUnaryIntOp(Context& context, SemIRLoc loc,
if (context.types().IsSignedInt(op.type_id) &&
op_val.isMinSignedValue()) {
CARBON_DIAGNOSTIC(CompileTimeIntegerNegateOverflow, Error,
"Integer overflow in negation of {0}.", TypedInt);
"integer overflow in negation of {0}", TypedInt);
context.emitter().Emit(loc, CompileTimeIntegerNegateOverflow,
{.type = op.type_id, .value = op_val});
}
@@ -750,10 +750,9 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc,
: llvm::StringLiteral(">>");
if (rhs_val.uge(lhs_val.getBitWidth()) ||
(rhs_val.isNegative() && context.types().IsSignedInt(rhs.type_id))) {
CARBON_DIAGNOSTIC(
CompileTimeShiftOutOfRange, Error,
"Shift distance not in range [0, {0}) in {1} {2} {3}.", unsigned,
TypedInt, llvm::StringLiteral, TypedInt);
CARBON_DIAGNOSTIC(CompileTimeShiftOutOfRange, Error,
"shift distance not in range [0, {0}) in {1} {2} {3}",
unsigned, TypedInt, llvm::StringLiteral, TypedInt);
context.emitter().Emit(loc, CompileTimeShiftOutOfRange,
lhs_val.getBitWidth(),
{.type = lhs.type_id, .value = lhs_val}, op_str,
@@ -777,7 +776,7 @@ static auto PerformBuiltinBinaryIntOp(Context& context, SemIRLoc loc,
if (overflow) {
CARBON_DIAGNOSTIC(CompileTimeIntegerOverflow, Error,
"Integer overflow in calculation {0} {1} {2}.", TypedInt,
"integer overflow in calculation {0} {1} {2}", TypedInt,
llvm::StringLiteral, TypedInt);
context.emitter().Emit(loc, CompileTimeIntegerOverflow,
{.type = lhs.type_id, .value = lhs_val}, op_str,
@@ -1134,7 +1133,7 @@ auto TryEvalInstInContext(EvalContext& eval_context, SemIR::InstId inst_id,
if (eval_context.types().IsSignedInt(int_bound->type_id) &&
bound_val.isNegative()) {
CARBON_DIAGNOSTIC(ArrayBoundNegative, Error,
"Array bound of {0} is negative.", TypedInt);
"array bound of {0} is negative", TypedInt);
eval_context.emitter().Emit(
bound_id, ArrayBoundNegative,
{.type = int_bound->type_id, .value = bound_val});
@@ -1142,7 +1141,7 @@ auto TryEvalInstInContext(EvalContext& eval_context, SemIR::InstId inst_id,
}
if (bound_val.getActiveBits() > 64) {
CARBON_DIAGNOSTIC(ArrayBoundTooLarge, Error,
"Array bound of {0} is too large.", TypedInt);
"array bound of {0} is too large", TypedInt);
eval_context.emitter().Emit(
bound_id, ArrayBoundTooLarge,
{.type = int_bound->type_id, .value = bound_val});
+5 -5
View File
@@ -34,11 +34,11 @@ auto CheckFunctionTypeMatches(Context& context,
prev_return_type_id)) {
CARBON_DIAGNOSTIC(
FunctionRedeclReturnTypeDiffers, Error,
"Function redeclaration differs because return type is `{0}`.",
"function redeclaration differs because return type is `{0}`",
SemIR::TypeId);
CARBON_DIAGNOSTIC(
FunctionRedeclReturnTypeDiffersNoReturn, Error,
"Function redeclaration differs because no return type is provided.");
"function redeclaration differs because no return type is provided");
auto diag =
new_return_type_id.is_valid()
? context.emitter().Build(new_function.latest_decl_id(),
@@ -48,13 +48,13 @@ auto CheckFunctionTypeMatches(Context& context,
FunctionRedeclReturnTypeDiffersNoReturn);
if (prev_return_type_id.is_valid()) {
CARBON_DIAGNOSTIC(FunctionRedeclReturnTypePrevious, Note,
"Previously declared with return type `{0}`.",
"previously declared with return type `{0}`",
SemIR::TypeId);
diag.Note(prev_function.latest_decl_id(),
FunctionRedeclReturnTypePrevious, prev_return_type_id);
} else {
CARBON_DIAGNOSTIC(FunctionRedeclReturnTypePreviousNoReturn, Note,
"Previously declared with no return type.");
"previously declared with no return type");
diag.Note(prev_function.latest_decl_id(),
FunctionRedeclReturnTypePreviousNoReturn);
}
@@ -77,7 +77,7 @@ auto CheckFunctionReturnType(Context& context, SemIRLoc loc,
if (return_info.init_repr.kind == SemIR::InitRepr::Incomplete) {
auto diagnose_incomplete_return_type = [&] {
CARBON_DIAGNOSTIC(IncompleteTypeInFunctionReturnType, Error,
"Function returns incomplete type `{0}`.",
"function returns incomplete type `{0}`",
SemIR::TypeId);
return context.emitter().Build(loc, IncompleteTypeInFunctionReturnType,
return_info.type_id);
+1 -1
View File
@@ -426,7 +426,7 @@ auto RequireGenericParams(Context& context, SemIR::InstBlockId block_id)
for (auto& inst_id : context.inst_blocks().Get(block_id)) {
if (!context.constant_values().Get(inst_id).is_constant()) {
CARBON_DIAGNOSTIC(GenericParamMustBeConstant, Error,
"Parameters of generic types must be constant.");
"parameters of generic types must be constant");
context.emitter().Emit(inst_id, GenericParamMustBeConstant);
// Replace the parameter with an invalid instruction so that we don't try
+1 -1
View File
@@ -54,7 +54,7 @@ auto HandleParseNode(Context& context, Parse::AliasId /*node_id*/) -> bool {
alias_value_id = inst->value_id;
} else {
CARBON_DIAGNOSTIC(AliasRequiresNameRef, Error,
"Alias initializer must be a name reference.");
"alias initializer must be a name reference");
context.emitter().Emit(expr_node, AliasRequiresNameRef);
alias_type_id = SemIR::TypeId::Error;
alias_value_id = SemIR::InstId::BuiltinError;
+1 -2
View File
@@ -39,8 +39,7 @@ auto HandleParseNode(Context& context, Parse::ArrayExprId node_id) -> bool {
// comptime fn F(n: i32) -> type { return [i32; n]; }
auto bound_inst = context.constant_values().Get(bound_inst_id);
if (!bound_inst.is_constant()) {
CARBON_DIAGNOSTIC(InvalidArrayExpr, Error,
"Array bound is not a constant.");
CARBON_DIAGNOSTIC(InvalidArrayExpr, Error, "array bound is not a constant");
context.emitter().Emit(bound_inst_id, InvalidArrayExpr);
context.node_stack().Push(node_id, SemIR::InstId::BuiltinError);
return true;
+5 -5
View File
@@ -73,7 +73,7 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
!context.node_stack().PeekIs<Parse::NodeKind::ImplicitParamListStart>()) {
CARBON_DIAGNOSTIC(
SelfOutsideImplicitParamList, Error,
"`self` can only be declared in an implicit parameter list.");
"`self` can only be declared in an implicit parameter list");
context.emitter().Emit(node_id, SelfOutsideImplicitParamList);
}
@@ -87,7 +87,7 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
if (is_generic) {
CARBON_DIAGNOSTIC(
CompileTimeBindingInVarDecl, Error,
"`var` declaration cannot declare a compile-time binding.");
"`var` declaration cannot declare a compile-time binding");
context.emitter().Emit(type_node, CompileTimeBindingInVarDecl);
}
auto binding_id =
@@ -99,7 +99,7 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
auto parent_class_decl = context.GetCurrentScopeAs<SemIR::ClassDecl>();
cast_type_id = context.AsCompleteType(cast_type_id, [&] {
CARBON_DIAGNOSTIC(IncompleteTypeInVarDecl, Error,
"{0} has incomplete type `{1}`.", llvm::StringLiteral,
"{0} has incomplete type `{1}`", llvm::StringLiteral,
SemIR::TypeId);
return context.emitter().Build(type_node, IncompleteTypeInVarDecl,
parent_class_decl
@@ -171,7 +171,7 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
case Parse::NodeKind::LetIntroducer: {
cast_type_id = context.AsCompleteType(cast_type_id, [&] {
CARBON_DIAGNOSTIC(IncompleteTypeInLetDecl, Error,
"`let` binding has incomplete type `{0}`.",
"`let` binding has incomplete type `{0}`",
SemIR::TypeId);
return context.emitter().Build(type_node, IncompleteTypeInLetDecl,
cast_type_id);
@@ -216,7 +216,7 @@ auto HandleParseNode(Context& context, Parse::AddrId node_id) -> bool {
node_id, {.type_id = self_param->type_id, .inner_id = self_param_id});
} else {
CARBON_DIAGNOSTIC(AddrOnNonSelfParam, Error,
"`addr` can only be applied to a `self` parameter.");
"`addr` can only be applied to a `self` parameter");
context.emitter().Emit(TokenOnly(node_id), AddrOnNonSelfParam);
context.node_stack().Push(node_id, self_param_id);
}
+4 -4
View File
@@ -45,8 +45,8 @@ auto HandleParseNode(Context& context, Parse::ExportDeclId node_id) -> bool {
if (inst.Is<SemIR::ExportDecl>()) {
CARBON_DIAGNOSTIC(ExportRedundant, Warning,
"`export` matches previous `export`.");
CARBON_DIAGNOSTIC(ExportPrevious, Note, "Previous `export` here.");
"`export` matches previous `export`");
CARBON_DIAGNOSTIC(ExportPrevious, Note, "previous `export` here");
context.emitter()
.Build(node_id, ExportRedundant)
// Use the location of the export itself, not the exported instruction.
@@ -58,9 +58,9 @@ auto HandleParseNode(Context& context, Parse::ExportDeclId node_id) -> bool {
auto import_ref = context.insts().TryGetAs<SemIR::ImportRefLoaded>(inst_id);
if (!import_ref) {
CARBON_DIAGNOSTIC(ExportNotImportedEntity, Error,
"Only imported entities are valid for `export`.");
"only imported entities are valid for `export`");
CARBON_DIAGNOSTIC(ExportNotImportedEntitySource, Note,
"Name is declared here.");
"name is declared here");
context.emitter()
.Build(node_id, ExportNotImportedEntity)
.Note(inst_id, ExportNotImportedEntitySource)
+6 -6
View File
@@ -325,8 +325,8 @@ static auto BuildFunctionDecl(Context& context,
context.GetBuiltinType(SemIR::BuiltinInstKind::IntType) &&
return_type_id != context.GetTupleType({}))) {
CARBON_DIAGNOSTIC(InvalidMainRunSignature, Error,
"Invalid signature for `Main.Run` function. Expected "
"`fn ()` or `fn () -> i32`.");
"invalid signature for `Main.Run` function; expected "
"`fn ()` or `fn () -> i32`");
context.emitter().Emit(node_id, InvalidMainRunSignature);
}
}
@@ -374,7 +374,7 @@ static auto HandleFunctionDefinitionAfterSignature(
context.TryToCompleteType(param.type_id, [&] {
CARBON_DIAGNOSTIC(
IncompleteTypeInFunctionParam, Error,
"Parameter has incomplete type `{0}` in function definition.",
"parameter has incomplete type `{0}` in function definition",
SemIR::TypeId);
return context.emitter().Build(param_id, IncompleteTypeInFunctionParam,
param.type_id);
@@ -424,7 +424,7 @@ auto HandleParseNode(Context& context, Parse::FunctionDefinitionId node_id)
if (context.functions().Get(function_id).return_storage_id.is_valid()) {
CARBON_DIAGNOSTIC(
MissingReturnStatement, Error,
"Missing `return` at end of function with declared return type.");
"missing `return` at end of function with declared return type");
context.emitter().Emit(TokenOnly(node_id), MissingReturnStatement);
} else {
context.AddInst<SemIR::Return>(node_id, {});
@@ -468,7 +468,7 @@ static auto LookupBuiltinFunctionKind(Context& context,
auto kind = SemIR::BuiltinFunctionKind::ForBuiltinName(builtin_name);
if (kind == SemIR::BuiltinFunctionKind::None) {
CARBON_DIAGNOSTIC(UnknownBuiltinFunctionName, Error,
"Unknown builtin function name \"{0}\".", std::string);
"unknown builtin function name \"{0}\"", std::string);
context.emitter().Emit(name_id, UnknownBuiltinFunctionName,
builtin_name.str());
}
@@ -519,7 +519,7 @@ auto HandleParseNode(Context& context,
function.builtin_function_kind = builtin_kind;
} else {
CARBON_DIAGNOSTIC(InvalidBuiltinSignature, Error,
"Invalid signature for builtin function \"{0}\".",
"invalid signature for builtin function \"{0}\"",
std::string);
context.emitter().Emit(fn_node_id, InvalidBuiltinSignature,
builtin_kind.name().str());
+10 -11
View File
@@ -88,7 +88,7 @@ auto HandleParseNode(Context& context, Parse::DefaultSelfImplAsId node_id)
auto self_type_id = GetDefaultSelfType(context);
if (!self_type_id.is_valid()) {
CARBON_DIAGNOSTIC(ImplAsOutsideClass, Error,
"`impl as` can only be used in a class.");
"`impl as` can only be used in a class");
context.emitter().Emit(node_id, ImplAsOutsideClass);
self_type_id = SemIR::TypeId::Error;
}
@@ -112,14 +112,14 @@ static auto ExtendImpl(Context& context, Parse::NodeId extend_node,
// TODO: This is also valid in a mixin.
if (!TryAsClassScope(context, parent_scope_id)) {
CARBON_DIAGNOSTIC(ExtendImplOutsideClass, Error,
"`extend impl` can only be used in a class.");
"`extend impl` can only be used in a class");
context.emitter().Emit(node_id, ExtendImplOutsideClass);
return;
}
if (params_node.is_valid()) {
CARBON_DIAGNOSTIC(ExtendImplForall, Error,
"Cannot `extend` a parameterized `impl`.");
"cannot `extend` a parameterized `impl`");
context.emitter().Emit(extend_node, ExtendImplForall);
parent_scope.has_error = true;
return;
@@ -128,7 +128,7 @@ static auto ExtendImpl(Context& context, Parse::NodeId extend_node,
if (context.parse_tree().node_kind(self_type_node) ==
Parse::NodeKind::TypeImplAs) {
CARBON_DIAGNOSTIC(ExtendImplSelfAs, Error,
"Cannot `extend` an `impl` with an explicit self type.");
"cannot `extend` an `impl` with an explicit self type");
auto diag = context.emitter().Build(extend_node, ExtendImplSelfAs);
// If the explicit self type is not the default, just bail out.
@@ -144,7 +144,7 @@ static auto ExtendImpl(Context& context, Parse::NodeId extend_node,
context.parse_tree_and_subtrees().ExtractAs<Parse::TypeImplAs>(
self_type_node)) {
CARBON_DIAGNOSTIC(ExtendImplSelfAsDefault, Note,
"Remove the explicit `Self` type here.");
"remove the explicit `Self` type here");
diag.Note(self_as->type_expr, ExtendImplSelfAsDefault);
}
diag.Emit();
@@ -160,10 +160,9 @@ static auto ExtendImpl(Context& context, Parse::NodeId extend_node,
auto& interface = context.interfaces().Get(interface_type->interface_id);
if (!interface.is_defined()) {
CARBON_DIAGNOSTIC(
ExtendUndefinedInterface, Error,
"`extend impl` requires a definition for interface `{0}`.",
SemIR::TypeId);
CARBON_DIAGNOSTIC(ExtendUndefinedInterface, Error,
"`extend impl` requires a definition for interface `{0}`",
SemIR::TypeId);
auto diag = context.emitter().Build(node_id, ExtendUndefinedInterface,
constraint_id);
context.NoteUndefinedInterface(interface_type->interface_id, diag);
@@ -246,10 +245,10 @@ auto HandleParseNode(Context& context, Parse::ImplDefinitionStartId node_id)
if (impl_info.is_defined()) {
CARBON_DIAGNOSTIC(ImplRedefinition, Error,
"Redefinition of `impl {0} as {1}`.", SemIR::TypeId,
"redefinition of `impl {0} as {1}`", SemIR::TypeId,
SemIR::TypeId);
CARBON_DIAGNOSTIC(ImplPreviousDefinition, Note,
"Previous definition was here.");
"previous definition was here");
context.emitter()
.Build(node_id, ImplRedefinition, impl_info.self_id,
impl_info.constraint_id)
+1 -1
View File
@@ -55,7 +55,7 @@ auto HandleParseNode(Context& context, Parse::IndexExprId node_id) -> bool {
default: {
if (operand_type_id != SemIR::TypeId::Error) {
CARBON_DIAGNOSTIC(TypeNotIndexable, Error,
"Type `{0}` does not support indexing.",
"type `{0}` does not support indexing",
SemIR::TypeId);
context.emitter().Emit(node_id, TypeNotIndexable, operand_type_id);
}
+3 -3
View File
@@ -70,8 +70,8 @@ static auto BuildAssociatedConstantDecl(Context& context,
auto binding_pattern = pattern.inst.TryAs<SemIR::BindSymbolicName>();
if (!binding_pattern) {
CARBON_DIAGNOSTIC(ExpectedSymbolicBindingInAssociatedConstant, Error,
"Pattern in associated constant declaration must be a "
"single `:!` binding.");
"pattern in associated constant declaration must be a "
"single `:!` binding");
context.emitter().Emit(pattern.loc_id,
ExpectedSymbolicBindingInAssociatedConstant);
context.name_scopes().Get(interface_info.scope_id).has_error = true;
@@ -229,7 +229,7 @@ auto HandleParseNode(Context& context, Parse::LetDeclId node_id) -> bool {
if (!decl_info->init_id) {
CARBON_DIAGNOSTIC(
ExpectedInitializerAfterLet, Error,
"Expected `=`; `let` declaration must have an initializer.");
"expected `=`; `let` declaration must have an initializer");
context.emitter().Emit(TokenOnly(node_id), ExpectedInitializerAfterLet);
}
+5 -5
View File
@@ -34,7 +34,7 @@ static auto MakeI32Literal(Context& context, Parse::NodeId node_id,
auto val = context.ints().Get(int_id);
if (val.getActiveBits() > 31) {
CARBON_DIAGNOSTIC(IntLiteralTooLargeForI32, Error,
"Integer literal with value {0} does not fit in i32.",
"integer literal with value {0} does not fit in i32",
llvm::APSInt);
context.emitter().Emit(node_id, IntLiteralTooLargeForI32,
llvm::APSInt(val, /*isUnsigned=*/true));
@@ -72,7 +72,7 @@ auto HandleParseNode(Context& context, Parse::RealLiteralId node_id) -> bool {
if (real_value.mantissa.getActiveBits() > 64) {
CARBON_DIAGNOSTIC(RealMantissaTooLargeForI64, Error,
"Real mantissa with value {0} does not fit in i64.",
"real mantissa with value {0} does not fit in i64",
llvm::APSInt);
context.emitter().Emit(node_id, RealMantissaTooLargeForI64,
llvm::APSInt(real_value.mantissa, true));
@@ -82,7 +82,7 @@ auto HandleParseNode(Context& context, Parse::RealLiteralId node_id) -> bool {
if (real_value.exponent.getSignificantBits() > 64) {
CARBON_DIAGNOSTIC(RealExponentTooLargeForI64, Error,
"Real exponent with value {0} does not fit in i64.",
"real exponent with value {0} does not fit in i64",
llvm::APSInt);
context.emitter().Emit(node_id, RealExponentTooLargeForI64,
llvm::APSInt(real_value.exponent, false));
@@ -126,8 +126,8 @@ static auto HandleIntOrUnsignedIntTypeLiteral(Context& context,
IntId size_id) -> bool {
if (!(context.ints().Get(size_id) & 3).isZero()) {
CARBON_DIAGNOSTIC(IntWidthNotMultipleOf8, Error,
"Bit width of integer type literal must be a multiple of "
"8. Use `Core.{0}({1})` instead.",
"bit width of integer type literal must be a multiple of "
"8; use `Core.{0}({1})` instead",
std::string, llvm::APSInt);
context.emitter().Emit(
node_id, IntWidthNotMultipleOf8, int_kind.is_signed() ? "Int" : "UInt",
+2 -2
View File
@@ -97,7 +97,7 @@ auto HandleParseNode(Context& context, Parse::BreakStatementStartId node_id)
auto& stack = context.break_continue_stack();
if (stack.empty()) {
CARBON_DIAGNOSTIC(BreakOutsideLoop, Error,
"`break` can only be used in a loop.");
"`break` can only be used in a loop");
context.emitter().Emit(node_id, BreakOutsideLoop);
} else {
context.AddInst<SemIR::Branch>(node_id,
@@ -122,7 +122,7 @@ auto HandleParseNode(Context& context, Parse::ContinueStatementStartId node_id)
auto& stack = context.break_continue_stack();
if (stack.empty()) {
CARBON_DIAGNOSTIC(ContinueOutsideLoop, Error,
"`continue` can only be used in a loop.");
"`continue` can only be used in a loop");
context.emitter().Emit(node_id, ContinueOutsideLoop);
} else {
context.AddInst<SemIR::Branch>(node_id,
+4 -4
View File
@@ -9,12 +9,12 @@
namespace Carbon::Check {
CARBON_DIAGNOSTIC(ModifierPrevious, Note, "`{0}` previously appeared here.",
CARBON_DIAGNOSTIC(ModifierPrevious, Note, "`{0}` previously appeared here",
Lex::TokenKind);
static auto DiagnoseRepeated(Context& context, Parse::NodeId first_node,
Parse::NodeId second_node) -> void {
CARBON_DIAGNOSTIC(ModifierRepeated, Error, "`{0}` repeated on declaration.",
CARBON_DIAGNOSTIC(ModifierRepeated, Error, "`{0}` repeated on declaration",
Lex::TokenKind);
context.emitter()
.Build(second_node, ModifierRepeated, context.token_kind(second_node))
@@ -25,7 +25,7 @@ static auto DiagnoseRepeated(Context& context, Parse::NodeId first_node,
static auto DiagnoseNotAllowedWith(Context& context, Parse::NodeId first_node,
Parse::NodeId second_node) -> void {
CARBON_DIAGNOSTIC(ModifierNotAllowedWith, Error,
"`{0}` not allowed on declaration with `{1}`.",
"`{0}` not allowed on declaration with `{1}`",
Lex::TokenKind, Lex::TokenKind);
context.emitter()
.Build(second_node, ModifierNotAllowedWith,
@@ -79,7 +79,7 @@ static auto HandleModifier(Context& context, Parse::NodeId node_id,
CARBON_CHECK(closest_later_modifier.is_valid());
CARBON_DIAGNOSTIC(ModifierMustAppearBefore, Error,
"`{0}` must appear before `{1}`.", Lex::TokenKind,
"`{0}` must appear before `{1}`", Lex::TokenKind,
Lex::TokenKind);
context.emitter()
.Build(node_id, ModifierMustAppearBefore, context.token_kind(node_id),
+1 -1
View File
@@ -46,7 +46,7 @@ auto HandleParseNode(Context& context, Parse::PointerMemberAccessExprId node_id)
auto diagnose_not_pointer = [&context,
&node_id](SemIR::TypeId not_pointer_type_id) {
CARBON_DIAGNOSTIC(ArrowOperatorOfNonPointer, Error,
"Cannot apply `->` operator to non-pointer type `{0}`.",
"cannot apply `->` operator to non-pointer type `{0}`",
SemIR::TypeId);
auto builder = context.emitter().Build(
+6 -6
View File
@@ -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);
}
+2 -2
View File
@@ -80,10 +80,10 @@ static auto DiagnoseDuplicateNames(Context& context,
auto result = names.Insert(field_inst.name_id, field_inst_id);
if (!result.is_inserted()) {
CARBON_DIAGNOSTIC(StructNameDuplicate, Error,
"Duplicated field name `{1}` in {0}.", std::string,
"duplicated field name `{1}` in {0}", std::string,
SemIR::NameId);
CARBON_DIAGNOSTIC(StructNamePrevious, Note,
"Field with the same name here.");
"field with the same name here");
context.emitter()
.Build(field_inst_id, StructNameDuplicate, construct.str(),
field_inst.name_id)
+4 -4
View File
@@ -23,7 +23,7 @@ static auto NoteAssociatedFunction(Context& context,
Context::DiagnosticBuilder& builder,
SemIR::FunctionId function_id) -> void {
CARBON_DIAGNOSTIC(ImplAssociatedFunctionHere, Note,
"Associated function {0} declared here.", SemIR::NameId);
"associated function {0} declared here", SemIR::NameId);
const auto& function = context.functions().Get(function_id);
builder.Note(function.latest_decl_id(), ImplAssociatedFunctionHere,
function.name_id);
@@ -86,7 +86,7 @@ static auto CheckAssociatedFunctionImplementation(
context.insts().TryGetAs<SemIR::FunctionDecl>(impl_decl_id);
if (!impl_function_decl) {
CARBON_DIAGNOSTIC(ImplFunctionWithNonFunction, Error,
"Associated function {0} implemented by non-function.",
"associated function {0} implemented by non-function",
SemIR::NameId);
auto builder = context.emitter().Build(
impl_decl_id, ImplFunctionWithNonFunction,
@@ -130,7 +130,7 @@ static auto BuildInterfaceWitness(
const auto& interface = context.interfaces().Get(interface_type.interface_id);
if (!context.TryToDefineType(interface_type_id, [&] {
CARBON_DIAGNOSTIC(ImplOfUndefinedInterface, Error,
"Implementation of undefined interface {0}.",
"implementation of undefined interface {0}",
SemIR::NameId);
return context.emitter().Build(
impl.definition_id, ImplOfUndefinedInterface, interface.name_id);
@@ -172,7 +172,7 @@ static auto BuildInterfaceWitness(
} else {
CARBON_DIAGNOSTIC(
ImplMissingFunction, Error,
"Missing implementation of {0} in impl of interface {1}.",
"missing implementation of {0} in impl of interface {1}",
SemIR::NameId, SemIR::NameId);
auto builder =
context.emitter().Build(impl.definition_id, ImplMissingFunction,
+1 -1
View File
@@ -534,7 +534,7 @@ auto ImportNameFromOtherPackage(
// Annotate diagnostics as occurring during this name lookup.
DiagnosticAnnotationScope annotate_diagnostics(
&context.emitter(), [&](auto& builder) {
CARBON_DIAGNOSTIC(InNameLookup, Note, "In name lookup for `{0}`.",
CARBON_DIAGNOSTIC(InNameLookup, Note, "in name lookup for `{0}`",
SemIR::NameId);
builder.Note(loc, InNameLookup, name_id);
});
+16 -17
View File
@@ -37,7 +37,7 @@ static auto GetAsLookupScope(Context& context, SemIR::LocId loc_id,
context.TryToDefineType(
context.GetTypeIdForTypeConstant(base_const_id), [&] {
CARBON_DIAGNOSTIC(QualifiedExprInIncompleteClassScope, Error,
"Member access into incomplete class `{0}`.",
"member access into incomplete class `{0}`",
std::string);
return context.emitter().Build(
loc_id, QualifiedExprInIncompleteClassScope,
@@ -51,7 +51,7 @@ static auto GetAsLookupScope(Context& context, SemIR::LocId loc_id,
context.TryToDefineType(
context.GetTypeIdForTypeConstant(base_const_id), [&] {
CARBON_DIAGNOSTIC(QualifiedExprInUndefinedInterfaceScope, Error,
"Member access into undefined interface `{0}`.",
"member access into undefined interface `{0}`",
std::string);
return context.emitter().Build(
loc_id, QualifiedExprInUndefinedInterfaceScope,
@@ -218,7 +218,7 @@ static auto PerformImplLookup(
if (!witness_id.is_valid()) {
if (missing_impl_diagnoser) {
CARBON_DIAGNOSTIC(MissingImplInMemberAccessNote, Note,
"Type `{1}` does not implement interface `{0}`.",
"type `{1}` does not implement interface `{0}`",
SemIR::NameId, SemIR::TypeId);
(*missing_impl_diagnoser)()
.Note(loc_id, MissingImplInMemberAccessNote, interface.name_id,
@@ -226,8 +226,8 @@ static auto PerformImplLookup(
.Emit();
} else {
CARBON_DIAGNOSTIC(MissingImplInMemberAccess, Error,
"Cannot access member of interface `{0}` in type `{1}` "
"that does not implement that interface.",
"cannot access member of interface `{0}` in type `{1}` "
"that does not implement that interface",
SemIR::NameId, SemIR::TypeId);
context.emitter().Emit(loc_id, MissingImplInMemberAccess,
interface.name_id,
@@ -388,10 +388,9 @@ static auto ValidateTupleIndex(Context& context, SemIR::LocId loc_id,
-> const llvm::APInt* {
const auto& index_val = context.ints().Get(index_inst.int_id);
if (index_val.uge(size)) {
CARBON_DIAGNOSTIC(
TupleIndexOutOfBounds, Error,
"Tuple element index `{0}` is past the end of type `{1}`.", TypedInt,
SemIR::TypeId);
CARBON_DIAGNOSTIC(TupleIndexOutOfBounds, Error,
"tuple element index `{0}` is past the end of type `{1}`",
TypedInt, SemIR::TypeId);
context.emitter().Emit(loc_id, TupleIndexOutOfBounds,
{.type = index_inst.type_id, .value = index_val},
operand_inst.type_id());
@@ -417,7 +416,7 @@ auto PerformMemberAccess(Context& context, SemIR::LocId loc_id,
auto base_type_id = context.insts().Get(base_id).type_id();
if (!context.TryToCompleteType(base_type_id, [&] {
CARBON_DIAGNOSTIC(IncompleteTypeInMemberAccess, Error,
"Member access into object of incomplete type `{0}`.",
"member access into object of incomplete type `{0}`",
SemIR::TypeId);
return context.emitter().Build(base_id, IncompleteTypeInMemberAccess,
base_type_id);
@@ -450,7 +449,7 @@ auto PerformMemberAccess(Context& context, SemIR::LocId loc_id,
}
}
CARBON_DIAGNOSTIC(QualifiedExprNameNotFound, Error,
"Type `{0}` does not have a member `{1}`.",
"type `{0}` does not have a member `{1}`",
SemIR::TypeId, SemIR::NameId);
context.emitter().Emit(loc_id, QualifiedExprNameNotFound, base_type_id,
name_id);
@@ -459,7 +458,7 @@ auto PerformMemberAccess(Context& context, SemIR::LocId loc_id,
if (base_type_id != SemIR::TypeId::Error) {
CARBON_DIAGNOSTIC(QualifiedExprUnsupported, Error,
"Type `{0}` does not support qualified expressions.",
"type `{0}` does not support qualified expressions",
SemIR::TypeId);
context.emitter().Emit(loc_id, QualifiedExprUnsupported, base_type_id);
}
@@ -508,8 +507,8 @@ auto PerformCompoundMemberAccess(
// because the base expression is not used for anything.
if (member_id == member_expr_id && member.type_id() != SemIR::TypeId::Error) {
CARBON_DIAGNOSTIC(CompoundMemberAccessDoesNotUseBase, Error,
"Member name of type `{0}` in compound member access is "
"not an instance member or an interface member.",
"member name of type `{0}` in compound member access is "
"not an instance member or an interface member",
SemIR::TypeId);
context.emitter().Emit(loc_id, CompoundMemberAccessDoesNotUseBase,
member.type_id());
@@ -528,8 +527,8 @@ auto PerformTupleAccess(Context& context, SemIR::LocId loc_id,
auto tuple_type = context.types().TryGetAs<SemIR::TupleType>(tuple_type_id);
if (!tuple_type) {
CARBON_DIAGNOSTIC(TupleIndexOnANonTupleType, Error,
"Type `{0}` does not support tuple indexing. Only "
"tuples can be indexed that way.",
"type `{0}` does not support tuple indexing; only "
"tuples can be indexed that way",
SemIR::TypeId);
context.emitter().Emit(loc_id, TupleIndexOnANonTupleType, tuple_type_id);
return SemIR::InstId::BuiltinError;
@@ -546,7 +545,7 @@ auto PerformTupleAccess(Context& context, SemIR::LocId loc_id,
} else if (!index_const_id.is_template()) {
// TODO: Decide what to do if the index is a symbolic constant.
CARBON_DIAGNOSTIC(TupleIndexNotConstant, Error,
"Tuple index must be a constant.");
"tuple index must be a constant");
context.emitter().Emit(loc_id, TupleIndexNotConstant);
return SemIR::InstId::BuiltinError;
}
+17 -17
View File
@@ -11,14 +11,14 @@
namespace Carbon::Check {
CARBON_DIAGNOSTIC(RedeclPrevDecl, Note, "Previously declared here.");
CARBON_DIAGNOSTIC(RedeclPrevDecl, Note, "previously declared here");
// Diagnoses a redeclaration which is redundant.
static auto DiagnoseRedundant(Context& context, Lex::TokenKind decl_kind,
SemIR::NameId name_id, SemIRLoc new_loc,
SemIRLoc prev_loc) -> void {
CARBON_DIAGNOSTIC(RedeclRedundant, Error,
"Redeclaration of `{0} {1}` is redundant.", Lex::TokenKind,
"redeclaration of `{0} {1}` is redundant", Lex::TokenKind,
SemIR::NameId);
context.emitter()
.Build(new_loc, RedeclRedundant, decl_kind, name_id)
@@ -30,9 +30,9 @@ static auto DiagnoseRedundant(Context& context, Lex::TokenKind decl_kind,
static auto DiagnoseRedef(Context& context, Lex::TokenKind decl_kind,
SemIR::NameId name_id, SemIRLoc new_loc,
SemIRLoc prev_loc) -> void {
CARBON_DIAGNOSTIC(RedeclRedef, Error, "Redefinition of `{0} {1}`.",
CARBON_DIAGNOSTIC(RedeclRedef, Error, "redefinition of `{0} {1}`",
Lex::TokenKind, SemIR::NameId);
CARBON_DIAGNOSTIC(RedeclPrevDef, Note, "Previously defined here.");
CARBON_DIAGNOSTIC(RedeclPrevDef, Note, "previously defined here");
context.emitter()
.Build(new_loc, RedeclRedef, decl_kind, name_id)
.Note(prev_loc, RedeclPrevDef)
@@ -44,7 +44,7 @@ static auto DiagnoseExternMismatch(Context& context, Lex::TokenKind decl_kind,
SemIR::NameId name_id, SemIRLoc new_loc,
SemIRLoc prev_loc) -> void {
CARBON_DIAGNOSTIC(RedeclExternMismatch, Error,
"Redeclarations of `{0} {1}` must match use of `extern`.",
"redeclarations of `{0} {1}` must match use of `extern`",
Lex::TokenKind, SemIR::NameId);
context.emitter()
.Build(new_loc, RedeclExternMismatch, decl_kind, name_id)
@@ -59,7 +59,7 @@ static auto DiagnoseExternLibraryInImporter(Context& context,
SemIRLoc new_loc, SemIRLoc prev_loc)
-> void {
CARBON_DIAGNOSTIC(ExternLibraryInImporter, Error,
"Cannot declare imported `{0} {1}` as `extern library`.",
"cannot declare imported `{0} {1}` as `extern library`",
Lex::TokenKind, SemIR::NameId);
context.emitter()
.Build(new_loc, ExternLibraryInImporter, decl_kind, name_id)
@@ -72,10 +72,10 @@ static auto DiagnoseExternLibraryIncorrect(Context& context, SemIRLoc new_loc,
SemIRLoc prev_loc) -> void {
CARBON_DIAGNOSTIC(
ExternLibraryIncorrect, Error,
"Declaration in {0} doesn't match `extern library` declaration.",
"declaration in {0} doesn't match `extern library` declaration",
SemIR::LibraryNameId);
CARBON_DIAGNOSTIC(ExternLibraryExpected, Note,
"Previously declared with `extern library` here.");
"previously declared with `extern library` here");
context.emitter()
.Build(new_loc, ExternLibraryIncorrect, context.sem_ir().library_id())
.Note(prev_loc, ExternLibraryExpected)
@@ -86,7 +86,7 @@ auto DiagnoseExternRequiresDeclInApiFile(Context& context, SemIRLoc loc)
-> void {
CARBON_DIAGNOSTIC(
ExternRequiresDeclInApiFile, Error,
"`extern` entities must have a declaration in the API file.");
"`extern` entities must have a declaration in the API file");
context.emitter().Build(loc, ExternRequiresDeclInApiFile).Emit();
}
@@ -203,10 +203,10 @@ static auto CheckRedeclParam(Context& context,
// params.
auto diagnose = [&]() {
CARBON_DIAGNOSTIC(RedeclParamDiffers, Error,
"Redeclaration differs at {0}parameter {1}.",
"redeclaration differs at {0}parameter {1}",
llvm::StringLiteral, int32_t);
CARBON_DIAGNOSTIC(RedeclParamPrevious, Note,
"Previous declaration's corresponding {0}parameter here.",
"previous declaration's corresponding {0}parameter here",
llvm::StringLiteral);
context.emitter()
.Build(new_param_ref_id, RedeclParamDiffers, param_diag_label,
@@ -269,10 +269,10 @@ static auto CheckRedeclParams(Context& context, SemIRLoc new_decl_loc,
// If exactly one of the parameter lists was present, they differ.
if (new_param_refs_id.is_valid() != prev_param_refs_id.is_valid()) {
CARBON_DIAGNOSTIC(RedeclParamListDiffers, Error,
"Redeclaration differs because of {1}{0}parameter list.",
"redeclaration differs because of {1}{0}parameter list",
llvm::StringLiteral, llvm::StringLiteral);
CARBON_DIAGNOSTIC(RedeclParamListPrevious, Note,
"Previously declared with{1} {0}parameter list.",
"previously declared with{1} {0}parameter list",
llvm::StringLiteral, llvm::StringLiteral);
context.emitter()
.Build(
@@ -290,10 +290,10 @@ static auto CheckRedeclParams(Context& context, SemIRLoc new_decl_loc,
if (new_param_ref_ids.size() != prev_param_ref_ids.size()) {
CARBON_DIAGNOSTIC(
RedeclParamCountDiffers, Error,
"Redeclaration differs because of {0}parameter count of {1}.",
"redeclaration differs because of {0}parameter count of {1}",
llvm::StringLiteral, int32_t);
CARBON_DIAGNOSTIC(RedeclParamCountPrevious, Note,
"Previously declared with {0}parameter count of {1}.",
"previously declared with {0}parameter count of {1}",
llvm::StringLiteral, int32_t);
context.emitter()
.Build(new_decl_loc, RedeclParamCountDiffers, param_diag_label,
@@ -367,9 +367,9 @@ static auto CheckRedeclParamSyntax(Context& context,
for (auto [new_node_id, prev_node_id] : llvm::zip(new_range, prev_range)) {
if (!IsNodeSyntaxEqual(context, new_node_id, prev_node_id)) {
CARBON_DIAGNOSTIC(RedeclParamSyntaxDiffers, Error,
"Redeclaration syntax differs here.");
"redeclaration syntax differs here");
CARBON_DIAGNOSTIC(RedeclParamSyntaxPrevious, Note,
"Comparing with previous declaration here.");
"comparing with previous declaration here");
context.emitter()
.Build(new_node_id, RedeclParamSyntaxDiffers)
.Note(prev_node_id, RedeclParamSyntaxPrevious)
+6 -7
View File
@@ -13,14 +13,13 @@ static auto DiagnoseNotAllowed(Context& context, Parse::NodeId modifier_node,
llvm::StringRef context_string,
SemIR::LocId context_loc_id) -> void {
CARBON_DIAGNOSTIC(ModifierNotAllowedOn, Error,
"`{0}` not allowed on `{1}` declaration{2}.",
Lex::TokenKind, Lex::TokenKind, std::string);
"`{0}` not allowed on `{1}` declaration{2}", Lex::TokenKind,
Lex::TokenKind, std::string);
auto diag = context.emitter().Build(modifier_node, ModifierNotAllowedOn,
context.token_kind(modifier_node),
decl_kind, context_string.str());
if (context_loc_id.is_valid()) {
CARBON_DIAGNOSTIC(ModifierNotInContext, Note,
"Containing definition here.");
CARBON_DIAGNOSTIC(ModifierNotInContext, Note, "containing definition here");
diag.Note(context_loc_id, ModifierNotInContext);
}
diag.Emit();
@@ -136,7 +135,7 @@ auto RestrictExternModifierOnDecl(Context& context,
// This prints an error for `extern library`, but doesn't drop it because we
// assume there is some other, correct value that we just don't know here.
CARBON_DIAGNOSTIC(ExternLibraryIsCurrentLibrary, Error,
"`extern library` cannot specify the current library.");
"`extern library` cannot specify the current library");
context.emitter().Emit(introducer.modifier_node_id(ModifierOrder::Extern),
ExternLibraryIsCurrentLibrary);
introducer.extern_library = SemIR::LibraryNameId::Error;
@@ -145,8 +144,8 @@ auto RestrictExternModifierOnDecl(Context& context,
if (is_definition && introducer.extern_library.is_valid()) {
CARBON_DIAGNOSTIC(ExternLibraryOnDefinition, Error,
"A library cannot be provided for an `extern` modifier "
"on a definition.");
"a library cannot be provided for an `extern` modifier "
"on a definition");
context.emitter().Emit(introducer.modifier_node_id(ModifierOrder::Extern),
ExternLibraryOnDefinition);
}
+1 -1
View File
@@ -58,7 +58,7 @@ auto PopNameComponentWithoutParams(Context& context, Lex::TokenKind introducer)
NameComponent name = PopNameComponent(context);
if (name.implicit_params_id.is_valid() || name.params_id.is_valid()) {
CARBON_DIAGNOSTIC(UnexpectedDeclNameParams, Error,
"`{0}` declaration cannot have parameters.",
"`{0}` declaration cannot have parameters",
Lex::TokenKind);
// Point to the lexically first parameter list in the diagnostic.
context.emitter().Emit(name.implicit_params_id.is_valid()
+12 -12
View File
@@ -32,7 +32,7 @@ static auto GetCurrentReturnedVar(Context& context) -> SemIR::InstId {
static auto NoteNoReturnTypeProvided(Context::DiagnosticBuilder& diag,
const SemIR::Function& function) {
CARBON_DIAGNOSTIC(ReturnTypeOmittedNote, Note,
"There was no return type provided.");
"there was no return type provided");
diag.Note(function.latest_decl_id(), ReturnTypeOmittedNote);
}
@@ -41,14 +41,14 @@ static auto NoteReturnType(Context::DiagnosticBuilder& diag,
const SemIR::Function& function,
SemIR::TypeId return_type_id) {
CARBON_DIAGNOSTIC(ReturnTypeHereNote, Note,
"Return type of function is `{0}`.", SemIR::TypeId);
"return type of function is `{0}`", SemIR::TypeId);
diag.Note(function.return_storage_id, ReturnTypeHereNote, return_type_id);
}
// Produces a note pointing at the currently in scope `returned var`.
static auto NoteReturnedVar(Context::DiagnosticBuilder& diag,
SemIR::InstId returned_var_id) {
CARBON_DIAGNOSTIC(ReturnedVarHere, Note, "`returned var` was declared here.");
CARBON_DIAGNOSTIC(ReturnedVarHere, Note, "`returned var` was declared here");
diag.Note(returned_var_id, ReturnedVarHere);
}
@@ -69,7 +69,7 @@ auto CheckReturnedVar(Context& context, Parse::NodeId returned_node,
// A `returned var` requires an explicit return type.
if (!return_info.type_id.is_valid()) {
CARBON_DIAGNOSTIC(ReturnedVarWithNoReturnType, Error,
"Cannot declare a `returned var` in this function.");
"cannot declare a `returned var` in this function");
auto diag =
context.emitter().Build(returned_node, ReturnedVarWithNoReturnType);
NoteNoReturnTypeProvided(diag, function);
@@ -80,8 +80,8 @@ auto CheckReturnedVar(Context& context, Parse::NodeId returned_node,
// The declared type of the var must match the return type of the function.
if (return_info.type_id != type_id) {
CARBON_DIAGNOSTIC(ReturnedVarWrongType, Error,
"Type `{0}` of `returned var` does not match "
"return type of enclosing function.",
"type `{0}` of `returned var` does not match "
"return type of enclosing function",
SemIR::TypeId);
auto diag =
context.emitter().Build(type_node, ReturnedVarWrongType, type_id);
@@ -103,8 +103,8 @@ auto RegisterReturnedVar(Context& context, SemIR::InstId bind_id) -> void {
auto existing_id = context.scope_stack().SetReturnedVarOrGetExisting(bind_id);
if (existing_id.is_valid()) {
CARBON_DIAGNOSTIC(ReturnedVarShadowed, Error,
"Cannot declare a `returned var` in the scope of "
"another `returned var`.");
"cannot declare a `returned var` in the scope of "
"another `returned var`");
auto diag = context.emitter().Build(bind_id, ReturnedVarShadowed);
NoteReturnedVar(diag, existing_id);
diag.Emit();
@@ -118,7 +118,7 @@ auto BuildReturnWithNoExpr(Context& context, Parse::ReturnStatementId node_id)
if (return_type_id.is_valid()) {
CARBON_DIAGNOSTIC(ReturnStatementMissingExpr, Error,
"Missing return value.");
"missing return value");
auto diag = context.emitter().Build(node_id, ReturnStatementMissingExpr);
NoteReturnType(diag, function, return_type_id);
diag.Emit();
@@ -138,7 +138,7 @@ auto BuildReturnWithExpr(Context& context, Parse::ReturnStatementId node_id,
if (!return_info.type_id.is_valid()) {
CARBON_DIAGNOSTIC(
ReturnStatementDisallowExpr, Error,
"No return expression should be provided in this context.");
"no return expression should be provided in this context");
auto diag = context.emitter().Build(node_id, ReturnStatementDisallowExpr);
NoteNoReturnTypeProvided(diag, function);
diag.Emit();
@@ -146,7 +146,7 @@ auto BuildReturnWithExpr(Context& context, Parse::ReturnStatementId node_id,
} else if (returned_var_id.is_valid()) {
CARBON_DIAGNOSTIC(
ReturnExprWithReturnedVar, Error,
"Can only `return var;` in the scope of a `returned var`.");
"can only `return var;` in the scope of a `returned var`");
auto diag = context.emitter().Build(node_id, ReturnExprWithReturnedVar);
NoteReturnedVar(diag, returned_var_id);
diag.Emit();
@@ -174,7 +174,7 @@ auto BuildReturnVar(Context& context, Parse::ReturnStatementId node_id)
if (!returned_var_id.is_valid()) {
CARBON_DIAGNOSTIC(ReturnVarWithNoReturnedVar, Error,
"`return var;` with no `returned var` in scope.");
"`return var;` with no `returned var` in scope");
context.emitter().Emit(node_id, ReturnVarWithNoReturnedVar);
returned_var_id = SemIR::InstId::BuiltinError;
}
@@ -47,7 +47,7 @@ auto SemIRDiagnosticConverter::ConvertLoc(SemIRLoc loc,
// TODO: Add an "In implicit import of prelude." note for the case where we
// don't have a location.
if (import_loc_id.is_valid()) {
CARBON_DIAGNOSTIC(InImport, Note, "In import.");
CARBON_DIAGNOSTIC(InImport, Note, "in import");
context_fn(in_import_loc, InImport);
}
+1 -1
View File
@@ -8,7 +8,7 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/fail_bool_value.carbon
// CHECK:STDERR: fail_bool_value.carbon:[[@LINE+3]]:11: ERROR: Alias initializer must be a name reference.
// CHECK:STDERR: fail_bool_value.carbon:[[@LINE+3]]:11: error: alias initializer must be a name reference
// CHECK:STDERR: alias a = false;
// CHECK:STDERR: ^~~~~
alias a = false;
+2 -2
View File
@@ -8,13 +8,13 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/fail_builtins.carbon
// CHECK:STDERR: fail_builtins.carbon:[[@LINE+4]]:11: ERROR: Alias initializer must be a name reference.
// CHECK:STDERR: fail_builtins.carbon:[[@LINE+4]]:11: error: alias initializer must be a name reference
// CHECK:STDERR: alias a = i32;
// CHECK:STDERR: ^~~
// CHECK:STDERR:
alias a = i32;
// CHECK:STDERR: fail_builtins.carbon:[[@LINE+3]]:11: ERROR: Alias initializer must be a name reference.
// CHECK:STDERR: fail_builtins.carbon:[[@LINE+3]]:11: error: alias initializer must be a name reference
// CHECK:STDERR: alias b = bool;
// CHECK:STDERR: ^~~~
alias b = bool;
+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/alias/fail_control_flow.carbon
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+11]]:11: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`.
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+11]]:11: error: semantics TODO: `Control flow expressions are currently only supported inside functions.`
// CHECK:STDERR: alias a = true or false;
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+7]]:11: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`.
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+7]]:11: error: semantics TODO: `Control flow expressions are currently only supported inside functions.`
// CHECK:STDERR: alias a = true or false;
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+3]]:11: ERROR: Alias initializer must be a name reference.
// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+3]]:11: error: alias initializer must be a name reference
// CHECK:STDERR: alias a = true or false;
// CHECK:STDERR: ^~~~~~~~~~~~~
alias a = true or false;
@@ -53,7 +53,7 @@ library "[[@TEST_NAME]]";
import library "export";
// CHECK:STDERR: fail_orig_name_not_in_export.carbon:[[@LINE+3]]:8: ERROR: Name `C` not found.
// CHECK:STDERR: fail_orig_name_not_in_export.carbon:[[@LINE+3]]:8: error: name `C` not found
// CHECK:STDERR: var c: C = {};
// CHECK:STDERR: ^
var c: C = {};
@@ -14,7 +14,7 @@ class D {}
alias c = C;
var d: D = {};
// CHECK:STDERR: fail_aliased_name_in_diag.carbon:[[@LINE+3]]:1: ERROR: Package `Core` implicitly referenced here, but not found.
// CHECK:STDERR: fail_aliased_name_in_diag.carbon:[[@LINE+3]]:1: error: package `Core` implicitly referenced here, but not found
// CHECK:STDERR: let c_var: c = d;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
let c_var: c = d;
@@ -11,16 +11,16 @@
namespace NS;
fn F() -> {} {
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+8]]:9: ERROR: Name `NS` not found.
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+8]]:9: error: name `NS` not found
// CHECK:STDERR: alias NS.a = {};
// CHECK:STDERR: ^~
// CHECK:STDERR:
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+4]]:16: ERROR: Alias initializer must be a name reference.
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+4]]:16: error: alias initializer must be a name reference
// CHECK:STDERR: alias NS.a = {};
// CHECK:STDERR: ^~
// CHECK:STDERR:
alias NS.a = {};
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+3]]:10: ERROR: Name `a` not found.
// CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+3]]:10: error: name `a` not found
// CHECK:STDERR: return NS.a;
// CHECK:STDERR: ^~~~
return NS.a;
@@ -10,40 +10,40 @@
class Class {}
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+25]]:1: ERROR: `abstract` not allowed on `alias` declaration.
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+25]]:1: error: `abstract` not allowed on `alias` declaration
// CHECK:STDERR: abstract base default final alias A = Class;
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+21]]:10: ERROR: `base` not allowed on declaration with `abstract`.
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+21]]:10: error: `base` not allowed on declaration with `abstract`
// CHECK:STDERR: abstract base default final alias A = Class;
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+18]]:1: `abstract` previously appeared here.
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+18]]:1: `abstract` previously appeared here
// CHECK:STDERR: abstract base default final alias A = Class;
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+14]]:15: ERROR: `default` not allowed on declaration with `abstract`.
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+14]]:15: error: `default` not allowed on declaration with `abstract`
// CHECK:STDERR: abstract base default final alias A = Class;
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:1: `abstract` previously appeared here.
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:1: `abstract` previously appeared here
// CHECK:STDERR: abstract base default final alias A = Class;
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:23: ERROR: `final` not allowed on declaration with `abstract`.
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:23: error: `final` not allowed on declaration with `abstract`
// CHECK:STDERR: abstract base default final alias A = Class;
// CHECK:STDERR: ^~~~~
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: `abstract` previously appeared here.
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: `abstract` previously appeared here
// CHECK:STDERR: abstract base default final alias A = Class;
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
abstract base default final alias A = Class;
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: ERROR: `impl` not allowed on `alias` declaration.
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `impl` not allowed on `alias` declaration
// CHECK:STDERR: impl alias B = Class;
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
impl alias B = Class;
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:1: ERROR: `extern` not allowed on `alias` declaration.
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:1: error: `extern` not allowed on `alias` declaration
// CHECK:STDERR: extern alias C = Class;
// CHECK:STDERR: ^~~~~~
extern alias C = Class;
@@ -11,20 +11,20 @@
class C {}
alias a = C;
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:5: ERROR: Duplicate name being declared in the same scope.
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:5: error: duplicate name being declared in the same scope
// CHECK:STDERR: var a: C = {};
// CHECK:STDERR: ^
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:7: Name is previously declared here.
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:7: name is previously declared here
// CHECK:STDERR: alias a = C;
// CHECK:STDERR: ^
// CHECK:STDERR:
var a: C = {};
var b: C = {};
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+6]]:7: ERROR: Duplicate name being declared in the same scope.
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+6]]:7: error: duplicate name being declared in the same scope
// CHECK:STDERR: alias b = C;
// CHECK:STDERR: ^
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:5: Name is previously declared here.
// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:5: name is previously declared here
// CHECK:STDERR: var b: C = {};
// CHECK:STDERR: ^
alias b = C;
@@ -11,7 +11,7 @@
fn F() {
var a: () = ();
var b: ()* = &a;
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:13: ERROR: Alias initializer must be a name reference.
// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:13: error: alias initializer must be a name reference
// CHECK:STDERR: alias c = *b;
// CHECK:STDERR: ^~
alias c = *b;
@@ -8,11 +8,11 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/fail_params.carbon
// CHECK:STDERR: fail_params.carbon:[[@LINE+7]]:8: ERROR: `alias` declaration cannot have parameters.
// CHECK:STDERR: fail_params.carbon:[[@LINE+7]]:8: error: `alias` declaration cannot have parameters
// CHECK:STDERR: alias A(T:! type) = T*;
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_params.carbon:[[@LINE+3]]:21: ERROR: Alias initializer must be a name reference.
// CHECK:STDERR: fail_params.carbon:[[@LINE+3]]:21: error: alias initializer must be a name reference
// CHECK:STDERR: alias A(T:! type) = T*;
// CHECK:STDERR: ^~
alias A(T:! type) = T*;
+2 -2
View File
@@ -58,10 +58,10 @@ var b: () = a_alias;
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_var3.carbon:[[@LINE+6]]:1: In import.
// CHECK:STDERR: fail_var3.carbon:[[@LINE+6]]:1: in import
// CHECK:STDERR: import library "var2";
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR: var2.carbon:8:5: ERROR: Semantics TODO: `Non-constant ImportRefLoaded (comes up with var)`.
// CHECK:STDERR: var2.carbon:8:5: error: semantics TODO: `Non-constant ImportRefLoaded (comes up with var)`
// CHECK:STDERR: var b: () = a_alias;
// CHECK:STDERR: ^
import library "var2";
@@ -35,7 +35,7 @@ package Test library "[[@TEST_NAME]]";
import library "def";
// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:11: ERROR: Name `A` not found.
// CHECK:STDERR: fail_local_def.carbon:[[@LINE+4]]:11: error: name `A` not found
// CHECK:STDERR: var inst: A = {};
// CHECK:STDERR: ^
// CHECK:STDERR:
@@ -47,7 +47,7 @@ package Other library "[[@TEST_NAME]]";
import Test library "def";
// CHECK:STDERR: fail_other_def.carbon:[[@LINE+3]]:11: ERROR: Name `A` not found.
// CHECK:STDERR: fail_other_def.carbon:[[@LINE+3]]:11: error: name `A` not found
// CHECK:STDERR: var inst: Test.A = {};
// CHECK:STDERR: ^~~~~~
var inst: Test.A = {};
+1 -1
View File
@@ -10,7 +10,7 @@
fn Negate(n: i32) -> i32 = "int.snegate";
// CHECK:STDERR: fail_bound_negative.carbon:[[@LINE+3]]:14: ERROR: Array bound of -1 is negative.
// CHECK:STDERR: fail_bound_negative.carbon:[[@LINE+3]]:14: error: array bound of -1 is negative
// CHECK:STDERR: var a: [i32; Negate(1)];
// CHECK:STDERR: ^~~~~~~
var a: [i32; Negate(1)];
+4 -4
View File
@@ -11,20 +11,20 @@
// TODO: Once we preserve the full value of integer literals in SemIR, check
// that we reject the array bound being too large.
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+4]]:14: ERROR: Integer literal with value 39999999999999999993 does not fit in i32.
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+4]]:14: error: integer literal with value 39999999999999999993 does not fit in i32
// CHECK:STDERR: var a: [i32; 39999999999999999993];
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
var a: [i32; 39999999999999999993];
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+10]]:9: ERROR: Cannot implicitly convert from `i32` to `type`.
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+10]]:9: error: cannot implicitly convert from `i32` to `type`
// CHECK:STDERR: var b: [1; 39999999999999999993];
// CHECK:STDERR: ^
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+7]]:9: Type `i32` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+7]]:9: type `i32` does not implement interface `ImplicitAs`
// CHECK:STDERR: var b: [1; 39999999999999999993];
// CHECK:STDERR: ^
// CHECK:STDERR:
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+3]]:12: ERROR: Integer literal with value 39999999999999999993 does not fit in i32.
// CHECK:STDERR: fail_bound_overflow.carbon:[[@LINE+3]]:12: error: integer literal with value 39999999999999999993 does not fit in i32
// CHECK:STDERR: var b: [1; 39999999999999999993];
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
var b: [1; 39999999999999999993];
@@ -10,10 +10,10 @@
class Incomplete;
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+6]]:8: ERROR: Variable has incomplete type `[Incomplete; 1]`.
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+6]]:8: error: Variable has incomplete type `[Incomplete; 1]`
// CHECK:STDERR: var a: [Incomplete; 1];
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-5]]:1: Class was forward declared here.
// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-5]]:1: class was forward declared here
// CHECK:STDERR: class Incomplete;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
var a: [Incomplete; 1];
+2 -2
View File
@@ -8,10 +8,10 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_invalid_type.carbon
// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+6]]:9: ERROR: Cannot implicitly convert from `i32` to `type`.
// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+6]]:9: error: cannot implicitly convert from `i32` to `type`
// CHECK:STDERR: var a: [1; 1];
// CHECK:STDERR: ^
// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+3]]:9: Type `i32` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+3]]:9: type `i32` does not implement interface `ImplicitAs`
// CHECK:STDERR: var a: [1; 1];
// CHECK:STDERR: ^
var a: [1; 1];
+1 -1
View File
@@ -8,7 +8,7 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_out_of_bound.carbon
// CHECK:STDERR: fail_out_of_bound.carbon:[[@LINE+3]]:19: ERROR: Cannot initialize array of 1 element(s) from 3 initializer(s).
// CHECK:STDERR: fail_out_of_bound.carbon:[[@LINE+3]]:19: error: cannot initialize array of 1 element(s) from 3 initializer(s)
// CHECK:STDERR: var a: [i32; 1] = (1, 2, 3);
// CHECK:STDERR: ^~~~~~~~~
var a: [i32; 1] = (1, 2, 3);
@@ -9,7 +9,7 @@
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon
var a: [i32; 3] = (1, 2, 3);
// CHECK:STDERR: fail_out_of_bound_non_literal.carbon:[[@LINE+3]]:16: ERROR: Array index `3` is past the end of type `[i32; 3]`.
// CHECK:STDERR: fail_out_of_bound_non_literal.carbon:[[@LINE+3]]:16: error: array index `3` is past the end of type `[i32; 3]`
// CHECK:STDERR: var b: i32 = a[{.index = 3}.index];
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
var b: i32 = a[{.index = 3}.index];
+6 -6
View File
@@ -8,33 +8,33 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_type_mismatch.carbon
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:19: ERROR: Cannot implicitly convert from `String` to `i32`.
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:19: error: cannot implicitly convert from `String` to `i32`
// CHECK:STDERR: var a: [i32; 3] = (1, "Hello", "World");
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: Type `String` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: type `String` does not implement interface `ImplicitAs`
// CHECK:STDERR: var a: [i32; 3] = (1, "Hello", "World");
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
var a: [i32; 3] = (1, "Hello", "World");
var t1: (i32, String, String);
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:19: ERROR: Cannot implicitly convert from `String` to `i32`.
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:19: error: cannot implicitly convert from `String` to `i32`
// CHECK:STDERR: var b: [i32; 3] = t1;
// CHECK:STDERR: ^~
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: Type `String` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: type `String` does not implement interface `ImplicitAs`
// CHECK:STDERR: var b: [i32; 3] = t1;
// CHECK:STDERR: ^~
// CHECK:STDERR:
var b: [i32; 3] = t1;
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: ERROR: Cannot initialize array of 3 element(s) from 2 initializer(s).
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: error: cannot initialize array of 3 element(s) from 2 initializer(s)
// CHECK:STDERR: var c: [i32; 3] = (1, 2);
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR:
var c: [i32; 3] = (1, 2);
var t2: (i32, i32);
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:19: ERROR: Cannot initialize array of 3 element(s) from tuple with 2 element(s).
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:19: error: cannot initialize array of 3 element(s) from tuple with 2 element(s).
// CHECK:STDERR: var d: [i32; 3] = t2;
// CHECK:STDERR: ^~
var d: [i32; 3] = t2;
+1 -1
View File
@@ -8,7 +8,7 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_undefined_bound.carbon
// CHECK:STDERR: fail_undefined_bound.carbon:[[@LINE+3]]:8: ERROR: Semantics TODO: `HandleArrayExprWithoutBounds`.
// CHECK:STDERR: fail_undefined_bound.carbon:[[@LINE+3]]:8: error: semantics TODO: `HandleArrayExprWithoutBounds`
// CHECK:STDERR: var a: [i32; ];
// CHECK:STDERR: ^~~~~~~
var a: [i32; ];
+3 -3
View File
@@ -76,7 +76,7 @@ let b_value: B = ({.x = 1, .y = 2} as A) as B;
// a copy to perform initialization. It's not clear whether that is the right
// behavior.
// CHECK:STDERR: fail_init_class.carbon:[[@LINE+4]]:17: ERROR: Cannot copy value of type `B`.
// CHECK:STDERR: fail_init_class.carbon:[[@LINE+4]]:17: error: cannot copy value of type `B`
// CHECK:STDERR: var b_init: B = ({.x = 1, .y = 2} as A) as B;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -97,10 +97,10 @@ class B {
// We do not try to implicitly convert from the first operand of `as` to the
// adapted type of the second operand.
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+6]]:12: ERROR: Cannot convert from `{.x: i32}` to `B` with `as`.
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+6]]:12: error: cannot convert from `{.x: i32}` to `B` with `as`
// CHECK:STDERR: var b: B = {.x = 1} as B;
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+3]]:12: Type `{.x: i32}` does not implement interface `As`.
// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+3]]:12: type `{.x: i32}` does not implement interface `As`
// CHECK:STDERR: var b: B = {.x = 1} as B;
// CHECK:STDERR: ^~~~~~~~~~~~~
var b: B = {.x = 1} as B;
+2 -2
View File
@@ -8,10 +8,10 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/fail_no_conversion.carbon
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+6]]:21: ERROR: Cannot convert from `i32` to `(i32, i32)` with `as`.
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+6]]:21: error: cannot convert from `i32` to `(i32, i32)` with `as`
// CHECK:STDERR: let n: (i32, i32) = 1 as (i32, i32);
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:21: Type `i32` does not implement interface `As`.
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:21: type `i32` does not implement interface `As`
// CHECK:STDERR: let n: (i32, i32) = 1 as (i32, i32);
// CHECK:STDERR: ^~~~~~~~~~~~~~~
let n: (i32, i32) = 1 as (i32, i32);
+2 -2
View File
@@ -8,10 +8,10 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/fail_not_type.carbon
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+6]]:19: ERROR: Cannot implicitly convert from `i32` to `type`.
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+6]]:19: error: cannot implicitly convert from `i32` to `type`
// CHECK:STDERR: let n: i32 = 1 as 2;
// CHECK:STDERR: ^
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:19: Type `i32` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:19: type `i32` does not implement interface `ImplicitAs`
// CHECK:STDERR: let n: i32 = 1 as 2;
// CHECK:STDERR: ^
let n: i32 = 1 as 2;
+2 -2
View File
@@ -8,11 +8,11 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_bad_run.carbon
// CHECK:STDERR: fail_bad_run.carbon:[[@LINE+7]]:1: ERROR: Invalid signature for `Main.Run` function. Expected `fn ()` or `fn () -> i32`.
// CHECK:STDERR: fail_bad_run.carbon:[[@LINE+7]]:1: error: invalid signature for `Main.Run` function; expected `fn ()` or `fn () -> i32`
// CHECK:STDERR: fn Run() -> String {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_bad_run.carbon:[[@LINE+3]]:21: ERROR: Missing `return` at end of function with declared return type.
// CHECK:STDERR: fail_bad_run.carbon:[[@LINE+3]]:21: error: missing `return` at end of function with declared return type
// CHECK:STDERR: fn Run() -> String {}
// CHECK:STDERR: ^
fn Run() -> String {}
+1 -1
View File
@@ -8,7 +8,7 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_bad_run_2.carbon
// CHECK:STDERR: fail_bad_run_2.carbon:[[@LINE+3]]:1: ERROR: Invalid signature for `Main.Run` function. Expected `fn ()` or `fn () -> i32`.
// CHECK:STDERR: fail_bad_run_2.carbon:[[@LINE+3]]:1: error: invalid signature for `Main.Run` function; expected `fn ()` or `fn () -> i32`
// CHECK:STDERR: fn Run(n: i32) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
fn Run(n: i32) {}
@@ -8,10 +8,10 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_non_type_as_type.carbon
// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+6]]:1: ERROR: Cannot implicitly convert from `i32` to `type`.
// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+6]]:1: error: cannot implicitly convert from `i32` to `type`
// CHECK:STDERR: var x: type = 42;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+3]]:1: Type `i32` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+3]]:1: type `i32` does not implement interface `ImplicitAs`
// CHECK:STDERR: var x: type = 42;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
var x: type = 42;
@@ -8,31 +8,31 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: ERROR: Integer literal with value 39999999999999999993 does not fit in i32.
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: integer literal with value 39999999999999999993 does not fit in i32
// CHECK:STDERR: let a: i32 = 39999999999999999993;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
let a: i32 = 39999999999999999993;
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: ERROR: Integer literal with value 2147483648 does not fit in i32.
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: integer literal with value 2147483648 does not fit in i32
// CHECK:STDERR: let b: i32 = 2_147_483_648;
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR:
let b: i32 = 2_147_483_648;
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: ERROR: Integer literal with value 2147483648 does not fit in i32.
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: integer literal with value 2147483648 does not fit in i32
// CHECK:STDERR: let c: i32 = 0x8000_0000;
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR:
let c: i32 = 0x8000_0000;
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: ERROR: Real mantissa with value 399999999999999999930 does not fit in i64.
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: error: real mantissa with value 399999999999999999930 does not fit in i64
// CHECK:STDERR: let d: f64 = 39999999999999999993.0e3;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
let d: f64 = 39999999999999999993.0e3;
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+3]]:14: ERROR: Real exponent with value 39999999999999999992 does not fit in i64.
// CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+3]]:14: error: real exponent with value 39999999999999999992 does not fit in i64
// CHECK:STDERR: let e: f64 = 5.0e39999999999999999993;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
let e: f64 = 5.0e39999999999999999993;
@@ -9,7 +9,7 @@
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon
var x: i32;
// CHECK:STDERR: fail_qualifier_unsupported.carbon:[[@LINE+3]]:14: ERROR: Type `i32` does not support qualified expressions.
// CHECK:STDERR: fail_qualifier_unsupported.carbon:[[@LINE+3]]:14: error: type `i32` does not support qualified expressions
// CHECK:STDERR: var y: i32 = x.b;
// CHECK:STDERR: ^~~
var y: i32 = x.b;
@@ -9,7 +9,7 @@
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon
fn Main() {
// CHECK:STDERR: fail_name_lookup.carbon:[[@LINE+3]]:3: ERROR: Name `x` not found.
// CHECK:STDERR: fail_name_lookup.carbon:[[@LINE+3]]:3: error: name `x` not found
// CHECK:STDERR: x;
// CHECK:STDERR: ^
x;
+13 -13
View File
@@ -18,28 +18,28 @@ var test_i64: i64;
// --- fail_iN_bad_width.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:14: ERROR: Name `i0` not found.
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:14: error: name `i0` not found
// CHECK:STDERR: var test_i0: i0;
// CHECK:STDERR: ^~
// CHECK:STDERR:
var test_i0: i0;
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:14: ERROR: Bit width of integer type literal must be a multiple of 8. Use `Core.Int(1)` instead.
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:14: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(1)` instead
// CHECK:STDERR: var test_i1: i1;
// CHECK:STDERR: ^~
// CHECK:STDERR:
var test_i1: i1;
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:15: ERROR: Bit width of integer type literal must be a multiple of 8. Use `Core.Int(15)` instead.
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:15: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(15)` instead
// CHECK:STDERR: var test_i15: i15;
// CHECK:STDERR: ^~~
// CHECK:STDERR:
var test_i15: i15;
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:23: ERROR: Integer type width of 1000000000 is greater than the maximum supported width of 8388608.
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:23: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608
// CHECK:STDERR: var test_i1000000000: i1000000000;
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR:
var test_i1000000000: i1000000000;
// TODO: This diagnostic is not very good.
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:33: ERROR: Integer literal with value 10000000000000000000 does not fit in i32.
// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:33: error: integer literal with value 10000000000000000000 does not fit in i32
// CHECK:STDERR: var test_i10000000000000000000: i10000000000000000000;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -55,28 +55,28 @@ var test_u64: u64;
// --- fail_uN_bad_width.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:14: ERROR: Name `u0` not found.
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:14: error: name `u0` not found
// CHECK:STDERR: var test_u0: u0;
// CHECK:STDERR: ^~
// CHECK:STDERR:
var test_u0: u0;
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:14: ERROR: Bit width of integer type literal must be a multiple of 8. Use `Core.UInt(1)` instead.
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:14: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(1)` instead
// CHECK:STDERR: var test_u1: u1;
// CHECK:STDERR: ^~
// CHECK:STDERR:
var test_u1: u1;
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:15: ERROR: Bit width of integer type literal must be a multiple of 8. Use `Core.UInt(15)` instead.
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:15: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(15)` instead
// CHECK:STDERR: var test_u15: u15;
// CHECK:STDERR: ^~~
// CHECK:STDERR:
var test_u15: u15;
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:23: ERROR: Integer type width of 1000000000 is greater than the maximum supported width of 8388608.
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:23: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608
// CHECK:STDERR: var test_u1000000000: u1000000000;
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR:
var test_u1000000000: u1000000000;
// TODO: This diagnostic is not very good.
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:33: ERROR: Integer literal with value 10000000000000000000 does not fit in i32.
// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:33: error: integer literal with value 10000000000000000000 does not fit in i32
// CHECK:STDERR: var test_u10000000000000000000: u10000000000000000000;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -85,12 +85,12 @@ var test_u10000000000000000000: u10000000000000000000;
// --- fail_fN_bad_width.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:14: ERROR: Name `f0` not found.
// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:14: error: name `f0` not found
// CHECK:STDERR: var test_f0: f0;
// CHECK:STDERR: ^~
// CHECK:STDERR:
var test_f0: f0;
// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:14: ERROR: Semantics TODO: `Currently only f64 is allowed`.
// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+4]]:14: error: semantics TODO: `Currently only f64 is allowed`
// CHECK:STDERR: var test_f1: f1;
// CHECK:STDERR: ^~
// CHECK:STDERR:
@@ -104,7 +104,7 @@ var test_f1000000000000: f1000000000000;
library "[[@TEST_NAME]]";
// TODO: Some or all of these should eventually work.
// CHECK:STDERR: fail_fN_todo_unsupported.carbon:[[@LINE+3]]:15: ERROR: Semantics TODO: `Currently only f64 is allowed`.
// CHECK:STDERR: fail_fN_todo_unsupported.carbon:[[@LINE+3]]:15: error: semantics TODO: `Currently only f64 is allowed`
// CHECK:STDERR: var test_f16: f16;
// CHECK:STDERR: ^~~
var test_f16: f16;
+3 -3
View File
@@ -22,17 +22,17 @@ var x: f64 = Add(2.2, 2.3);
package FailBadDecl;
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "float.add".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add"
// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.add";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooFew(a: f64) -> f64 = "float.add";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "float.add".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.add"
// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: ERROR: Invalid signature for builtin function "float.add".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "float.add"
// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.add";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fn BadReturnType(a: f64, b: f64) -> bool = "float.add";
+3 -3
View File
@@ -24,17 +24,17 @@ let c: f64 = Div(0.0, 0.0);
package FailBadDecl;
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "float.div".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div"
// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.div";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooFew(a: f64) -> f64 = "float.div";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "float.div".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div"
// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: ERROR: Invalid signature for builtin function "float.div".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "float.div"
// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.div";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fn BadReturnType(a: f64, b: f64) -> bool = "float.div";
+1 -1
View File
@@ -28,7 +28,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool {
package FailBadDecl;
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: ERROR: Invalid signature for builtin function "float.eq".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "float.eq"
// CHECK:STDERR: fn WrongResult(a: f64, b: f64) -> f64 = "float.eq";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fn WrongResult(a: f64, b: f64) -> f64 = "float.eq";
+2 -2
View File
@@ -32,14 +32,14 @@ library "[[@TEST_NAME]]";
import library "types";
// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+4]]:20: ERROR: Bit width must be 64.
// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+4]]:20: error: bit width must be 64
// CHECK:STDERR: var invalid_float: Float(32);
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR:
var invalid_float: Float(32);
var dyn_size: i32 = 64;
// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+3]]:10: ERROR: Cannot evaluate type expression.
// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+3]]:10: error: cannot evaluate type expression
// CHECK:STDERR: var dyn: Float(dyn_size);
// CHECK:STDERR: ^~~~~~~~~~~~~~~
var dyn: Float(dyn_size);
+3 -3
View File
@@ -22,17 +22,17 @@ var x: f64 = Mul(2.0, 0.5);
package FailBadDecl;
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "float.mul".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul"
// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.mul";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooFew(a: f64) -> f64 = "float.mul";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "float.mul".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.mul"
// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: ERROR: Invalid signature for builtin function "float.mul".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "float.mul"
// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.mul";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fn BadReturnType(a: f64, b: f64) -> bool = "float.mul";
+9 -9
View File
@@ -22,17 +22,17 @@ let a: f64 = Negate(1.5);
package FailBadDecl;
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "float.negate".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate"
// CHECK:STDERR: fn TooFew() -> f64 = "float.negate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooFew() -> f64 = "float.negate";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "float.negate".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate"
// CHECK:STDERR: fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "float.negate".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.negate"
// CHECK:STDERR: fn BadReturnType(a: f64) -> bool = "float.negate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -40,10 +40,10 @@ fn BadReturnType(a: f64) -> bool = "float.negate";
fn JustRight(a: f64) -> f64 = "float.negate";
fn RuntimeCallTooFew(a: f64) -> f64 {
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: ERROR: 1 argument(s) passed to function expecting 0 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 1 argument(s) passed to function expecting 0 argument(s).
// CHECK:STDERR: return TooFew(a);
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-17]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-17]]:1: calling function declared here
// CHECK:STDERR: fn TooFew() -> f64 = "float.negate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -51,10 +51,10 @@ fn RuntimeCallTooFew(a: f64) -> f64 {
}
fn RuntimeCallTooMany(a: f64, b: f64, c: f64) -> f64 {
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: ERROR: 3 argument(s) passed to function expecting 2 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 3 argument(s) passed to function expecting 2 argument(s).
// CHECK:STDERR: return TooMany(a, b, c);
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-23]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-23]]:1: calling function declared here
// CHECK:STDERR: fn TooMany(a: f64, b: f64) -> f64 = "float.negate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -62,10 +62,10 @@ fn RuntimeCallTooMany(a: f64, b: f64, c: f64) -> f64 {
}
fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool {
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:10: ERROR: 2 argument(s) passed to function expecting 1 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:10: error: 2 argument(s) passed to function expecting 1 argument(s).
// CHECK:STDERR: return BadReturnType(a, b);
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-29]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-29]]:1: calling function declared here
// CHECK:STDERR: fn BadReturnType(a: f64) -> bool = "float.negate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
return BadReturnType(a, b);
+1 -1
View File
@@ -28,7 +28,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool {
package FailBadDecl;
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: ERROR: Invalid signature for builtin function "float.neq".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "float.neq"
// CHECK:STDERR: fn WrongResult(a: f64, b: f64) -> f64 = "float.neq";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fn WrongResult(a: f64, b: f64) -> f64 = "float.neq";
+3 -3
View File
@@ -22,17 +22,17 @@ var x: f64 = Sub(2.0, 0.5);
package FailBadDecl;
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "float.sub".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub"
// CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.sub";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooFew(a: f64) -> f64 = "float.sub";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "float.sub".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.sub"
// CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: ERROR: Invalid signature for builtin function "float.sub".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "float.sub"
// CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.sub";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fn BadReturnType(a: f64, b: f64) -> bool = "float.sub";
+1 -1
View File
@@ -28,7 +28,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool {
package FailBadDecl;
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: ERROR: Invalid signature for builtin function "int.eq".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+3]]:1: error: invalid signature for builtin function "int.eq"
// CHECK:STDERR: fn WrongResult(a: i32, b: i32) -> i32 = "int.eq";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fn WrongResult(a: i32, b: i32) -> i32 = "int.eq";
+5 -5
View File
@@ -30,12 +30,12 @@ fn Negate(a: i32) -> i32 = "int.snegate";
// Shift greater than size is disallowed.
let size_1: i32 = LeftShift(1, 31);
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: ERROR: Shift distance not in range [0, 32) in 1 << 32.
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 << 32
// CHECK:STDERR: let size_2: i32 = LeftShift(1, 32);
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR:
let size_2: i32 = LeftShift(1, 32);
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: ERROR: Shift distance not in range [0, 32) in 1 << 33.
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 << 33
// CHECK:STDERR: let size_3: i32 = LeftShift(1, 33);
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR:
@@ -43,7 +43,7 @@ let size_3: i32 = LeftShift(1, 33);
// Overflow is allowed if the shift distance is in bounds.
let overflow_1: i32 = LeftShift(1000, 31);
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:23: ERROR: Shift distance not in range [0, 32) in 1000 << 32.
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:23: error: shift distance not in range [0, 32) in 1000 << 32
// CHECK:STDERR: let overflow_2: i32 = LeftShift(1000, 32);
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR:
@@ -51,14 +51,14 @@ let overflow_2: i32 = LeftShift(1000, 32);
// Oversize shifts aren't allowed even if there's no overflow.
let no_overflow_1: i32 = LeftShift(0, 31);
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: ERROR: Shift distance not in range [0, 32) in 0 << 32.
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:26: error: shift distance not in range [0, 32) in 0 << 32
// CHECK:STDERR: let no_overflow_2: i32 = LeftShift(0, 32);
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR:
let no_overflow_2: i32 = LeftShift(0, 32);
// Negative shifts aren't allowed either.
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: ERROR: Shift distance not in range [0, 32) in 1 << -1.
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: error: shift distance not in range [0, 32) in 1 << -1
// CHECK:STDERR: let negative: i32 = LeftShift(1, Negate(1));
// CHECK:STDERR: ^~~~~~~~~~
let negative: i32 = LeftShift(1, Negate(1));
@@ -38,7 +38,7 @@ library "[[@TEST_NAME]]";
import library "types";
// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+4]]:8: ERROR: Integer type width of 0 is not positive.
// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+4]]:8: error: integer type width of 0 is not positive
// CHECK:STDERR: var n: Int(0);
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
@@ -52,7 +52,7 @@ import library "types";
fn Negate(n: i32) -> i32 = "int.snegate";
// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+4]]:8: ERROR: Integer type width of -1 is not positive.
// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+4]]:8: error: integer type width of -1 is not positive
// CHECK:STDERR: var n: Int(Negate(1));
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
@@ -64,7 +64,7 @@ library "[[@TEST_NAME]]";
import library "types";
// CHECK:STDERR: fail_oversized.carbon:[[@LINE+3]]:8: ERROR: Integer type width of 1000000000 is greater than the maximum supported width of 8388608.
// CHECK:STDERR: fail_oversized.carbon:[[@LINE+3]]:8: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608
// CHECK:STDERR: var m: Int(1000000000);
// CHECK:STDERR: ^~~~
var m: Int(1000000000);
@@ -38,7 +38,7 @@ library "[[@TEST_NAME]]";
import library "types";
// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+4]]:8: ERROR: Integer type width of 0 is not positive.
// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+4]]:8: error: integer type width of 0 is not positive
// CHECK:STDERR: var n: UInt(0);
// CHECK:STDERR: ^~~~~
// CHECK:STDERR:
@@ -52,7 +52,7 @@ import library "types";
fn Negate(n: i32) -> i32 = "int.snegate";
// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+4]]:8: ERROR: Integer type width of -1 is not positive.
// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+4]]:8: error: integer type width of -1 is not positive
// CHECK:STDERR: var n: UInt(Negate(1));
// CHECK:STDERR: ^~~~~
// CHECK:STDERR:
@@ -64,7 +64,7 @@ library "[[@TEST_NAME]]";
import library "types";
// CHECK:STDERR: fail_oversized.carbon:[[@LINE+3]]:8: ERROR: Integer type width of 1000000000 is greater than the maximum supported width of 8388608.
// CHECK:STDERR: fail_oversized.carbon:[[@LINE+3]]:8: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608
// CHECK:STDERR: var m: UInt(1000000000);
// CHECK:STDERR: ^~~~~
var m: UInt(1000000000);
+3 -3
View File
@@ -47,19 +47,19 @@ fn Negate(a: i32) -> i32 = "int.snegate";
// Shift greater than size is disallowed.
let size_1: i32 = RightShift(1, 31);
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: ERROR: Shift distance not in range [0, 32) in 1 >> 32.
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 >> 32
// CHECK:STDERR: let size_2: i32 = RightShift(1, 32);
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR:
let size_2: i32 = RightShift(1, 32);
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: ERROR: Shift distance not in range [0, 32) in 1 >> 33.
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+4]]:19: error: shift distance not in range [0, 32) in 1 >> 33
// CHECK:STDERR: let size_3: i32 = RightShift(1, 33);
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR:
let size_3: i32 = RightShift(1, 33);
// Negative shifts aren't allowed either.
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: ERROR: Shift distance not in range [0, 32) in 1 >> -1.
// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+3]]:21: error: shift distance not in range [0, 32) in 1 >> -1
// CHECK:STDERR: let negative: i32 = RightShift(1, Negate(1));
// CHECK:STDERR: ^~~~~~~~~~~
let negative: i32 = RightShift(1, Negate(1));
+9 -9
View File
@@ -23,43 +23,43 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
package FailBadDecl;
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "int.sadd".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd"
// CHECK:STDERR: fn TooFew(a: i32) -> i32 = "int.sadd";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooFew(a: i32) -> i32 = "int.sadd";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "int.sadd".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd"
// CHECK:STDERR: fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.sadd";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.sadd";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "int.sadd".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.sadd"
// CHECK:STDERR: fn BadReturnType(a: i32, b: i32) -> bool = "int.sadd";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn BadReturnType(a: i32, b: i32) -> bool = "int.sadd";
fn JustRight(a: i32, b: i32) -> i32 = "int.sadd";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: ERROR: Array bound is not a constant.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error: array bound is not a constant
// CHECK:STDERR: var too_few: [i32; TooFew(1)];
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
var too_few: [i32; TooFew(1)];
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: ERROR: Array bound is not a constant.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error: array bound is not a constant
// CHECK:STDERR: var too_many: [i32; TooMany(1, 2, 3)];
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
var too_many: [i32; TooMany(1, 2, 3)];
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: ERROR: Array bound is not a constant.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error: array bound is not a constant
// CHECK:STDERR: var bad_return_type: [i32; BadReturnType(1, 2)];
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
var bad_return_type: [i32; BadReturnType(1, 2)];
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: ERROR: 3 argument(s) passed to function expecting 2 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: error: 3 argument(s) passed to function expecting 2 argument(s).
// CHECK:STDERR: var bad_call: [i32; JustRight(1, 2, 3)];
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: calling function declared here
// CHECK:STDERR: fn JustRight(a: i32, b: i32) -> i32 = "int.sadd";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -84,7 +84,7 @@ package FailOverflow;
fn Add(a: i32, b: i32) -> i32 = "int.sadd";
let a: i32 = Add(0x7FFFFFFF, 0);
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: ERROR: Integer overflow in calculation 2147483647 + 1.
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation 2147483647 + 1
// CHECK:STDERR: let b: i32 = Add(0x7FFFFFFF, 1);
// CHECK:STDERR: ^~~~
let b: i32 = Add(0x7FFFFFFF, 1);
+3 -3
View File
@@ -34,7 +34,7 @@ let a: i32 = Div(Negate(0x7FFF_FFFF), Negate(1));
let b: i32 = Div(Sub(Negate(0x7FFF_FFFF), 1), 1);
// -0x8000_0000 / -1 overflows.
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: ERROR: Integer overflow in calculation -2147483648 / -1.
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation -2147483648 / -1
// CHECK:STDERR: let c: i32 = Div(Sub(Negate(0x7FFF_FFFF), 1), Negate(1));
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
@@ -46,13 +46,13 @@ package FailDivByZero;
fn Div(a: i32, b: i32) -> i32 = "int.sdiv";
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: ERROR: Division by zero.
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero
// CHECK:STDERR: let a: i32 = Div(1, 0);
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
let a: i32 = Div(1, 0);
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: ERROR: Division by zero.
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error: division by zero
// CHECK:STDERR: let b: i32 = Div(0, 0);
// CHECK:STDERR: ^~~~
let b: i32 = Div(0, 0);
+3 -3
View File
@@ -35,7 +35,7 @@ let b: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), 1);
// -0x8000_0000 / -1 overflows, so -0x8000_0000 % -1 is disallowed, even though
// its result is representable.
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: ERROR: Integer overflow in calculation -2147483648 % -1.
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+4]]:14: error: integer overflow in calculation -2147483648 % -1
// CHECK:STDERR: let c: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), Negate(1));
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
@@ -49,13 +49,13 @@ fn Mod(a: i32, b: i32) -> i32 = "int.smod";
// Remainder of division by zero is not defined.
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: ERROR: Division by zero.
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero
// CHECK:STDERR: let a: i32 = Mod(1, 0);
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
let a: i32 = Mod(1, 0);
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: ERROR: Division by zero.
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error: division by zero
// CHECK:STDERR: let b: i32 = Mod(0, 0);
// CHECK:STDERR: ^~~~
let b: i32 = Mod(0, 0);
+1 -1
View File
@@ -26,7 +26,7 @@ package FailOverflow;
fn Mul(a: i32, b: i32) -> i32 = "int.smul";
let a: i32 = Mul(0x7FFF, 0x10000);
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: ERROR: Integer overflow in calculation 32768 * 65536.
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation 32768 * 65536
// CHECK:STDERR: let b: i32 = Mul(0x8000, 0x10000);
// CHECK:STDERR: ^~~~
let b: i32 = Mul(0x8000, 0x10000);
+15 -15
View File
@@ -25,53 +25,53 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
package FailBadDecl;
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "int.snegate".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.snegate"
// CHECK:STDERR: fn TooFew() -> i32 = "int.snegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooFew() -> i32 = "int.snegate";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "int.snegate".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.snegate"
// CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.snegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooMany(a: i32, b: i32) -> i32 = "int.snegate";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "int.snegate".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.snegate"
// CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.snegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn BadReturnType(a: i32) -> bool = "int.snegate";
fn JustRight(a: i32) -> i32 = "int.snegate";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: ERROR: Array bound is not a constant.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error: array bound is not a constant
// CHECK:STDERR: var too_few: [i32; TooFew()];
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
var too_few: [i32; TooFew()];
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: ERROR: Array bound is not a constant.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error: array bound is not a constant
// CHECK:STDERR: var too_many: [i32; TooMany(1, 2)];
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
var too_many: [i32; TooMany(1, 2)];
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: ERROR: Array bound is not a constant.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error: array bound is not a constant
// CHECK:STDERR: var bad_return_type: [i32; BadReturnType(1)];
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
var bad_return_type: [i32; BadReturnType(1)];
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: ERROR: 2 argument(s) passed to function expecting 1 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: error: 2 argument(s) passed to function expecting 1 argument(s).
// CHECK:STDERR: var bad_call: [i32; JustRight(1, 2)];
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: calling function declared here
// CHECK:STDERR: fn JustRight(a: i32) -> i32 = "int.snegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
var bad_call: [i32; JustRight(1, 2)];
fn RuntimeCallTooFew(a: i32) -> i32 {
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: ERROR: 1 argument(s) passed to function expecting 0 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 1 argument(s) passed to function expecting 0 argument(s).
// CHECK:STDERR: return TooFew(a);
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-42]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-42]]:1: calling function declared here
// CHECK:STDERR: fn TooFew() -> i32 = "int.snegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -79,10 +79,10 @@ fn RuntimeCallTooFew(a: i32) -> i32 {
}
fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 {
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: ERROR: 3 argument(s) passed to function expecting 2 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 3 argument(s) passed to function expecting 2 argument(s).
// CHECK:STDERR: return TooMany(a, b, c);
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-48]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-48]]:1: calling function declared here
// CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.snegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -90,10 +90,10 @@ fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 {
}
fn RuntimeCallBadReturnType(a: i32, b: i32) -> bool {
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: ERROR: 2 argument(s) passed to function expecting 1 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 2 argument(s) passed to function expecting 1 argument(s).
// CHECK:STDERR: return BadReturnType(a, b);
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-54]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-54]]:1: calling function declared here
// CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.snegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -111,7 +111,7 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub";
let a: i32 = Negate(Negate(0x7FFFFFFF));
// -(-INT_MAX - 1) is too large for i32.
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: ERROR: Integer overflow in negation of -2147483648.
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in negation of -2147483648
// CHECK:STDERR: let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1));
// CHECK:STDERR: ^~~~~~~
let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1));
+1 -1
View File
@@ -27,7 +27,7 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub";
let a: i32 = Sub(0, 0x7FFFFFFF);
let b: i32 = Sub(Sub(0, 0x7FFFFFFF), 1);
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: ERROR: Integer overflow in calculation -2147483647 - 2.
// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:14: error: integer overflow in calculation -2147483647 - 2
// CHECK:STDERR: let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2);
// CHECK:STDERR: ^~~~
let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2);
+8 -8
View File
@@ -23,43 +23,43 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
package FailBadDecl;
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "int.uadd".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.uadd"
// CHECK:STDERR: fn TooFew(a: i32) -> i32 = "int.uadd";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooFew(a: i32) -> i32 = "int.uadd";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "int.uadd".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.uadd"
// CHECK:STDERR: fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.uadd";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.uadd";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "int.uadd".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.uadd"
// CHECK:STDERR: fn BadReturnType(a: i32, b: i32) -> bool = "int.uadd";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn BadReturnType(a: i32, b: i32) -> bool = "int.uadd";
fn JustRight(a: i32, b: i32) -> i32 = "int.uadd";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: ERROR: Array bound is not a constant.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error: array bound is not a constant
// CHECK:STDERR: var too_few: [i32; TooFew(1)];
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
var too_few: [i32; TooFew(1)];
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: ERROR: Array bound is not a constant.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error: array bound is not a constant
// CHECK:STDERR: var too_many: [i32; TooMany(1, 2, 3)];
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
var too_many: [i32; TooMany(1, 2, 3)];
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: ERROR: Array bound is not a constant.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error: array bound is not a constant
// CHECK:STDERR: var bad_return_type: [i32; BadReturnType(1, 2)];
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
var bad_return_type: [i32; BadReturnType(1, 2)];
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:21: ERROR: 3 argument(s) passed to function expecting 2 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:21: error: 3 argument(s) passed to function expecting 2 argument(s).
// CHECK:STDERR: var bad_call: [i32; JustRight(1, 2, 3)];
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: calling function declared here
// CHECK:STDERR: fn JustRight(a: i32, b: i32) -> i32 = "int.uadd";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var bad_call: [i32; JustRight(1, 2, 3)];
+2 -2
View File
@@ -42,13 +42,13 @@ package FailDivByZero;
fn Div(a: i32, b: i32) -> i32 = "int.udiv";
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: ERROR: Division by zero.
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero
// CHECK:STDERR: let a: i32 = Div(1, 0);
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
let a: i32 = Div(1, 0);
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: ERROR: Division by zero.
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error: division by zero
// CHECK:STDERR: let b: i32 = Div(0, 0);
// CHECK:STDERR: ^~~~
let b: i32 = Div(0, 0);
+2 -2
View File
@@ -44,13 +44,13 @@ fn Mod(a: i32, b: i32) -> i32 = "int.umod";
// Remainder of division by zero is not defined.
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: ERROR: Division by zero.
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+4]]:14: error: division by zero
// CHECK:STDERR: let a: i32 = Mod(1, 0);
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
let a: i32 = Mod(1, 0);
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: ERROR: Division by zero.
// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+3]]:14: error: division by zero
// CHECK:STDERR: let b: i32 = Mod(0, 0);
// CHECK:STDERR: ^~~~
let b: i32 = Mod(0, 0);
+14 -14
View File
@@ -25,53 +25,53 @@ fn RuntimeCall(a: i32, b: i32) -> i32 {
package FailBadDecl;
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "int.unegate".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.unegate"
// CHECK:STDERR: fn TooFew() -> i32 = "int.unegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooFew() -> i32 = "int.unegate";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "int.unegate".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.unegate"
// CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.unegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn TooMany(a: i32, b: i32) -> i32 = "int.unegate";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: ERROR: Invalid signature for builtin function "int.unegate".
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.unegate"
// CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.unegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
fn BadReturnType(a: i32) -> bool = "int.unegate";
fn JustRight(a: i32) -> i32 = "int.unegate";
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: ERROR: Array bound is not a constant.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:20: error: array bound is not a constant
// CHECK:STDERR: var too_few: [i32; TooFew()];
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
var too_few: [i32; TooFew()];
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: ERROR: Array bound is not a constant.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:21: error: array bound is not a constant
// CHECK:STDERR: var too_many: [i32; TooMany(1, 2)];
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
var too_many: [i32; TooMany(1, 2)];
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: ERROR: Array bound is not a constant.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:28: error: array bound is not a constant
// CHECK:STDERR: var bad_return_type: [i32; BadReturnType(1)];
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR:
var bad_return_type: [i32; BadReturnType(1)];
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: ERROR: 2 argument(s) passed to function expecting 1 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:21: error: 2 argument(s) passed to function expecting 1 argument(s).
// CHECK:STDERR: var bad_call: [i32; JustRight(1, 2)];
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-21]]:1: calling function declared here
// CHECK:STDERR: fn JustRight(a: i32) -> i32 = "int.unegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
var bad_call: [i32; JustRight(1, 2)];
fn RuntimeCallTooFew(a: i32) -> i32 {
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: ERROR: 1 argument(s) passed to function expecting 0 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 1 argument(s) passed to function expecting 0 argument(s).
// CHECK:STDERR: return TooFew(a);
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-42]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-42]]:1: calling function declared here
// CHECK:STDERR: fn TooFew() -> i32 = "int.unegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -79,10 +79,10 @@ fn RuntimeCallTooFew(a: i32) -> i32 {
}
fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 {
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: ERROR: 3 argument(s) passed to function expecting 2 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+7]]:10: error: 3 argument(s) passed to function expecting 2 argument(s).
// CHECK:STDERR: return TooMany(a, b, c);
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-48]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-48]]:1: calling function declared here
// CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.unegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -90,10 +90,10 @@ fn RuntimeCallTooMany(a: i32, b: i32, c: i32) -> i32 {
}
fn RuntimeCallBadReturnType(a: i32, b: i32) -> bool {
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:10: ERROR: 2 argument(s) passed to function expecting 1 argument(s).
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+6]]:10: error: 2 argument(s) passed to function expecting 1 argument(s).
// CHECK:STDERR: return BadReturnType(a, b);
// CHECK:STDERR: ^~~~~~~~~~~~~~
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-54]]:1: Calling function declared here.
// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE-54]]:1: calling function declared here
// CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.unegate";
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
return BadReturnType(a, b);
+14 -14
View File
@@ -27,35 +27,35 @@ class Circle {
fn Run() {
let circle: Circle = Circle.Make();
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:21: ERROR: Cannot access private member `radius` of type `Circle`.
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:21: error: cannot access private member `radius` of type `Circle`
// CHECK:STDERR: let radius: i32 = circle.radius;
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-17]]:15: The private member `radius` is defined here.
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-17]]:15: the private member `radius` is defined here
// CHECK:STDERR: private var radius: i32;
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR:
let radius: i32 = circle.radius;
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: ERROR: Cannot access private member `radius` of type `Circle`.
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: error: cannot access private member `radius` of type `Circle`
// CHECK:STDERR: circle.radius = 5;
// CHECK:STDERR: ^~~~~~~~~~~~~
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-25]]:15: The private member `radius` is defined here.
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-25]]:15: the private member `radius` is defined here
// CHECK:STDERR: private var radius: i32;
// CHECK:STDERR: ^~~~~~~~~~~
// CHECK:STDERR:
circle.radius = 5;
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: ERROR: Cannot access private member `SOME_INTERNAL_CONSTANT` of type `Circle`.
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: error: cannot access private member `SOME_INTERNAL_CONSTANT` of type `Circle`
// CHECK:STDERR: circle.SOME_INTERNAL_CONSTANT;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-32]]:15: The private member `SOME_INTERNAL_CONSTANT` is defined here.
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-32]]:15: the private member `SOME_INTERNAL_CONSTANT` is defined here
// CHECK:STDERR: private let SOME_INTERNAL_CONSTANT: i32 = 5;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
circle.SOME_INTERNAL_CONSTANT;
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: ERROR: Cannot access private member `SomeInternalFunction` of type `Circle`.
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+7]]:3: error: cannot access private member `SomeInternalFunction` of type `Circle`
// CHECK:STDERR: circle.SomeInternalFunction();
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-39]]:3: The private member `SomeInternalFunction` is defined here.
// CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-39]]:3: the private member `SomeInternalFunction` is defined here
// CHECK:STDERR: private fn SomeInternalFunction() -> i32 {
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -71,10 +71,10 @@ class A {
}
fn Run() {
// CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE+7]]:16: ERROR: Cannot access protected member `x` of type `A`.
// CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE+7]]:16: error: cannot access protected member `x` of type `A`
// CHECK:STDERR: let x: i32 = A.x;
// CHECK:STDERR: ^~~
// CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE-7]]:17: The protected member `x` is defined here.
// CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE-7]]:17: the protected member `x` is defined here
// CHECK:STDERR: protected var x: i32;
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR:
@@ -120,18 +120,18 @@ class A {
private let y: i32 = 5;
}
// CHECK:STDERR: fail_global_access.carbon:[[@LINE+7]]:14: ERROR: Cannot access protected member `x` of type `A`.
// CHECK:STDERR: fail_global_access.carbon:[[@LINE+7]]:14: error: cannot access protected member `x` of type `A`
// CHECK:STDERR: let x: i32 = A.x;
// CHECK:STDERR: ^~~
// CHECK:STDERR: fail_global_access.carbon:[[@LINE-7]]:17: The protected member `x` is defined here.
// CHECK:STDERR: fail_global_access.carbon:[[@LINE-7]]:17: the protected member `x` is defined here
// CHECK:STDERR: protected let x: i32 = 5;
// CHECK:STDERR: ^
// CHECK:STDERR:
let x: i32 = A.x;
// CHECK:STDERR: fail_global_access.carbon:[[@LINE+6]]:14: ERROR: Cannot access private member `y` of type `A`.
// CHECK:STDERR: fail_global_access.carbon:[[@LINE+6]]:14: error: cannot access private member `y` of type `A`
// CHECK:STDERR: let y: i32 = A.y;
// CHECK:STDERR: ^~~
// CHECK:STDERR: fail_global_access.carbon:[[@LINE-14]]:15: The private member `y` is defined here.
// CHECK:STDERR: fail_global_access.carbon:[[@LINE-14]]:15: the private member `y` is defined here
// CHECK:STDERR: private let y: i32 = 5;
// CHECK:STDERR: ^
let y: i32 = A.y;
+1 -1
View File
@@ -39,7 +39,7 @@ class AdaptNotExtend {
fn F(a: AdaptNotExtend) {
// `Adapted` is not extended, so lookup for `F` finds nothing.
// CHECK:STDERR: fail_not_extend.carbon:[[@LINE+3]]:3: ERROR: Name `F` not found.
// CHECK:STDERR: fail_not_extend.carbon:[[@LINE+3]]:3: error: name `F` not found
// CHECK:STDERR: a.F();
// CHECK:STDERR: ^~~
a.F();
+13 -13
View File
@@ -48,13 +48,13 @@ library "[[@TEST_NAME]]";
import Other library "other_extern";
// CHECK:STDERR: fail_extern.carbon:[[@LINE+10]]:8: ERROR: Variable has incomplete type `C`.
// CHECK:STDERR: fail_extern.carbon:[[@LINE+10]]:8: error: Variable has incomplete type `C`
// CHECK:STDERR: var c: Other.C = {};
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_extern.carbon:[[@LINE-5]]:1: In import.
// CHECK:STDERR: fail_extern.carbon:[[@LINE-5]]:1: in import
// CHECK:STDERR: import Other library "other_extern";
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR: other_extern.carbon:4:1: Class was forward declared here.
// CHECK:STDERR: other_extern.carbon:4:1: class was forward declared here
// CHECK:STDERR: extern class C;
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -64,22 +64,22 @@ var c: Other.C = {};
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+12]]:1: In import.
// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+12]]:1: in import
// CHECK:STDERR: import Other library "other_define";
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR: other_extern.carbon:4:1: ERROR: Duplicate name being declared in the same scope.
// CHECK:STDERR: other_extern.carbon:4:1: error: duplicate name being declared in the same scope
// CHECK:STDERR: extern class C;
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+6]]:1: In import.
// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+6]]:1: in import
// CHECK:STDERR: import Other library "other_define";
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR: other_define.carbon:4:1: Name is previously declared here.
// CHECK:STDERR: other_define.carbon:4:1: name is previously declared here
// CHECK:STDERR: class C {}
// CHECK:STDERR: ^~~~~~~~~
import Other library "other_define";
import Other library "other_extern";
// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:8: In name lookup for `C`.
// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:8: in name lookup for `C`
// CHECK:STDERR: var c: Other.C = {};
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
@@ -89,22 +89,22 @@ var c: Other.C = {};
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_conflict.carbon:[[@LINE+12]]:1: In import.
// CHECK:STDERR: fail_conflict.carbon:[[@LINE+12]]:1: in import
// CHECK:STDERR: import Other library "other_define";
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR: other_conflict.carbon:4:1: ERROR: Duplicate name being declared in the same scope.
// CHECK:STDERR: other_conflict.carbon:4:1: error: duplicate name being declared in the same scope
// CHECK:STDERR: fn C() {}
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR: fail_conflict.carbon:[[@LINE+6]]:1: In import.
// CHECK:STDERR: fail_conflict.carbon:[[@LINE+6]]:1: in import
// CHECK:STDERR: import Other library "other_define";
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR: other_define.carbon:4:1: Name is previously declared here.
// CHECK:STDERR: other_define.carbon:4:1: name is previously declared here
// CHECK:STDERR: class C {}
// CHECK:STDERR: ^~~~~~~~~
import Other library "other_define";
import Other library "other_conflict";
// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:8: In name lookup for `C`.
// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:8: in name lookup for `C`
// CHECK:STDERR: var c: Other.C = {};
// CHECK:STDERR: ^~~~~~~
var c: Other.C = {};
+6 -6
View File
@@ -48,13 +48,13 @@ class SomeClassAdapter {
}
fn F(a: SomeClassAdapter) {
// CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+10]]:3: ERROR: Cannot implicitly convert from `SomeClassAdapter` to `SomeClass`.
// CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+10]]:3: error: cannot implicitly convert from `SomeClassAdapter` to `SomeClass`
// CHECK:STDERR: a.F();
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+7]]:3: Type `SomeClassAdapter` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+7]]:3: type `SomeClassAdapter` does not implement interface `ImplicitAs`
// CHECK:STDERR: a.F();
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE-14]]:8: Initializing `self` parameter of method declared here.
// CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE-14]]:8: initializing `self` parameter of method declared here
// CHECK:STDERR: fn F[self: Self]();
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
@@ -75,10 +75,10 @@ class SomeClassAdapter {
}
fn F(a: SomeClassAdapter) -> i32 {
// CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+7]]:10: ERROR: Cannot implicitly convert from `SomeClassAdapter` to `SomeClass`.
// CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+7]]:10: error: cannot implicitly convert from `SomeClassAdapter` to `SomeClass`
// CHECK:STDERR: return a.b;
// CHECK:STDERR: ^~~
// CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+4]]:10: Type `SomeClassAdapter` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+4]]:10: type `SomeClassAdapter` does not implement interface `ImplicitAs`
// CHECK:STDERR: return a.b;
// CHECK:STDERR: ^~~
// CHECK:STDERR:
@@ -90,7 +90,7 @@ fn F(a: SomeClassAdapter) -> i32 {
library "[[@TEST_NAME]]";
class StructAdapter {
// CHECK:STDERR: fail_todo_adapt_non_class.carbon:[[@LINE+3]]:3: ERROR: Semantics TODO: `extending non-class type`.
// CHECK:STDERR: fail_todo_adapt_non_class.carbon:[[@LINE+3]]:3: error: semantics TODO: `extending non-class type`
// CHECK:STDERR: extend adapt {.a: i32, .b: i32};
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
extend adapt {.a: i32, .b: i32};
+1 -1
View File
@@ -20,7 +20,7 @@ class Derived {
fn Make() -> Derived {
// TODO: This should be valid, and should construct an instance of `partial Abstract` as the base.
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+3]]:19: ERROR: Cannot construct instance of abstract class. Consider using `partial Abstract` instead.
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+3]]:19: error: cannot construct instance of abstract class; consider using `partial Abstract` instead
// CHECK:STDERR: return {.base = {.a = 1}, .d = 7};
// CHECK:STDERR: ^~~~~~~~
return {.base = {.a = 1}, .d = 7};
+10 -10
View File
@@ -13,17 +13,17 @@
library "[[@TEST_NAME]]";
class Bad {
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+7]]:3: ERROR: Cannot implicitly convert from `i32` to `type`.
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `i32` to `type`
// CHECK:STDERR: adapt 100;
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:3: Type `i32` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:3: type `i32` does not implement interface `ImplicitAs`
// CHECK:STDERR: adapt 100;
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR:
adapt 100;
}
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:18: ERROR: Name `F` not found.
// CHECK:STDERR: fail_not_type.carbon:[[@LINE+4]]:18: error: name `F` not found
// CHECK:STDERR: fn Use(b: Bad) { b.F(); }
// CHECK:STDERR: ^~~
// CHECK:STDERR:
@@ -34,10 +34,10 @@ fn Use(b: Bad) { b.F(); }
library "[[@TEST_NAME]]";
class Bad {
// CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+7]]:3: ERROR: Cannot implicitly convert from `i32` to `type`.
// CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `i32` to `type`
// CHECK:STDERR: extend adapt 100;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+4]]:3: Type `i32` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+4]]:3: type `i32` does not implement interface `ImplicitAs`
// CHECK:STDERR: extend adapt 100;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -53,7 +53,7 @@ library "[[@TEST_NAME]]";
class MultipleAdapts {
adapt ();
// CHECK:STDERR: fail_repeated.carbon:[[@LINE+7]]:3: ERROR: Multiple `adapt` declarations in class.
// CHECK:STDERR: fail_repeated.carbon:[[@LINE+7]]:3: error: Multiple `adapt` declarations in class.
// CHECK:STDERR: adapt {};
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR: fail_repeated.carbon:[[@LINE-4]]:3: Previous `adapt` declaration is here.
@@ -65,7 +65,7 @@ class MultipleAdapts {
class MultipleAdaptsSameType {
adapt ();
// CHECK:STDERR: fail_repeated.carbon:[[@LINE+7]]:3: ERROR: Multiple `adapt` declarations in class.
// CHECK:STDERR: fail_repeated.carbon:[[@LINE+7]]:3: error: Multiple `adapt` declarations in class.
// CHECK:STDERR: adapt ();
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR: fail_repeated.carbon:[[@LINE-4]]:3: Previous `adapt` declaration is here.
@@ -79,14 +79,14 @@ class MultipleAdaptsSameType {
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+4]]:1: ERROR: `adapt` declaration can only be used in a class.
// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+4]]:1: error: `adapt` declaration can only be used in a class.
// CHECK:STDERR: adapt {};
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR:
adapt {};
interface I {
// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+4]]:3: ERROR: `adapt` declaration can only be used in a class.
// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+4]]:3: error: `adapt` declaration can only be used in a class.
// CHECK:STDERR: adapt {};
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR:
@@ -95,7 +95,7 @@ interface I {
class C {
interface I {
// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+3]]:5: ERROR: `adapt` declaration can only be used in a class.
// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+3]]:5: error: `adapt` declaration can only be used in a class.
// CHECK:STDERR: adapt {};
// CHECK:STDERR: ^~~~~~~~~
adapt {};
+2 -2
View File
@@ -15,10 +15,10 @@ library "[[@TEST_NAME]]";
class Incomplete;
class AdaptIncomplete {
// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+6]]:3: ERROR: Adapted type `Incomplete` is an incomplete type.
// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+6]]:3: error: Adapted type `Incomplete` is an incomplete type.
// CHECK:STDERR: adapt Incomplete;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-6]]:1: Class was forward declared here.
// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-6]]:1: class was forward declared here
// CHECK:STDERR: class Incomplete;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
adapt Incomplete;
+7 -7
View File
@@ -11,7 +11,7 @@
class B {}
class C1 {
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: ERROR: `private` not allowed on `adapt` declaration.
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `private` not allowed on `adapt` declaration
// CHECK:STDERR: private adapt B;
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
@@ -19,7 +19,7 @@ class C1 {
}
class C2 {
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: ERROR: `abstract` not allowed on `adapt` declaration.
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `abstract` not allowed on `adapt` declaration
// CHECK:STDERR: abstract adapt B;
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
@@ -27,7 +27,7 @@ class C2 {
}
class C3 {
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: ERROR: `default` not allowed on `adapt` declaration.
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: error: `default` not allowed on `adapt` declaration
// CHECK:STDERR: default adapt B;
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
@@ -35,10 +35,10 @@ class C3 {
}
class C4 {
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+7]]:10: ERROR: `extend` repeated on declaration.
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+7]]:10: error: `extend` repeated on declaration
// CHECK:STDERR: extend extend adapt B;
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: `extend` previously appeared here.
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+4]]:3: `extend` previously appeared here
// CHECK:STDERR: extend extend adapt B;
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR:
@@ -46,10 +46,10 @@ class C4 {
}
class C5 {
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+6]]:10: ERROR: `base` not allowed on declaration with `extend`.
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+6]]:10: error: `base` not allowed on declaration with `extend`
// CHECK:STDERR: extend base adapt B;
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+3]]:3: `extend` previously appeared here.
// CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+3]]:3: `extend` previously appeared here
// CHECK:STDERR: extend base adapt B;
// CHECK:STDERR: ^~~~~~
extend base adapt B;
@@ -15,7 +15,7 @@ library "[[@TEST_NAME]]";
base class Base {}
class AdaptWithBase {
// CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+3]]:3: ERROR: Adapter cannot have a base class.
// CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+3]]:3: error: Adapter cannot have a base class.
// CHECK:STDERR: adapt i32;
// CHECK:STDERR: ^~~~~~~~~~
adapt i32;
@@ -31,7 +31,7 @@ class AdaptWithBase {
library "[[@TEST_NAME]]";
class AdaptWithField {
// CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+3]]:3: ERROR: Adapter cannot have fields.
// CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+3]]:3: error: Adapter cannot have fields.
// CHECK:STDERR: adapt i32;
// CHECK:STDERR: ^~~~~~~~~~
adapt i32;
@@ -43,7 +43,7 @@ class AdaptWithField {
}
class AdaptWithFields {
// CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+3]]:3: ERROR: Adapter cannot have fields.
// CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+3]]:3: error: Adapter cannot have fields.
// CHECK:STDERR: adapt i32;
// CHECK:STDERR: ^~~~~~~~~~
adapt i32;
@@ -65,7 +65,7 @@ base class Base {}
class AdaptWithBaseAndFields {
extend base: Base;
var n: i32;
// CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE+6]]:3: ERROR: Adapter cannot have a base class.
// CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE+6]]:3: error: Adapter cannot have a base class.
// CHECK:STDERR: adapt {};
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE-5]]:3: `base` declaration is here.
+2 -2
View File
@@ -9,13 +9,13 @@
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_addr_not_self.carbon
class Class {
// CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+4]]:8: ERROR: `addr` can only be applied to a `self` parameter.
// CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+4]]:8: error: `addr` can only be applied to a `self` parameter
// CHECK:STDERR: fn F[addr a: Class*]();
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
fn F[addr a: Class*]();
// CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+3]]:8: ERROR: `addr` can only be applied to a `self` parameter.
// CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+3]]:8: error: `addr` can only be applied to a `self` parameter
// CHECK:STDERR: fn G(addr b: Class*);
// CHECK:STDERR: ^~~~
fn G(addr b: Class*);
+7 -7
View File
@@ -14,19 +14,19 @@ class Class {
}
fn F(c: Class, p: Class*) {
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE+7]]:6: ERROR: `addr self` method cannot be invoked on a value.
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE+7]]:6: error: `addr self` method cannot be invoked on a value
// CHECK:STDERR: c.F();
// CHECK:STDERR: ^
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE-8]]:13: Initializing `addr self` parameter of method declared here.
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE-8]]:13: initializing `addr self` parameter of method declared here
// CHECK:STDERR: fn F[addr self: Class*]();
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
c.F();
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE+7]]:6: ERROR: `addr self` method cannot be invoked on a value.
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE+7]]:6: error: `addr self` method cannot be invoked on a value
// CHECK:STDERR: c.G();
// CHECK:STDERR: ^
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE-16]]:13: Initializing `addr self` parameter of method declared here.
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE-16]]:13: initializing `addr self` parameter of method declared here
// CHECK:STDERR: fn G[addr self: Class]();
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
@@ -35,13 +35,13 @@ fn F(c: Class, p: Class*) {
// This call is OK.
(*p).F();
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE+9]]:3: ERROR: Cannot implicitly convert from `Class*` to `Class`.
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE+9]]:3: error: cannot implicitly convert from `Class*` to `Class`
// CHECK:STDERR: (*p).G();
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE+6]]:3: Type `Class*` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE+6]]:3: type `Class*` does not implement interface `ImplicitAs`
// CHECK:STDERR: (*p).G();
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE-31]]:13: Initializing `addr self` parameter of method declared here.
// CHECK:STDERR: fail_addr_self.carbon:[[@LINE-31]]:13: initializing `addr self` parameter of method declared here
// CHECK:STDERR: fn G[addr self: Class]();
// CHECK:STDERR: ^~~~
(*p).G();
@@ -10,11 +10,11 @@
namespace N;
// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+7]]:6: ERROR: `.` should be followed by a name.
// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+7]]:6: error: `.` should be followed by a name
// CHECK:STDERR: fn N.base() {}
// CHECK:STDERR: ^~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+3]]:6: ERROR: Semantics TODO: `HandleInvalidParse`.
// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+3]]:6: error: semantics TODO: `HandleInvalidParse`
// CHECK:STDERR: fn N.base() {}
// CHECK:STDERR: ^~~~
fn N.base() {}
+18 -18
View File
@@ -14,7 +14,7 @@ class Final {
}
class DeriveFromError {
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:16: ERROR: Name `error` not found.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:16: error: name `error` not found
// CHECK:STDERR: extend base: error;
// CHECK:STDERR: ^~~~~
// CHECK:STDERR:
@@ -25,10 +25,10 @@ class DeriveFromError {
fn AccessMemberWithInvalidBaseError(p: DeriveFromError*) -> i32 { return (*p).n; }
class DeriveFromNonType {
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+7]]:16: ERROR: Cannot implicitly convert from `i32` to `type`.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+7]]:16: error: cannot implicitly convert from `i32` to `type`
// CHECK:STDERR: extend base: 32;
// CHECK:STDERR: ^~
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:16: Type `i32` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:16: type `i32` does not implement interface `ImplicitAs`
// CHECK:STDERR: extend base: 32;
// CHECK:STDERR: ^~
// CHECK:STDERR:
@@ -38,7 +38,7 @@ class DeriveFromNonType {
fn AccessMemberWithInvalidBasNonType(p: DeriveFromNonType*) -> i32 { return (*p).n; }
class DeriveFromi32 {
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:16: ERROR: Deriving from final type `i32`. Base type must be an `abstract` or `base` class.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:16: error: Deriving from final type `i32`. Base type must be an `abstract` or `base` class.
// CHECK:STDERR: extend base: i32;
// CHECK:STDERR: ^~~
// CHECK:STDERR:
@@ -47,10 +47,10 @@ class DeriveFromi32 {
// It's not really important whether this conversion produces an error or not,
// but it shouldn't crash.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+7]]:53: ERROR: Cannot implicitly convert from `DeriveFromi32*` to `i32*`.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+7]]:53: error: cannot implicitly convert from `DeriveFromi32*` to `i32*`
// CHECK:STDERR: fn ConvertToBadBasei32(p: DeriveFromi32*) -> i32* { return p; }
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:53: Type `DeriveFromi32*` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:53: type `DeriveFromi32*` does not implement interface `ImplicitAs`
// CHECK:STDERR: fn ConvertToBadBasei32(p: DeriveFromi32*) -> i32* { return p; }
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR:
@@ -59,17 +59,17 @@ fn ConvertToBadBasei32(p: DeriveFromi32*) -> i32* { return p; }
fn AccessMemberWithInvalidBasei32(p: DeriveFromi32*) -> i32 { return (*p).n; }
class DeriveFromTuple {
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:16: ERROR: Deriving from final type `(Base,)`. Base type must be an `abstract` or `base` class.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:16: error: Deriving from final type `(Base,)`. Base type must be an `abstract` or `base` class.
// CHECK:STDERR: extend base: (Base,);
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
extend base: (Base,);
}
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+7]]:61: ERROR: Cannot implicitly convert from `DeriveFromTuple*` to `(Base,)*`.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+7]]:61: error: cannot implicitly convert from `DeriveFromTuple*` to `(Base,)*`
// CHECK:STDERR: fn ConvertToBadBaseTuple(p: DeriveFromTuple*) -> (Base,)* { return p; }
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:61: Type `DeriveFromTuple*` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:61: type `DeriveFromTuple*` does not implement interface `ImplicitAs`
// CHECK:STDERR: fn ConvertToBadBaseTuple(p: DeriveFromTuple*) -> (Base,)* { return p; }
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR:
@@ -80,17 +80,17 @@ fn AccessMemberWithInvalidBaseTuple(p: DeriveFromTuple*) -> i32 { return (*p).n;
// TODO: Should we allow this?
// We do allow `{.base = {.a: i32, .b: i32}}`.
class DeriveFromStruct {
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:16: ERROR: Deriving from final type `{.a: i32, .b: i32}`. Base type must be an `abstract` or `base` class.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:16: error: Deriving from final type `{.a: i32, .b: i32}`. Base type must be an `abstract` or `base` class.
// CHECK:STDERR: extend base: {.a: i32, .b: i32};
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
extend base: {.a: i32, .b: i32};
}
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+7]]:74: ERROR: Cannot implicitly convert from `DeriveFromStruct*` to `{.a: i32, .b: i32}*`.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+7]]:74: error: cannot implicitly convert from `DeriveFromStruct*` to `{.a: i32, .b: i32}*`
// CHECK:STDERR: fn ConvertToBadBaseStruct(p: DeriveFromStruct*) -> {.a: i32, .b: i32}* { return p; }
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:74: Type `DeriveFromStruct*` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:74: type `DeriveFromStruct*` does not implement interface `ImplicitAs`
// CHECK:STDERR: fn ConvertToBadBaseStruct(p: DeriveFromStruct*) -> {.a: i32, .b: i32}* { return p; }
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR:
@@ -102,20 +102,20 @@ fn AccessMemberWithInvalidBaseStruct(p: DeriveFromStruct*) -> i32 { return (*p).
base class Incomplete;
class DeriveFromIncomplete {
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+7]]:16: ERROR: Base `Incomplete` is an incomplete type.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+7]]:16: error: Base `Incomplete` is an incomplete type.
// CHECK:STDERR: extend base: Incomplete;
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE-6]]:1: Class was forward declared here.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE-6]]:1: class was forward declared here
// CHECK:STDERR: base class Incomplete;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
extend base: Incomplete;
}
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+7]]:74: ERROR: Cannot implicitly convert from `DeriveFromIncomplete*` to `Incomplete*`.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+7]]:74: error: cannot implicitly convert from `DeriveFromIncomplete*` to `Incomplete*`
// CHECK:STDERR: fn ConvertToBadBaseIncomplete(p: DeriveFromIncomplete*) -> Incomplete* { return p; }
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:74: Type `DeriveFromIncomplete*` does not implement interface `ImplicitAs`.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:74: type `DeriveFromIncomplete*` does not implement interface `ImplicitAs`
// CHECK:STDERR: fn ConvertToBadBaseIncomplete(p: DeriveFromIncomplete*) -> Incomplete* { return p; }
// CHECK:STDERR: ^~~~~~~~~
// CHECK:STDERR:
@@ -124,7 +124,7 @@ fn ConvertToBadBaseIncomplete(p: DeriveFromIncomplete*) -> Incomplete* { return
fn AccessMemberWithInvalidBaseIncomplete(p: DeriveFromIncomplete*) -> i32 { return (*p).n; }
class DeriveFromFinal {
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:16: ERROR: Deriving from final type `Final`. Base type must be an `abstract` or `base` class.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+4]]:16: error: Deriving from final type `Final`. Base type must be an `abstract` or `base` class.
// CHECK:STDERR: extend base: Final;
// CHECK:STDERR: ^~~~~
// CHECK:STDERR:
@@ -141,7 +141,7 @@ fn AccessMemberWithInvalidBaseFinal_WithMember(p: DeriveFromFinal*) -> i32 {
}
fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 {
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+3]]:10: ERROR: Name `b` not found.
// CHECK:STDERR: fail_base_bad_type.carbon:[[@LINE+3]]:10: error: name `b` not found
// CHECK:STDERR: return (*p).b;
// CHECK:STDERR: ^~~~~~
return (*p).b;
@@ -20,13 +20,13 @@ class D {
extend base: B;
}
// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+4]]:6: ERROR: Out-of-line declaration requires a declaration in scoped entity.
// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+4]]:6: error: out-of-line declaration requires a declaration in scoped entity
// CHECK:STDERR: fn D.F() {}
// CHECK:STDERR: ^
// CHECK:STDERR:
fn D.F() {}
// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+3]]:6: ERROR: Name `C` not found.
// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+3]]:6: error: name `C` not found
// CHECK:STDERR: fn D.C.F() {}
// CHECK:STDERR: ^
fn D.C.F() {}
+3 -3
View File
@@ -10,18 +10,18 @@
base class B {}
// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+4]]:1: ERROR: `base` declaration can only be used in a class.
// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+4]]:1: error: `base` declaration can only be used in a class.
// CHECK:STDERR: extend base: B;
// CHECK:STDERR: ^~~~~~~~~~~~~~~
// CHECK:STDERR:
extend base: B;
fn F() {
// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+7]]:3: ERROR: Expected expression.
// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+7]]:3: error: expected expression
// CHECK:STDERR: extend base: B;
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+3]]:3: ERROR: Semantics TODO: `HandleInvalidParse`.
// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+3]]:3: error: semantics TODO: `HandleInvalidParse`
// CHECK:STDERR: extend base: B;
// CHECK:STDERR: ^~~~~~
extend base: B;
+7 -7
View File
@@ -11,7 +11,7 @@
base class B {}
class C1 {
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: ERROR: `private` not allowed on `base` declaration.
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: error: `private` not allowed on `base` declaration
// CHECK:STDERR: private extend base: B;
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR:
@@ -19,11 +19,11 @@ class C1 {
}
class C2 {
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+8]]:3: ERROR: `abstract` not allowed on `base` declaration.
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+8]]:3: error: `abstract` not allowed on `base` declaration
// CHECK:STDERR: abstract base: B;
// CHECK:STDERR: ^~~~~~~~
// CHECK:STDERR:
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: ERROR: Missing `extend` before `base` declaration in class.
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: error: Missing `extend` before `base` declaration in class.
// CHECK:STDERR: abstract base: B;
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
// CHECK:STDERR:
@@ -31,10 +31,10 @@ class C2 {
}
class C3 {
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+7]]:10: ERROR: `default` not allowed on declaration with `extend`.
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+7]]:10: error: `default` not allowed on declaration with `extend`
// CHECK:STDERR: extend default base: B;
// CHECK:STDERR: ^~~~~~~
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: `extend` previously appeared here.
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3: `extend` previously appeared here
// CHECK:STDERR: extend default base: B;
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR:
@@ -42,10 +42,10 @@ class C3 {
}
class C4 {
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+6]]:10: ERROR: `extend` repeated on declaration.
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+6]]:10: error: `extend` repeated on declaration
// CHECK:STDERR: extend extend base: B;
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+3]]:3: `extend` previously appeared here.
// CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+3]]:3: `extend` previously appeared here
// CHECK:STDERR: extend extend base: B;
// CHECK:STDERR: ^~~~~~
extend extend base: B;

Some files were not shown because too many files have changed in this diff Show More