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:
Richard Smith
2024-11-15 21:46:14 +00:00
committed by GitHub
parent c2ff865700
commit ff530305d1
18 changed files with 179 additions and 106 deletions
+3
View File
@@ -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);
}