mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Converting an integer value to a destination type that is not a valid integer type -- such as `i8388609` or `i16777216`, whose bit widths are diagnosed as invalid -- hit a CHECK failure in `TypeStore::GetIntTypeInfo` during constant evaluation of `int.convert` / `int.convert_checked`: ``` CHECK failure at toolchain/sem_ir/type.cpp:189: int_info: Type type(...) is not an integer type ``` The width error is already diagnosed when forming the type (`IntWidthNotMultipleOf8` / `IntWidthTooLarge`), so `PerformIntConvert` and `PerformCheckedIntConvert` now use `TryGetIntTypeInfo` and produce an error value instead of crashing, following the existing `SemIR::ErrorInst::ConstantId` convention in `eval.cpp`. Added a file test covering all three reproducers from the issue (`i8388609`, `i16777216`, `Core.Int(8388609)`); it crashes without this change. The full `//toolchain/testing:file_test` suite (1578 tests) passes. Fixes #7278. I have reviewed this change and take responsibility for it. Assisted-by: Claude