Return a NewAnyPhase result for RequireCompleteType with a CompleteTypeWitness value (#6939)

The `CompleteTypeWitness` can be concrete. This avoids making a symbolic
`CompleteTypeWitness` value which itself has a concrete
`CompleteTypeWitness` value with the same operands.
This commit is contained in:
Dana Jansens
2026-03-20 20:00:08 +00:00
committed by GitHub
parent 000b4f3fa5
commit 6d2387cb77
2 changed files with 2 additions and 3 deletions
+1 -1
View File
@@ -540,7 +540,7 @@ auto EvalConstantInst(Context& context, SemIR::InstId inst_id,
true)) {
return ConstantEvalResult::Error;
}
return ConstantEvalResult::NewSamePhase(SemIR::CompleteTypeWitness{
return ConstantEvalResult::NewAnyPhase(SemIR::CompleteTypeWitness{
.type_id = witness_type_id,
.object_repr_type_inst_id = context.types().GetTypeInstId(
context.types().GetObjectRepr(complete_type_id))});
@@ -78,7 +78,6 @@ fn CallNegative() {
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
// CHECK:STDOUT: %ErrorIfNIsZero.specific_fn: <specific function> = specific_function %ErrorIfNIsZero, @ErrorIfNIsZero(%int_0) [concrete]
// CHECK:STDOUT: %i0: type = class_type @Int, @Int(%int_0) [concrete]
// CHECK:STDOUT: %complete_type.d94: <witness> = complete_type_witness <error> [concrete]
// CHECK:STDOUT: %pattern_type.47b: type = pattern_type %i0 [concrete]
// CHECK:STDOUT: %DefaultOrUnformed.impl_witness.879: <witness> = impl_witness imports.%DefaultOrUnformed.impl_witness_table, @T.as.DefaultOrUnformed.impl(%i0) [concrete]
// CHECK:STDOUT: %T.as.DefaultOrUnformed.impl.Op.type.7ec: type = fn_type @T.as.DefaultOrUnformed.impl.Op, @T.as.DefaultOrUnformed.impl(%i0) [concrete]
@@ -208,7 +207,7 @@ fn CallNegative() {
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %Int.loc9_27.2 => constants.%i0
// CHECK:STDOUT: %require_complete => constants.%complete_type.d94
// CHECK:STDOUT: %require_complete => <error>
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.47b
// CHECK:STDOUT: %.loc9_28.3 => constants.%.d6a
// CHECK:STDOUT: %DefaultOrUnformed.lookup_impl_witness => constants.%DefaultOrUnformed.impl_witness.879