From d68b3fa91287ba1effb91e16b7976e9ae2cd5717 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 16 Jun 2026 09:51:38 -0400 Subject: [PATCH] Don't crash when converting a tuple to `type` if it contains an ErrorInst (#7352) The conversion will just produce an ErrorInst output. Right now I am not sure how to get an ErrorInst into that position, but with https://github.com/carbon-language/carbon-lang/pull/7364 rejecting `.Self` we end up with this, and it crashes otherwise. --- toolchain/check/convert.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toolchain/check/convert.cpp b/toolchain/check/convert.cpp index 06c63f2d4fee..648fbdac9355 100644 --- a/toolchain/check/convert.cpp +++ b/toolchain/check/convert.cpp @@ -428,6 +428,9 @@ static auto ConvertTupleToType(Context& context, SemIR::LocId loc_id, SemIR::TypeId value_type_id, ConversionTarget target) -> SemIR::TypeInstId { auto value_const_id = context.constant_values().Get(value_id); + if (value_const_id == SemIR::ErrorInst::ConstantId) { + return SemIR::ErrorInst::TypeInstId; + } if (!value_const_id.is_constant()) { // Types are constants. The input value must have a constant value to // convert.