mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 19:11:09 +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:
@@ -166,7 +166,10 @@ auto SemanticsIR::StringifyNode(SemanticsNodeId node_id) -> std::string {
|
||||
switch (node.kind()) {
|
||||
case SemanticsNodeKind::StructType: {
|
||||
auto refs = GetNodeBlock(node.GetAsStructType());
|
||||
if (step.index == 0) {
|
||||
if (refs.empty()) {
|
||||
out << "{} as Type";
|
||||
break;
|
||||
} else if (step.index == 0) {
|
||||
out << "{";
|
||||
} else if (step.index < static_cast<int>(refs.size())) {
|
||||
out << ", ";
|
||||
|
||||
Reference in New Issue
Block a user