Removed builtin empty tuple type (#3021)

Co-authored-by: Farzana Ahmed Siddique <fasiddique@google.com>
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
authored and GitHub committed 2023-07-27 21:17:29 +00:00
1 parent 1006956ed5
commit db5e269097
71 files changed
+350 -259

No files matched your search

@@ -3,6 +3,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "toolchain/semantics/semantics_context.h"
#include "toolchain/semantics/semantics_node.h"
namespace Carbon {
@@ -41,8 +42,14 @@ auto SemanticsHandleCallExpression(SemanticsContext& context,
/*diagnostic=*/nullptr));
// TODO: Propagate return types from callable.
SemanticsTypeId type_id = callable.return_type_id;
// For functions with an implicit return type, set the return type to empty
// tuple type.
if (type_id == SemanticsTypeId::Invalid) {
type_id = context.CanonicalizeTupleType(call_expr_parse_node, {});
}
auto call_node_id = context.AddNode(SemanticsNode::Call::Make(
call_expr_parse_node, callable.return_type_id, refs_id, function_id));
call_expr_parse_node, type_id, refs_id, function_id));
context.node_stack().Push(parse_node, call_node_id);
return true;