Always create a StructType node for every syntactic struct type. (#3084)

Don't elide the StructType node if we've already created an equivalent
type. Its spelling and location may be interesting to diagnostics,
tooling, debug information, etc.
This commit is contained in:
Richard Smith
2023-08-10 20:30:39 +00:00
committed by GitHub
parent 6cbf280a68
commit 9c516c40b9
6 changed files with 54 additions and 39 deletions
@@ -108,9 +108,9 @@ auto SemanticsHandleStructTypeLiteral(SemanticsContext& context,
CARBON_CHECK(refs_id != SemanticsNodeBlockId::Empty)
<< "{} is handled by StructLiteral.";
auto type_id = context.CanonicalizeStructType(parse_node, refs_id);
context.node_stack().Push(parse_node,
context.semantics_ir().GetType(type_id));
context.AddNodeAndPush(parse_node,
SemanticsNode::StructType::Make(
parse_node, SemanticsTypeId::TypeType, refs_id));
return true;
}