mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Stop special-casing empty structs. (#2849)
This removes special-casing of empty structs, handling them as just a regular value instead of a builtin. Note the `{} as Type` is still special-cased.
In lowering, removes the test of calling a function using `{}` because it's missing the proper load/store. This setup notices that error whereas the prior worked due to said special-casing. Fixing this will need to be done as part of generally adding loads for variable uses.
This commit is contained in:
@@ -74,12 +74,6 @@ auto SemanticsHandleStructLiteral(SemanticsContext& context,
|
||||
ParseNodeKind::StructLiteralOrStructTypeLiteralStart);
|
||||
auto type_block_id = context.args_type_info_stack().Pop();
|
||||
|
||||
// Special-case `{}`.
|
||||
if (refs_id == SemanticsNodeBlockId::Empty) {
|
||||
context.node_stack().Push(parse_node, SemanticsNodeId::BuiltinEmptyStruct);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Construct a type for the literal.
|
||||
// TODO: This should try to canonicalize the struct form before adding the
|
||||
// node.
|
||||
|
||||
Reference in New Issue
Block a user