diff --git a/toolchain/check/decl_name_stack.cpp b/toolchain/check/decl_name_stack.cpp index 35ce1c1053c1..ac1d299fc917 100644 --- a/toolchain/check/decl_name_stack.cpp +++ b/toolchain/check/decl_name_stack.cpp @@ -136,7 +136,7 @@ auto DeclNameStack::AddName(NameContext name_context, SemIR::InstId target_id, case NameContext::State::Unresolved: if (!name_context.parent_scope_id.has_value()) { - AddNameToLookup(*context_, name_context.unresolved_name_id, target_id, + AddNameToLookup(*context_, name_context.name_id, target_id, name_context.initial_scope_index); } else { auto& name_scope = @@ -161,7 +161,7 @@ auto DeclNameStack::AddName(NameContext name_context, SemIR::InstId target_id, context_->AddExport(target_id); } - name_scope.AddRequired({.name_id = name_context.unresolved_name_id, + name_scope.AddRequired({.name_id = name_context.name_id, .result = SemIR::ScopeLookupResult::MakeFound( target_id, access_kind)}); } @@ -180,7 +180,8 @@ auto DeclNameStack::AddNameOrDiagnose(NameContext name_context, DiagnosePoisonedName(*context_, name_context.name_id_for_new_inst(), name_context.poisoning_loc_id, name_context.loc_id); } else if (auto id = name_context.prev_inst_id(); id.has_value()) { - DiagnoseDuplicateName(*context_, name_context.loc_id, id); + DiagnoseDuplicateName(*context_, name_context.name_id, name_context.loc_id, + id); } else { AddName(name_context, target_id, access_kind); } @@ -258,10 +259,11 @@ auto DeclNameStack::ApplyAndLookupName(NameContext& name_context, // processed so far. name_context.loc_id = loc_id; + name_context.name_id = name_id; + // Don't perform any more lookups after we hit an error. We still track the // final name, though. if (name_context.state == NameContext::State::Error) { - name_context.unresolved_name_id = name_id; return; } @@ -270,12 +272,10 @@ auto DeclNameStack::ApplyAndLookupName(NameContext& name_context, name_context.parent_scope_id, name_context.initial_scope_index); if (lookup_result.is_poisoned()) { - name_context.unresolved_name_id = name_id; name_context.poisoning_loc_id = lookup_result.poisoning_loc_id(); name_context.state = NameContext::State::Poisoned; } else if (!lookup_result.is_found()) { // Invalid indicates an unresolved name. Store it and return. - name_context.unresolved_name_id = name_id; name_context.state = NameContext::State::Unresolved; } else { // Store the resolved instruction and continue for the target scope @@ -300,8 +300,7 @@ static auto CheckQualifierIsResolved( case DeclNameStack::NameContext::State::Unresolved: // Because more qualifiers were found, we diagnose that the earlier // qualifier failed to resolve. - DiagnoseNameNotFound(context, name_context.loc_id, - name_context.unresolved_name_id); + DiagnoseNameNotFound(context, name_context.loc_id, name_context.name_id); return false; case DeclNameStack::NameContext::State::Finished: diff --git a/toolchain/check/decl_name_stack.h b/toolchain/check/decl_name_stack.h index 4d4cbea93e46..77d3fbe6b149 100644 --- a/toolchain/check/decl_name_stack.h +++ b/toolchain/check/decl_name_stack.h @@ -125,7 +125,7 @@ class DeclNameStack { switch (state) { case State::Unresolved: case State::Poisoned: - return unresolved_name_id; + return name_id; default: return SemIR::NameId::None; } @@ -153,13 +153,13 @@ class DeclNameStack { // expressions. `None` indicates resolution failed. SemIR::InstId resolved_inst_id; - // The ID of an unresolved identifier. - SemIR::NameId unresolved_name_id = SemIR::NameId::None; + // When `state` is `Poisoned` (name is unresolved due to name poisoning), + // the poisoning location. + SemIR::LocId poisoning_loc_id = SemIR::LocId::None; }; - // When `state` is `Poisoned` (name is unresolved due to name poisoning), - // the poisoning location. - SemIR::LocId poisoning_loc_id = SemIR::LocId::None; + // The ID of an identifier. + SemIR::NameId name_id = SemIR::NameId::None; }; // Information about a declaration name that has been temporarily removed from diff --git a/toolchain/check/handle_class.cpp b/toolchain/check/handle_class.cpp index e543d06cc8d9..7716ecb7eba9 100644 --- a/toolchain/check/handle_class.cpp +++ b/toolchain/check/handle_class.cpp @@ -164,7 +164,8 @@ static auto MergeOrAddName(Context& context, Parse::AnyClassDeclId node_id, if (!prev_class_id.has_value()) { // This is a redeclaration of something other than a class. - DiagnoseDuplicateName(context, name_context.loc_id, prev_id); + DiagnoseDuplicateName(context, name_context.name_id, name_context.loc_id, + prev_id); return; } diff --git a/toolchain/check/handle_function.cpp b/toolchain/check/handle_function.cpp index b6a38246c6e1..a8caf9da9e56 100644 --- a/toolchain/check/handle_function.cpp +++ b/toolchain/check/handle_function.cpp @@ -139,7 +139,8 @@ static auto MergeFunctionRedecl(Context& context, // Check whether this is a redeclaration, merging if needed. static auto TryMergeRedecl(Context& context, Parse::AnyFunctionDeclId node_id, - SemIR::InstId prev_id, SemIR::LocId name_loc_id, + SemIR::NameId name_id, SemIR::InstId prev_id, + SemIR::LocId name_loc_id, SemIR::FunctionDecl& function_decl, SemIR::Function& function_info, bool is_definition) -> void { @@ -180,7 +181,7 @@ static auto TryMergeRedecl(Context& context, Parse::AnyFunctionDeclId node_id, } if (!prev_function_id.has_value()) { - DiagnoseDuplicateName(context, name_loc_id, prev_id); + DiagnoseDuplicateName(context, name_id, name_loc_id, prev_id); return; } @@ -296,9 +297,9 @@ static auto BuildFunctionDecl(Context& context, DiagnosePoisonedName(context, name_context.name_id_for_new_inst(), name_context.poisoning_loc_id, name_context.loc_id); } else { - TryMergeRedecl(context, node_id, name_context.prev_inst_id(), - name_context.loc_id, function_decl, function_info, - is_definition); + TryMergeRedecl(context, node_id, name_context.name_id, + name_context.prev_inst_id(), name_context.loc_id, + function_decl, function_info, is_definition); } // Create a new function if this isn't a valid redeclaration. diff --git a/toolchain/check/handle_interface.cpp b/toolchain/check/handle_interface.cpp index 79a92f27c8c1..0823f6474def 100644 --- a/toolchain/check/handle_interface.cpp +++ b/toolchain/check/handle_interface.cpp @@ -105,7 +105,8 @@ static auto BuildInterfaceDecl(Context& context, } } else { // This is a redeclaration of something other than a interface. - DiagnoseDuplicateName(context, name_context.loc_id, existing_id); + DiagnoseDuplicateName(context, name_context.name_id, name_context.loc_id, + existing_id); } } diff --git a/toolchain/check/handle_namespace.cpp b/toolchain/check/handle_namespace.cpp index 43e87a1c08e3..bd1028776506 100644 --- a/toolchain/check/handle_namespace.cpp +++ b/toolchain/check/handle_namespace.cpp @@ -65,7 +65,8 @@ auto HandleParseNode(Context& context, Parse::NamespaceId node_id) -> bool { .Get(existing->name_scope_id) .is_closed_import()) { // The existing name is a package name, so this is a name conflict. - DiagnoseDuplicateName(context, name_context.loc_id, existing_inst_id); + DiagnoseDuplicateName(context, name_context.name_id, + name_context.loc_id, existing_inst_id); // Treat this as a local namespace name from now on to avoid further // diagnostics. @@ -79,7 +80,8 @@ auto HandleParseNode(Context& context, Parse::NamespaceId node_id) -> bool { SetNamespaceNodeId(context, existing_inst_id, node_id); } } else { - DiagnoseDuplicateName(context, name_context.loc_id, existing_inst_id); + DiagnoseDuplicateName(context, name_context.name_id, name_context.loc_id, + existing_inst_id); } } diff --git a/toolchain/check/import.cpp b/toolchain/check/import.cpp index 2df91e14047c..3e6c1fe0606a 100644 --- a/toolchain/check/import.cpp +++ b/toolchain/check/import.cpp @@ -110,7 +110,7 @@ auto AddImportNamespace(Context& context, SemIR::TypeId namespace_type_id, CARBON_CHECK(import_id.has_value()); // TODO: Pass the import package name location instead of the import // id to get more accurate location. - DiagnoseDuplicateName(context, import_id, prev_inst_id); + DiagnoseDuplicateName(context, name_id, import_id, prev_inst_id); } return {.name_scope_id = namespace_inst->name_scope_id, .inst_id = prev_inst_id, @@ -153,7 +153,8 @@ auto AddImportNamespace(Context& context, SemIR::TypeId namespace_type_id, if (!result.is_poisoned() && !inserted) { // TODO: Pass the import namespace name location instead of the namespace id // to get more accurate location. - DiagnoseDuplicateName(context, namespace_id, result.target_inst_id()); + DiagnoseDuplicateName(context, name_id, namespace_id, + result.target_inst_id()); } result = SemIR::ScopeLookupResult::MakeFound(namespace_id, SemIR::AccessKind::Public); @@ -289,8 +290,8 @@ static auto AddImportRefOrMerge(Context& context, SemIR::ImportIRId ir_id, auto inst_id = entry.result.target_inst_id(); auto prev_ir_inst = GetCanonicalImportIRInst(context, inst_id); - VerifySameCanonicalImportIRInst(context, inst_id, prev_ir_inst, ir_id, - &import_sem_ir, import_inst_id); + VerifySameCanonicalImportIRInst(context, name_id, inst_id, prev_ir_inst, + ir_id, &import_sem_ir, import_inst_id); } namespace { @@ -605,9 +606,9 @@ auto ImportNameFromOtherPackage( if (!canonical_result_inst) { canonical_result_inst = GetCanonicalImportIRInst(context, result_id); } - VerifySameCanonicalImportIRInst(context, result_id, *canonical_result_inst, - import_ir_id, import_ir.sem_ir, - import_scope_inst_id); + VerifySameCanonicalImportIRInst(context, name_id, result_id, + *canonical_result_inst, import_ir_id, + import_ir.sem_ir, import_scope_inst_id); } return result_id; diff --git a/toolchain/check/import_ref.cpp b/toolchain/check/import_ref.cpp index 3c3ab4bb0e76..37667a49f86f 100644 --- a/toolchain/check/import_ref.cpp +++ b/toolchain/check/import_ref.cpp @@ -138,7 +138,8 @@ auto GetCanonicalImportIRInst(Context& context, SemIR::InstId inst_id) return GetCanonicalImportIRInst(context, &context.sem_ir(), inst_id); } -auto VerifySameCanonicalImportIRInst(Context& context, SemIR::InstId prev_id, +auto VerifySameCanonicalImportIRInst(Context& context, SemIR::NameId name_id, + SemIR::InstId prev_id, SemIR::ImportIRInst prev_import_ir_inst, SemIR::ImportIRId new_ir_id, const SemIR::File* new_import_ir, @@ -151,7 +152,7 @@ auto VerifySameCanonicalImportIRInst(Context& context, SemIR::InstId prev_id, auto conflict_id = AddImportRef(context, {.ir_id = new_ir_id, .inst_id = new_inst_id}); // TODO: Pass the imported name location instead of the conflict id. - DiagnoseDuplicateName(context, conflict_id, prev_id); + DiagnoseDuplicateName(context, name_id, conflict_id, prev_id); } // Returns an instruction that has the specified constant value. diff --git a/toolchain/check/import_ref.h b/toolchain/check/import_ref.h index 094c7e7b5fdb..b22872da49e1 100644 --- a/toolchain/check/import_ref.h +++ b/toolchain/check/import_ref.h @@ -31,7 +31,8 @@ auto GetCanonicalImportIRInst(Context& context, SemIR::InstId inst_id) // Verifies a new instruction is the same as a previous instruction. // prev_import_ir_inst should come from GetCanonicalImportIRInst. -auto VerifySameCanonicalImportIRInst(Context& context, SemIR::InstId prev_id, +auto VerifySameCanonicalImportIRInst(Context& context, SemIR::NameId name_id, + SemIR::InstId prev_id, SemIR::ImportIRInst prev_import_ir_inst, SemIR::ImportIRId new_ir_id, const SemIR::File* new_import_ir, diff --git a/toolchain/check/name_lookup.cpp b/toolchain/check/name_lookup.cpp index dfb4460927b2..d2388e1ac4fb 100644 --- a/toolchain/check/name_lookup.cpp +++ b/toolchain/check/name_lookup.cpp @@ -19,7 +19,7 @@ auto AddNameToLookup(Context& context, SemIR::NameId name_id, existing.has_value()) { // TODO: Add coverage to this use case and use the location of the name // instead of the target. - DiagnoseDuplicateName(context, target_id, existing); + DiagnoseDuplicateName(context, name_id, target_id, existing); } } @@ -484,13 +484,14 @@ auto LookupNameInCore(Context& context, SemIR::LocId loc_id, scope_result.target_inst_id()); } -auto DiagnoseDuplicateName(Context& context, SemIRLoc dup_def, - SemIRLoc prev_def) -> void { +auto DiagnoseDuplicateName(Context& context, SemIR::NameId name_id, + SemIRLoc dup_def, SemIRLoc prev_def) -> void { CARBON_DIAGNOSTIC(NameDeclDuplicate, Error, - "duplicate name being declared in the same scope"); + "duplicate name `{0}` being declared in the same scope", + SemIR::NameId); CARBON_DIAGNOSTIC(NameDeclPrevious, Note, "name is previously declared here"); context.emitter() - .Build(dup_def, NameDeclDuplicate) + .Build(dup_def, NameDeclDuplicate, name_id) .Note(prev_def, NameDeclPrevious) .Emit(); } diff --git a/toolchain/check/name_lookup.h b/toolchain/check/name_lookup.h index e6751e2191ee..35e8cb00b4e6 100644 --- a/toolchain/check/name_lookup.h +++ b/toolchain/check/name_lookup.h @@ -100,8 +100,8 @@ auto LookupNameInCore(Context& context, SemIR::LocId loc_id, llvm::StringRef name) -> SemIR::InstId; // Prints a diagnostic for a duplicate name. -auto DiagnoseDuplicateName(Context& context, SemIRLoc dup_def, - SemIRLoc prev_def) -> void; +auto DiagnoseDuplicateName(Context& context, SemIR::NameId name_id, + SemIRLoc dup_def, SemIRLoc prev_def) -> void; // Prints a diagnostic for a poisoned name when it's later declared. auto DiagnosePoisonedName(Context& context, SemIR::NameId name_id, diff --git a/toolchain/check/testdata/alias/no_prelude/fail_name_conflict.carbon b/toolchain/check/testdata/alias/no_prelude/fail_name_conflict.carbon index 08bb02c02182..e714185674fd 100644 --- a/toolchain/check/testdata/alias/no_prelude/fail_name_conflict.carbon +++ b/toolchain/check/testdata/alias/no_prelude/fail_name_conflict.carbon @@ -11,7 +11,7 @@ class C {} alias a = C; -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:5: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: var a: C = {}; // CHECK:STDERR: ^ // CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:7: note: name is previously declared here [NameDeclPrevious] @@ -21,7 +21,7 @@ alias a = C; var a: C = {}; var b: C = {}; -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:7: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+7]]:7: error: duplicate name `b` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: alias b = C; // CHECK:STDERR: ^ // CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-4]]:5: note: name is previously declared here [NameDeclPrevious] diff --git a/toolchain/check/testdata/class/cross_package_import.carbon b/toolchain/check/testdata/class/cross_package_import.carbon index c8ec17e20009..7f1dc5c345fd 100644 --- a/toolchain/check/testdata/class/cross_package_import.carbon +++ b/toolchain/check/testdata/class/cross_package_import.carbon @@ -63,7 +63,7 @@ var c: Other.C = {}; library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+8]]:1: in import [InImport] -// CHECK:STDERR: other_extern.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: other_extern.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: extern class C; // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:1: in import [InImport] @@ -84,7 +84,7 @@ var c: Other.C = {}; library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:1: in import [InImport] -// CHECK:STDERR: other_conflict.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: other_conflict.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn C() {} // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:1: in import [InImport] diff --git a/toolchain/check/testdata/class/no_prelude/extern.carbon b/toolchain/check/testdata/class/no_prelude/extern.carbon index e00b529b91aa..3951a11bca5f 100644 --- a/toolchain/check/testdata/class/no_prelude/extern.carbon +++ b/toolchain/check/testdata/class/no_prelude/extern.carbon @@ -133,7 +133,7 @@ extern class C; library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_import_extern_decl_then_decl.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: decl.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: decl.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: class C; // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_import_extern_decl_then_decl.carbon:[[@LINE+5]]:1: in import [InImport] @@ -149,7 +149,7 @@ import library "decl"; library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_import_decl_then_extern_decl.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: extern_decl.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: extern_decl.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: extern class C; // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: fail_import_decl_then_extern_decl.carbon:[[@LINE+5]]:1: in import [InImport] @@ -165,7 +165,7 @@ import library "extern_decl"; library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_import_extern_decl_then_def.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: def.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: def.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: class C {} // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: fail_import_extern_decl_then_def.carbon:[[@LINE+5]]:1: in import [InImport] @@ -181,7 +181,7 @@ import library "def"; library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_import_ownership_conflict.carbon:[[@LINE+18]]:1: in import [InImport] -// CHECK:STDERR: decl.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: decl.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: class C; // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_import_ownership_conflict.carbon:[[@LINE+14]]:1: in import [InImport] @@ -190,7 +190,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_import_ownership_conflict.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: def.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: def.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: class C {} // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: fail_import_ownership_conflict.carbon:[[@LINE+5]]:1: in import [InImport] @@ -207,7 +207,7 @@ import library "def"; library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_todo_import_extern_decl_copy.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: extern_decl_copy.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: extern_decl_copy.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: extern class C; // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_import_extern_decl_copy.carbon:[[@LINE+5]]:1: in import [InImport] diff --git a/toolchain/check/testdata/class/no_prelude/implicit_import.carbon b/toolchain/check/testdata/class/no_prelude/implicit_import.carbon index fe6b2244f629..d58b2ddfc83c 100644 --- a/toolchain/check/testdata/class/no_prelude/implicit_import.carbon +++ b/toolchain/check/testdata/class/no_prelude/implicit_import.carbon @@ -71,7 +71,7 @@ alias B = C; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE+8]]:7: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE+8]]:7: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: class B {} // CHECK:STDERR: ^ // CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE-5]]:6: in import [InImport] diff --git a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon index 5bc345850b27..04b4a7c24552 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon @@ -8,7 +8,7 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_param_redecl.carbon -// CHECK:STDERR: fail_param_redecl.carbon:[[@LINE+7]]:14: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_param_redecl.carbon:[[@LINE+7]]:14: error: duplicate name `n` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn F(n: i32, n: i32); // CHECK:STDERR: ^ // CHECK:STDERR: fail_param_redecl.carbon:[[@LINE+4]]:6: note: name is previously declared here [NameDeclPrevious] diff --git a/toolchain/check/testdata/function/declaration/import.carbon b/toolchain/check/testdata/function/declaration/import.carbon index 5a706bb15090..531ec9cc0686 100644 --- a/toolchain/check/testdata/function/declaration/import.carbon +++ b/toolchain/check/testdata/function/declaration/import.carbon @@ -133,7 +133,7 @@ var e: () = NS.E(); library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_merge.carbon:[[@LINE+45]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: extern_api.carbon:4:1: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: extern library "redecl_extern_api" fn A(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_merge.carbon:[[@LINE+41]]:1: in import [InImport] @@ -142,7 +142,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_merge.carbon:[[@LINE+36]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:5:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: extern_api.carbon:5:1: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: extern library "redecl_extern_api" fn B(b: i32) -> i32; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_merge.carbon:[[@LINE+32]]:1: in import [InImport] @@ -151,7 +151,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_merge.carbon:[[@LINE+27]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:6:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: extern_api.carbon:6:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: extern library "redecl_extern_api" fn C(c: (i32,)) -> {.c: i32}; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_merge.carbon:[[@LINE+23]]:1: in import [InImport] @@ -160,7 +160,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_merge.carbon:[[@LINE+18]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:7:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: extern_api.carbon:7:1: error: duplicate name `D` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: extern library "redecl_extern_api" fn D(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_merge.carbon:[[@LINE+14]]:1: in import [InImport] @@ -169,7 +169,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_merge.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: extern_api.carbon:10:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: extern_api.carbon:10:1: error: duplicate name `E` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: extern library "redecl_extern_api" fn NS.E(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_merge.carbon:[[@LINE+5]]:1: in import [InImport] @@ -191,7 +191,7 @@ var e: () = NS.E(); library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+45]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: api.carbon:4:1: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn A(); // CHECK:STDERR: ^~~~~~~ // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+41]]:1: in import [InImport] @@ -200,7 +200,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+36]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:5:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: api.carbon:5:1: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn B(b: i32) -> i32; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+32]]:1: in import [InImport] @@ -209,7 +209,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+27]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:6:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: api.carbon:6:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn C(c: (i32,)) -> {.c: i32}; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+23]]:1: in import [InImport] @@ -218,7 +218,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+18]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:7:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: api.carbon:7:1: error: duplicate name `D` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: extern fn D(); // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+14]]:1: in import [InImport] @@ -227,7 +227,7 @@ library "[[@TEST_NAME]]"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: api.carbon:10:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: api.carbon:10:1: error: duplicate name `E` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn NS.E(); // CHECK:STDERR: ^~~~~~~~~~ // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+5]]:1: in import [InImport] diff --git a/toolchain/check/testdata/function/declaration/no_prelude/extern_library.carbon b/toolchain/check/testdata/function/declaration/no_prelude/extern_library.carbon index 344525dbdd56..4d1ce546cf52 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/extern_library.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/extern_library.carbon @@ -81,7 +81,7 @@ extern library "extern_library_owner" fn F(); library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_extern_library_collision.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: extern_library_copy.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: extern_library_copy.carbon:4:1: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: extern library "extern_library_owner" fn F(); // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_extern_library_collision.carbon:[[@LINE+5]]:1: in import [InImport] diff --git a/toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon b/toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon index 2d2ba6ca6321..d90d4d7ac368 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon @@ -111,7 +111,7 @@ alias B = A; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE+8]]:4: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE+8]]:4: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn B() {} // CHECK:STDERR: ^ // CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE-5]]:6: in import [InImport] diff --git a/toolchain/check/testdata/generic/local.carbon b/toolchain/check/testdata/generic/local.carbon index 859e4cfb4e0c..641f175f41a2 100644 --- a/toolchain/check/testdata/generic/local.carbon +++ b/toolchain/check/testdata/generic/local.carbon @@ -25,7 +25,7 @@ library "[[@TEST_NAME]]"; fn F() { // TODO: Decide on what behavior we want here. We don't reject the corresponding case outside of a function. - // CHECK:STDERR: fail_param_shadows_class.carbon:[[@LINE+7]]:9: error: duplicate name being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_param_shadows_class.carbon:[[@LINE+7]]:9: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: class C(C:! type) { // CHECK:STDERR: ^ // CHECK:STDERR: fail_param_shadows_class.carbon:[[@LINE+4]]:11: note: name is previously declared here [NameDeclPrevious] diff --git a/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon b/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon index a97c0a83cc06..85dfb6ee2e56 100644 --- a/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon +++ b/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon @@ -24,7 +24,7 @@ interface Interface { default fn G(a: i32, b: i32) -> i32; } -// CHECK:STDERR: fail_todo_define_default_fn_out_of_line.carbon:[[@LINE+7]]:14: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_todo_define_default_fn_out_of_line.carbon:[[@LINE+7]]:14: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn Interface.F() {} // CHECK:STDERR: ^ // CHECK:STDERR: fail_todo_define_default_fn_out_of_line.carbon:[[@LINE-12]]:3: note: name is previously declared here [NameDeclPrevious] @@ -33,7 +33,7 @@ interface Interface { // CHECK:STDERR: fn Interface.F() {} -// CHECK:STDERR: fail_todo_define_default_fn_out_of_line.carbon:[[@LINE+7]]:14: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_todo_define_default_fn_out_of_line.carbon:[[@LINE+7]]:14: error: duplicate name `G` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn Interface.G(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDERR: ^ // CHECK:STDERR: fail_todo_define_default_fn_out_of_line.carbon:[[@LINE-15]]:3: note: name is previously declared here [NameDeclPrevious] diff --git a/toolchain/check/testdata/interface/no_prelude/fail_definition_imported.carbon b/toolchain/check/testdata/interface/no_prelude/fail_definition_imported.carbon index 7a6402fbd9a3..f0966bcfb434 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_definition_imported.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_definition_imported.carbon @@ -19,7 +19,7 @@ interface I; library "[[@TEST_NAME]]"; import library "a"; -// CHECK:STDERR: fail_b.carbon:[[@LINE+8]]:11: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_b.carbon:[[@LINE+8]]:11: error: duplicate name `I` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: interface I {} // CHECK:STDERR: ^ // CHECK:STDERR: fail_b.carbon:[[@LINE-5]]:1: in import [InImport] diff --git a/toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon b/toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon index 13ea37cb6f3c..5c9a1e9e3ef9 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon @@ -48,7 +48,7 @@ library "[[@TEST_NAME]]"; fn Function(); -// CHECK:STDERR: fail_name_conflict_with_fn.carbon:[[@LINE+7]]:11: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_name_conflict_with_fn.carbon:[[@LINE+7]]:11: error: duplicate name `Function` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: interface Function; // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_name_conflict_with_fn.carbon:[[@LINE-5]]:1: note: name is previously declared here [NameDeclPrevious] @@ -61,7 +61,7 @@ interface Function; class Class; -// CHECK:STDERR: fail_name_conflict_with_class.carbon:[[@LINE+7]]:11: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_name_conflict_with_class.carbon:[[@LINE+7]]:11: error: duplicate name `Class` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: interface Class { } // CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_name_conflict_with_class.carbon:[[@LINE-5]]:1: note: name is previously declared here [NameDeclPrevious] diff --git a/toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon b/toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon index 96536f957912..1d790441abe1 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon @@ -10,7 +10,7 @@ interface Interface { fn F(); - // CHECK:STDERR: fail_redeclare_member.carbon:[[@LINE+7]]:6: error: duplicate name being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_redeclare_member.carbon:[[@LINE+7]]:6: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn F(); // CHECK:STDERR: ^ // CHECK:STDERR: fail_redeclare_member.carbon:[[@LINE-4]]:3: note: name is previously declared here [NameDeclPrevious] diff --git a/toolchain/check/testdata/interface/no_prelude/fail_todo_generic_default_fn.carbon b/toolchain/check/testdata/interface/no_prelude/fail_todo_generic_default_fn.carbon index 537dad3a29da..369d033d1acb 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_todo_generic_default_fn.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_todo_generic_default_fn.carbon @@ -13,7 +13,7 @@ interface I(T:! type) { fn F[self: Self]() -> Self; } -// CHECK:STDERR: fail_todo_generic_default_fn.carbon:[[@LINE+7]]:16: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_todo_generic_default_fn.carbon:[[@LINE+7]]:16: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn I(T:! type).F[self: Self]() -> Self { return self; } // CHECK:STDERR: ^ // CHECK:STDERR: fail_todo_generic_default_fn.carbon:[[@LINE-6]]:3: note: name is previously declared here [NameDeclPrevious] diff --git a/toolchain/check/testdata/interface/no_prelude/syntactic_merge.carbon b/toolchain/check/testdata/interface/no_prelude/syntactic_merge.carbon index f1536daa1a79..c414b2b1bbed 100644 --- a/toolchain/check/testdata/interface/no_prelude/syntactic_merge.carbon +++ b/toolchain/check/testdata/interface/no_prelude/syntactic_merge.carbon @@ -69,7 +69,7 @@ interface Bar(a:! D); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE+8]]:11: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE+8]]:11: error: duplicate name `Foo` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: interface Foo(a:! C) {} // CHECK:STDERR: ^~~ // CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE-5]]:6: in import [InImport] @@ -78,7 +78,7 @@ impl library "[[@TEST_NAME]]"; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: interface Foo(a:! C) {} -// CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE+8]]:11: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE+8]]:11: error: duplicate name `Bar` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: interface Bar(a:! D) {} // CHECK:STDERR: ^~~ // CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE-14]]:6: in import [InImport] @@ -156,7 +156,7 @@ alias D = C; // TODO: This fails because importing interfaces doesn't work well. It should // fail due to `C` versus `D`, but may succeed if importing interfaces is fixed // before syntax matching on imports is supported. -// CHECK:STDERR: fail_alias_two_file.impl.carbon:[[@LINE+8]]:11: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_alias_two_file.impl.carbon:[[@LINE+8]]:11: error: duplicate name `Foo` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: interface Foo(a:! D) {} // CHECK:STDERR: ^~~ // CHECK:STDERR: fail_alias_two_file.impl.carbon:[[@LINE-10]]:6: in import [InImport] diff --git a/toolchain/check/testdata/interop/cpp/no_prelude/cpp_namespace.carbon b/toolchain/check/testdata/interop/cpp/no_prelude/cpp_namespace.carbon index 5d6ffa28e873..7d71dd40fe89 100644 --- a/toolchain/check/testdata/interop/cpp/no_prelude/cpp_namespace.carbon +++ b/toolchain/check/testdata/interop/cpp/no_prelude/cpp_namespace.carbon @@ -16,7 +16,7 @@ library "[[@TEST_NAME]]"; import Cpp library "header.h"; -// CHECK:STDERR: fail_duplicate_cpp_name.carbon:[[@LINE+7]]:11: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_duplicate_cpp_name.carbon:[[@LINE+7]]:11: error: duplicate name `Cpp` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: namespace Cpp; // CHECK:STDERR: ^~~ // CHECK:STDERR: fail_duplicate_cpp_name.carbon:[[@LINE-5]]:1: note: name is previously declared here [NameDeclPrevious] diff --git a/toolchain/check/testdata/let/fail_duplicate_decl.carbon b/toolchain/check/testdata/let/fail_duplicate_decl.carbon index 06fe0f270d63..eebb47119240 100644 --- a/toolchain/check/testdata/let/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/let/fail_duplicate_decl.carbon @@ -10,7 +10,7 @@ fn F() { let a: i32 = 1; - // CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE+7]]:7: error: duplicate name being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE+7]]:7: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: let a: i32 = 2; // CHECK:STDERR: ^ // CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE-4]]:7: note: name is previously declared here [NameDeclPrevious] diff --git a/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon b/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon index c3183b0677bf..ff4e8cd0f00f 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon @@ -24,7 +24,7 @@ import library "namespace"; // imported declaration. namespace NS; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:4: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:4: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn NS(); // CHECK:STDERR: ^~ // CHECK:STDERR: fail_conflict.carbon:[[@LINE-9]]:1: in import [InImport] @@ -38,7 +38,7 @@ fn NS(); // we don't move it. namespace NS; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:4: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:4: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn NS(); // CHECK:STDERR: ^~ // CHECK:STDERR: fail_conflict.carbon:[[@LINE-23]]:1: in import [InImport] diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon index 1db6042aa15d..589702d865d4 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon @@ -20,7 +20,7 @@ package Example; import library "namespace"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:4: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:4: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn NS(); // CHECK:STDERR: ^~ // CHECK:STDERR: fail_conflict.carbon:[[@LINE-5]]:1: in import [InImport] diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.carbon index d3e5c9948e34..db1fc5234800 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.carbon @@ -16,7 +16,7 @@ namespace Nested; // --- fail_conflict.carbon import Other; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+7]]:11: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+7]]:11: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: namespace Other; // CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_conflict.carbon:[[@LINE-4]]:1: note: name is previously declared here [NameDeclPrevious] diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon index 9bacb68a9a69..990a329cf103 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon @@ -20,7 +20,7 @@ package Example; import library "fn"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:11: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:11: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: namespace NS; // CHECK:STDERR: ^~ // CHECK:STDERR: fail_conflict.carbon:[[@LINE-5]]:1: in import [InImport] diff --git a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon index 13100477163f..c48b0e051eec 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon @@ -26,7 +26,7 @@ fn NS() {} package Example library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_conflict.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: fn.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fn.carbon:4:1: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn NS() {} // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: fail_conflict.carbon:[[@LINE+5]]:1: in import [InImport] diff --git a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon index 06c5445cc9f7..e532e90691fa 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon @@ -26,7 +26,7 @@ fn NS.Foo() {} package Example library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_conflict.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: namespace.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: namespace.carbon:4:1: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: namespace NS; // CHECK:STDERR: ^~~~~~~~~~~~~ // CHECK:STDERR: fail_conflict.carbon:[[@LINE+5]]:1: in import [InImport] diff --git a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon index 14b0336d4a9f..09b45ea762d3 100644 --- a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon +++ b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon @@ -25,7 +25,7 @@ var Foo: i32; package Example library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_conflict.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: var.carbon:4:5: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: var.carbon:4:5: error: duplicate name `Foo` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: var Foo: i32; // CHECK:STDERR: ^~~ // CHECK:STDERR: fail_conflict.carbon:[[@LINE+5]]:1: in import [InImport] diff --git a/toolchain/check/testdata/packages/no_prelude/cross_package_export.carbon b/toolchain/check/testdata/packages/no_prelude/cross_package_export.carbon index 07763dd0e14a..46e24eecce0b 100644 --- a/toolchain/check/testdata/packages/no_prelude/cross_package_export.carbon +++ b/toolchain/check/testdata/packages/no_prelude/cross_package_export.carbon @@ -154,7 +154,7 @@ import Other library "conflict"; library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_conflict_on_export_import.carbon:[[@LINE+8]]:1: in import [InImport] -// CHECK:STDERR: base.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: base.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: class C { // CHECK:STDERR: ^~~~~~~~~ // CHECK:STDERR: fail_conflict_on_export_import.carbon:[[@LINE+4]]:1: in import [InImport] @@ -175,7 +175,7 @@ alias C = Other.C; library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_conflict_on_export_name.carbon:[[@LINE+9]]:1: in import [InImport] -// CHECK:STDERR: conflict.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: conflict.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn C() {} // CHECK:STDERR: ^~~~~~~~ // CHECK:STDERR: fail_conflict_on_export_name.carbon:[[@LINE+5]]:1: in import [InImport] diff --git a/toolchain/check/testdata/packages/no_prelude/cross_package_import.carbon b/toolchain/check/testdata/packages/no_prelude/cross_package_import.carbon index 0a5276b0302a..c043ff90f810 100644 --- a/toolchain/check/testdata/packages/no_prelude/cross_package_import.carbon +++ b/toolchain/check/testdata/packages/no_prelude/cross_package_import.carbon @@ -71,7 +71,7 @@ fn Run() { library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_todo_main_use_other_extern.carbon:[[@LINE+8]]:1: in import [InImport] -// CHECK:STDERR: other_fn_extern.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: other_fn_extern.carbon:4:1: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: extern fn F(); // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_main_use_other_extern.carbon:[[@LINE+4]]:1: in import [InImport] @@ -101,7 +101,7 @@ import Other library "other_fn_conflict"; library "[[@TEST_NAME]]"; // CHECK:STDERR: fail_main_use_other_ambiguous.carbon:[[@LINE+8]]:1: in import [InImport] -// CHECK:STDERR: other_fn_conflict.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: other_fn_conflict.carbon:4:1: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: fn F(x: ()) {} // CHECK:STDERR: ^~~~~~~~~~~~~ // CHECK:STDERR: fail_main_use_other_ambiguous.carbon:[[@LINE+4]]:1: in import [InImport] @@ -124,7 +124,7 @@ fn Run() { library "[[@TEST_NAME]]"; import library "main_other_ns"; -// CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE+8]]:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE+8]]:1: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: import Other library "other_fn"; // CHECK:STDERR: ^~~~~~ // CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE-4]]:1: in import [InImport] @@ -150,7 +150,7 @@ library "[[@TEST_NAME]]"; import Other library "other_fn"; -// CHECK:STDERR: fail_main_reopen_other.carbon:[[@LINE+7]]:11: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_main_reopen_other.carbon:[[@LINE+7]]:11: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: namespace Other; // CHECK:STDERR: ^~~~~ // CHECK:STDERR: fail_main_reopen_other.carbon:[[@LINE-5]]:1: note: name is previously declared here [NameDeclPrevious] diff --git a/toolchain/check/testdata/packages/no_prelude/implicit_imports_entities.carbon b/toolchain/check/testdata/packages/no_prelude/implicit_imports_entities.carbon index 3ab0f3140fa7..0ef352e92882 100644 --- a/toolchain/check/testdata/packages/no_prelude/implicit_imports_entities.carbon +++ b/toolchain/check/testdata/packages/no_prelude/implicit_imports_entities.carbon @@ -132,7 +132,7 @@ import Other library "o1"; // --- fail_import_conflict.impl.carbon // CHECK:STDERR: fail_import_conflict.impl.carbon:[[@LINE+9]]:6: in import [InImport] -// CHECK:STDERR: import_conflict.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: import_conflict.carbon:4:1: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: import Other library "o1"; // CHECK:STDERR: ^~~~~~ // CHECK:STDERR: fail_import_conflict.impl.carbon:[[@LINE+5]]:6: in import [InImport] @@ -154,7 +154,7 @@ import library "local_other"; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_conflict_reverse.impl.carbon:[[@LINE+9]]:1: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_import_conflict_reverse.impl.carbon:[[@LINE+9]]:1: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: import Other library "o1"; // CHECK:STDERR: ^~~~~~ // CHECK:STDERR: fail_import_conflict_reverse.impl.carbon:[[@LINE-5]]:6: in import [InImport] diff --git a/toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon b/toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon index 28dd6d9e8054..59ec5f478d7d 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon @@ -11,7 +11,7 @@ fn Main() { var x: () = (); - // CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE+7]]:7: error: duplicate name being declared in the same scope [NameDeclDuplicate] + // CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE+7]]:7: error: duplicate name `x` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: var x: () = (); // CHECK:STDERR: ^ // CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE-4]]:7: note: name is previously declared here [NameDeclPrevious] diff --git a/toolchain/check/testdata/var/no_prelude/fail_namespace_conflict.carbon b/toolchain/check/testdata/var/no_prelude/fail_namespace_conflict.carbon index 9fa655947e94..f9baf7001b4d 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_namespace_conflict.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_namespace_conflict.carbon @@ -10,7 +10,7 @@ namespace A; -// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE+7]]:5: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE+7]]:5: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: var A: (); // CHECK:STDERR: ^ // CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE-5]]:1: note: name is previously declared here [NameDeclPrevious] @@ -19,7 +19,7 @@ namespace A; // CHECK:STDERR: var A: (); -// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE+7]]:5: error: duplicate name being declared in the same scope [NameDeclDuplicate] +// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE+7]]:5: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] // CHECK:STDERR: var A: () = (); // CHECK:STDERR: ^ // CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE-14]]:1: note: name is previously declared here [NameDeclPrevious]