Rename the builtin FloatType to LegacyFloatType, Error to ErrorInst (#4555)

This is for more clearly distinct names, and to make it a clearer
transition from `BuiltinInst` for name conflicts. `FloatType` is also an
instruction, and we have `Carbon::Error` (common/error.h). This avoids
affecting tests, although the name is embedded in the builtin test.

In `LegacyFloatType`, `Legacy` because I was having trouble coming up
with a more appropriate name. I'm not clear this is a `FloatLiteralType`
at present, it needs some work to mirror `IntLiteralType`.

In `ErrorInst`, the suffix `Inst` was discussed as good and similar to
`BuiltinInst` (although I'm trying to get rid of that).
This commit is contained in:
Jon Ross-Perkins
2024-11-19 20:37:39 +00:00
committed by GitHub
parent e2ae5f212c
commit 4a80d6758d
35 changed files with 131 additions and 126 deletions
+8 -8
View File
@@ -60,7 +60,7 @@ Context::Context(const Lex::TokenizedBuffer& tokens, DiagnosticEmitter& emitter,
// Map the builtin `<error>` and `type` type constants to their corresponding
// special `TypeId` values.
type_ids_for_type_constants_.Insert(
SemIR::ConstantId::ForTemplateConstant(SemIR::InstId::BuiltinError),
SemIR::ConstantId::ForTemplateConstant(SemIR::InstId::BuiltinErrorInst),
SemIR::TypeId::Error);
type_ids_for_type_constants_.Insert(
SemIR::ConstantId::ForTemplateConstant(SemIR::InstId::BuiltinTypeType),
@@ -345,7 +345,7 @@ auto Context::LookupUnqualifiedName(Parse::NodeId node_id,
}
return {.specific_id = SemIR::SpecificId::Invalid,
.inst_id = SemIR::InstId::BuiltinError};
.inst_id = SemIR::InstId::BuiltinErrorInst};
}
auto Context::LookupNameInExactScope(SemIRLoc loc, SemIR::NameId name_id,
@@ -571,7 +571,7 @@ auto Context::LookupQualifiedName(SemIRLoc loc, SemIR::NameId name_id,
emitter_->Emit(loc, NameAmbiguousDueToExtend, name_id);
// TODO: Add notes pointing to the scopes.
return {.specific_id = SemIR::SpecificId::Invalid,
.inst_id = SemIR::InstId::BuiltinError};
.inst_id = SemIR::InstId::BuiltinErrorInst};
}
result.inst_id = scope_result_id;
@@ -597,7 +597,7 @@ auto Context::LookupQualifiedName(SemIRLoc loc, SemIR::NameId name_id,
}
return {.specific_id = SemIR::SpecificId::Invalid,
.inst_id = SemIR::InstId::BuiltinError};
.inst_id = SemIR::InstId::BuiltinErrorInst};
}
return result;
@@ -639,7 +639,7 @@ auto Context::LookupNameInCore(SemIRLoc loc, llvm::StringRef name)
-> SemIR::InstId {
auto core_package_id = GetCorePackage(*this, loc);
if (!core_package_id.is_valid()) {
return SemIR::InstId::BuiltinError;
return SemIR::InstId::BuiltinErrorInst;
}
auto name_id = SemIR::NameId::ForIdentifier(identifiers().Add(name));
@@ -651,7 +651,7 @@ auto Context::LookupNameInCore(SemIRLoc loc, llvm::StringRef name)
"name `Core.{0}` implicitly referenced here, but not found",
SemIR::NameId);
emitter_->Emit(loc, CoreNameNotFound, name_id);
return SemIR::InstId::BuiltinError;
return SemIR::InstId::BuiltinErrorInst;
}
// Look through import_refs and aliases.
@@ -1006,11 +1006,11 @@ class TypeCompleter {
switch (builtin.builtin_inst_kind) {
case SemIR::BuiltinInstKind::TypeType:
case SemIR::BuiltinInstKind::AutoType:
case SemIR::BuiltinInstKind::Error:
case SemIR::BuiltinInstKind::ErrorInst:
case SemIR::BuiltinInstKind::Invalid:
case SemIR::BuiltinInstKind::BoolType:
case SemIR::BuiltinInstKind::IntLiteralType:
case SemIR::BuiltinInstKind::FloatType:
case SemIR::BuiltinInstKind::LegacyFloatType:
case SemIR::BuiltinInstKind::NamespaceType:
case SemIR::BuiltinInstKind::BoundMethodType:
case SemIR::BuiltinInstKind::WitnessType: