Remove the special case for i32. (#4543)

For the few remaining uses of the builtin `i32` type, manually build an
`IntType(Signed, 32)` value instead. These are:

- The return type of `Run`.
- The type that int literals in an `if` expression are converted into.
- The type of an array index expression.

We should consider converting those three cases away from `i32` over
time.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Richard Smith
2024-11-18 23:19:36 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent b5368b3078
commit e2ae5f212c
348 changed files with 29507 additions and 26688 deletions
+1 -2
View File
@@ -300,8 +300,7 @@ static auto BuildFunctionDecl(Context& context,
!function_info.param_patterns_id.is_valid() ||
!context.inst_blocks().Get(function_info.param_patterns_id).empty() ||
(return_type_id.is_valid() &&
return_type_id !=
context.GetBuiltinType(SemIR::BuiltinInstKind::IntType) &&
return_type_id != context.GetInt32Type() &&
return_type_id != context.GetTupleType({}))) {
CARBON_DIAGNOSTIC(InvalidMainRunSignature, Error,
"invalid signature for `Main.Run` function; expected "