mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add prelude support for implicit conversion between integer literals and sized integer types. (#4525)
In preparation for changing integer literals to be of `IntLiteral` type. Conversions from the integer literal type are only permitted when the value fits within the destination type. For now, if conversion cannot be checked because the source value is a symbolic constant, produce a symbolic constant representing the conversion rather than rejecting it.
This commit is contained in:
@@ -1088,6 +1088,9 @@ static auto MakeConstantForBuiltinCall(Context& context, SemIRLoc loc,
|
||||
|
||||
// Integer conversions.
|
||||
case SemIR::BuiltinFunctionKind::IntConvertChecked: {
|
||||
if (phase == Phase::Symbolic) {
|
||||
return MakeConstantResult(context, call, phase);
|
||||
}
|
||||
return PerformCheckedIntConvert(context, loc, arg_ids[0], call.type_id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user