|
|
@@ -608,7 +608,7 @@ auto Context::LookupQualifiedName(SemIRLoc loc, SemIR::NameId name_id,
|
|
|
//
|
|
|
// TODO: Consider tracking the Core package in SemIR so we don't need to use
|
|
|
// name lookup to find it.
|
|
|
-static auto GetCorePackage(Context& context, SemIRLoc loc)
|
|
|
+static auto GetCorePackage(Context& context, SemIRLoc loc, llvm::StringRef name)
|
|
|
-> SemIR::NameScopeId {
|
|
|
auto core_ident_id = context.identifiers().Add("Core");
|
|
|
auto packaging = context.parse_tree().packaging_decl();
|
|
|
@@ -630,15 +630,17 @@ static auto GetCorePackage(Context& context, SemIRLoc loc)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- CARBON_DIAGNOSTIC(CoreNotFound, Error,
|
|
|
- "package `Core` implicitly referenced here, but not found");
|
|
|
- context.emitter().Emit(loc, CoreNotFound);
|
|
|
+ CARBON_DIAGNOSTIC(
|
|
|
+ CoreNotFound, Error,
|
|
|
+ "`Core.{0}` implicitly referenced here, but package `Core` not found",
|
|
|
+ std::string);
|
|
|
+ context.emitter().Emit(loc, CoreNotFound, name.str());
|
|
|
return SemIR::NameScopeId::Invalid;
|
|
|
}
|
|
|
|
|
|
auto Context::LookupNameInCore(SemIRLoc loc, llvm::StringRef name)
|
|
|
-> SemIR::InstId {
|
|
|
- auto core_package_id = GetCorePackage(*this, loc);
|
|
|
+ auto core_package_id = GetCorePackage(*this, loc, name);
|
|
|
if (!core_package_id.is_valid()) {
|
|
|
return SemIR::InstId::BuiltinErrorInst;
|
|
|
}
|