mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Make Core.Float a class. Add missing builtins for float support. (#5932)
Add missing builtins for float compound assignment, for building a FloatType, and for converting a float literal to FloatType. Switch `Core.Float` to being a class and add impls for the various floating-point operators. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
This commit is contained in:
co-authored by
google-labs-jules[bot]
Carbon Infra Bot
parent
f616817b71
commit
694c00c7eb
@@ -1828,6 +1828,19 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver,
|
||||
.index = inst.index});
|
||||
}
|
||||
|
||||
static auto TryResolveTypedInst(ImportRefResolver& resolver,
|
||||
SemIR::FloatType inst) -> ResolveResult {
|
||||
CARBON_CHECK(inst.type_id == SemIR::TypeType::TypeId);
|
||||
auto bit_width_id = GetLocalConstantInstId(resolver, inst.bit_width_id);
|
||||
if (resolver.HasNewWork()) {
|
||||
return ResolveResult::Retry();
|
||||
}
|
||||
|
||||
return ResolveAsDeduplicated<SemIR::FloatType>(
|
||||
resolver,
|
||||
{.type_id = SemIR::TypeType::TypeId, .bit_width_id = bit_width_id});
|
||||
}
|
||||
|
||||
// Make a declaration of a function. This is done as a separate step from
|
||||
// importing the function declaration in order to resolve cycles.
|
||||
static auto MakeFunctionDecl(ImportContext& context,
|
||||
@@ -3031,6 +3044,9 @@ static auto TryResolveInstCanonical(ImportRefResolver& resolver,
|
||||
case CARBON_KIND(SemIR::FieldDecl inst): {
|
||||
return TryResolveTypedInst(resolver, inst, inst_id);
|
||||
}
|
||||
case CARBON_KIND(SemIR::FloatType inst): {
|
||||
return TryResolveTypedInst(resolver, inst);
|
||||
}
|
||||
case CARBON_KIND(SemIR::FunctionDecl inst): {
|
||||
return TryResolveTypedInst(resolver, inst, const_id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user