Always form a ConstType instruction for const. (#6341)

Do this even if the operand is a `ConstType` instruction. This better
preserves the source form of the type, and avoids a special case.
Repeated `const`s are already flattened in constant evaluation, and this
special case also didn't prevent forming a `ConstType` whose operand is
`const` in general, only cases where the operand happens to literally be
a `ConstType` instruction.

This reverts commit eed21f6439.
This commit is contained in:
Richard Smith
2025-11-09 18:17:09 +00:00
committed by GitHub
parent dfd9946dc2
commit 1ece5000aa
5 changed files with 11 additions and 9 deletions
-2
View File
@@ -286,8 +286,6 @@ auto HandleParseNode(Context& context, Parse::PrefixOperatorConstId node_id)
"`const` applied repeatedly to the same type has no "
"additional effect");
context.emitter().Emit(node_id, RepeatedConst);
context.node_stack().Push(node_id, value_id);
return true;
}
auto inner_type = ExprAsType(context, node_id, value_id);
AddInstAndPush<SemIR::ConstType>(