mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 15:41:04 +01:00
Support floats in MapAPValueToConstant (#6800)
This allows `constexpr float` to be properly imported as a constant.
This commit is contained in:
@@ -30,6 +30,10 @@ auto MapAPValueToConstant(Context& context, SemIR::LocId loc_id,
|
||||
return TryEvalInst(context,
|
||||
SemIR::IntValue{.type_id = type_id, .int_id = int_id});
|
||||
}
|
||||
} else if (ap_value.isFloat()) {
|
||||
FloatId float_id = context.floats().Add(ap_value.getFloat());
|
||||
return TryEvalInst(
|
||||
context, SemIR::FloatValue{.type_id = type_id, .float_id = float_id});
|
||||
} else {
|
||||
// TODO: support other types.
|
||||
return SemIR::ConstantId::NotConstant;
|
||||
|
||||
Reference in New Issue
Block a user