From 39f7aae98d47e7f4059ddc9a3231a90100e981d7 Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Thu, 1 Jun 2023 16:50:34 -0700 Subject: [PATCH] Sorting out how bindings are added to name lookup. (#2869) This shifts logic so that bindings are added to name lookup only after the scope is complete, removing logic around adding/removing/re-adding names in certain scopes. This does mean that things like a function's forward declaration will need to go through an extra hoop for name conflict checks, because under this approach a function definition does conflict checking when it adds names for the body's use. But, that seems easy to address, and better than the current hoops. --- .../testdata/semantics_builtin_nodes.carbon | 2 +- .../driver/testdata/semantics_verbose.carbon | 2 +- toolchain/lowering/lowering_context.cpp | 97 +++++++++++++--- toolchain/lowering/lowering_context.h | 32 ++---- toolchain/lowering/lowering_handle.cpp | 56 ++-------- .../function/call/empty_struct.carbon | 21 ++-- .../testdata/function/call/i32.carbon | 8 +- toolchain/semantics/semantics_context.cpp | 51 +-------- toolchain/semantics/semantics_context.h | 26 ----- toolchain/semantics/semantics_handle.cpp | 53 +++++---- .../semantics_handle_call_expression.cpp | 6 +- .../semantics/semantics_handle_function.cpp | 28 +++-- toolchain/semantics/semantics_ir.cpp | 3 +- toolchain/semantics/semantics_ir.h | 34 ++++-- toolchain/semantics/semantics_ir_test.cpp | 2 +- toolchain/semantics/semantics_node.h | 16 +-- toolchain/semantics/semantics_node_kind.def | 1 - toolchain/semantics/semantics_node_stack.h | 8 ++ .../testdata/basics/builtin_types.carbon | 2 +- .../semantics/testdata/basics/empty.carbon | 2 +- .../testdata/basics/empty_decl.carbon | 2 +- .../testdata/basics/fail_name_lookup.carbon | 8 +- .../designators/fail_unsupported.carbon | 2 +- .../function/call/empty_struct.carbon | 22 ++-- .../function/call/fail_param_count.carbon | 104 ++++++++---------- .../function/call/fail_param_type.carbon | 24 ++-- .../call/fail_return_type_mismatch.carbon | 22 ++-- .../testdata/function/call/i32.carbon | 26 ++--- .../function/call/more_param_ir.carbon | 36 +++--- .../testdata/function/call/params_one.carbon | 26 ++--- .../function/call/params_one_comma.carbon | 28 ++--- .../testdata/function/call/params_two.carbon | 26 ++--- .../function/call/params_two_comma.carbon | 36 +++--- .../testdata/function/call/params_zero.carbon | 18 ++- .../fail_param_name_conflict.carbon | 8 +- .../testdata/function/definition/order.carbon | 20 ++-- .../function/definition/params_one.carbon | 8 +- .../definition/params_one_comma.carbon | 8 +- .../function/definition/params_two.carbon | 8 +- .../definition/params_two_comma.carbon | 8 +- .../function/definition/params_zero.carbon | 8 +- .../definition/same_param_name.carbon | 24 ++-- .../testdata/operators/binary_op.carbon | 8 +- .../operators/fail_type_mismatch.carbon | 8 +- .../operators/fail_type_mismatch_once.carbon | 8 +- .../testdata/return/fail_type_mismatch.carbon | 8 +- .../return/fail_value_disallowed.carbon | 8 +- .../testdata/return/fail_value_missing.carbon | 8 +- .../semantics/testdata/return/no_value.carbon | 8 +- .../semantics/testdata/return/struct.carbon | 8 +- .../semantics/testdata/return/value.carbon | 8 +- .../semantics/testdata/struct/empty.carbon | 2 +- .../testdata/struct/fail_assign_empty.carbon | 2 +- .../struct/fail_assign_to_empty.carbon | 2 +- .../struct/fail_field_name_mismatch.carbon | 2 +- .../struct/fail_field_type_mismatch.carbon | 2 +- .../struct/fail_member_access_type.carbon | 2 +- .../struct/fail_non_member_access.carbon | 2 +- .../struct/fail_too_few_values.carbon | 2 +- .../testdata/struct/fail_type_assign.carbon | 2 +- .../testdata/struct/fail_value_as_type.carbon | 2 +- .../testdata/struct/member_access.carbon | 2 +- .../testdata/struct/one_entry.carbon | 2 +- .../testdata/struct/two_entries.carbon | 2 +- toolchain/semantics/testdata/var/decl.carbon | 8 +- .../testdata/var/decl_with_init.carbon | 8 +- .../testdata/var/fail_duplicate_decl.carbon | 10 +- .../var/fail_init_type_mismatch.carbon | 8 +- .../testdata/var/fail_init_with_self.carbon | 8 +- .../var/fail_lookup_outside_scope.carbon | 12 +- .../var/fail_storage_is_literal.carbon | 8 +- .../semantics/testdata/var/global_decl.carbon | 2 +- .../testdata/var/global_decl_with_init.carbon | 2 +- .../testdata/var/global_lookup.carbon | 2 +- .../var/global_lookup_in_scope.carbon | 8 +- .../semantics/testdata/var/lookup.carbon | 8 +- 76 files changed, 484 insertions(+), 620 deletions(-) diff --git a/toolchain/driver/testdata/semantics_builtin_nodes.carbon b/toolchain/driver/testdata/semantics_builtin_nodes.carbon index bff4bfda408a..ba3dfd4756df 100644 --- a/toolchain/driver/testdata/semantics_builtin_nodes.carbon +++ b/toolchain/driver/testdata/semantics_builtin_nodes.carbon @@ -5,7 +5,7 @@ // RUN: %{carbon} dump semantics-ir --include_builtins %s | \ // RUN: %{FileCheck-strict} // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] diff --git a/toolchain/driver/testdata/semantics_verbose.carbon b/toolchain/driver/testdata/semantics_verbose.carbon index 6dcce0cf8a30..b5f9d1fea60f 100644 --- a/toolchain/driver/testdata/semantics_verbose.carbon +++ b/toolchain/driver/testdata/semantics_verbose.carbon @@ -6,7 +6,7 @@ // // Only checks a couple statements in order to minimize manual update churn. // CHECK:STDERR: Node Push 0: FunctionIntroducer -> -// CHECK:STDERR: AddNode block{{[0-9]+}}: {kind: FunctionDeclaration, arg0: str{{[0-9]+}}, arg1: callable{{[0-9]+}}} +// CHECK:STDERR: AddNode block{{[0-9]+}}: {kind: FunctionDeclaration, arg0: function{{[0-9]+}}} fn Foo() { return; diff --git a/toolchain/lowering/lowering_context.cpp b/toolchain/lowering/lowering_context.cpp index 764763d5a165..230d6da5e51a 100644 --- a/toolchain/lowering/lowering_context.cpp +++ b/toolchain/lowering/lowering_context.cpp @@ -18,35 +18,97 @@ LoweringContext::LoweringContext(llvm::LLVMContext& llvm_context, llvm_module_(std::make_unique(module_name, llvm_context)), builder_(llvm_context), semantics_ir_(&semantics_ir), - vlog_stream_(vlog_stream), - callables_(semantics_ir_->callables_size(), nullptr) { + vlog_stream_(vlog_stream) { CARBON_CHECK(!semantics_ir.has_errors()) << "Generating LLVM IR from invalid SemanticsIR is unsupported."; - - auto types = semantics_ir_->types(); - types_.resize_for_overwrite(types.size()); - for (int i = 0; i < static_cast(types.size()); ++i) { - types_[i] = BuildType(types[i]); - } } auto LoweringContext::Run() -> std::unique_ptr { CARBON_CHECK(llvm_module_) << "Run can only be called once."; - LowerBlock(semantics_ir_->top_node_block_id()); - - while (!todo_blocks_.empty()) { - auto [llvm_block, block_id] = todo_blocks_.pop_back_val(); - builder_.SetInsertPoint(llvm_block); - LowerBlock(block_id); + // Lower types. + auto types = semantics_ir_->types(); + types_.resize_for_overwrite(types.size()); + for (int i = 0; i < static_cast(types.size()); ++i) { + types_[i] = BuildType(types[i]); } + // Lower function declarations. + functions_.resize_for_overwrite(semantics_ir_->functions_size()); + for (int i = 0; i < semantics_ir_->functions_size(); ++i) { + functions_[i] = BuildFunctionDeclaration(SemanticsFunctionId(i)); + } + + // TODO: Lower global variable declarations. + + // Lower function definitions. + for (int i = 0; i < semantics_ir_->functions_size(); ++i) { + BuildFunctionDefinition(SemanticsFunctionId(i)); + } + + // TODO: Lower global variable initializers. + return std::move(llvm_module_); } -auto LoweringContext::LowerBlock(SemanticsNodeBlockId block_id) -> void { - CARBON_VLOG() << "Lowering " << block_id << "\n"; - for (const auto& node_id : semantics_ir_->GetNodeBlock(block_id)) { +auto LoweringContext::BuildFunctionDeclaration(SemanticsFunctionId function_id) + -> llvm::Function* { + auto function = semantics_ir().GetFunction(function_id); + + // TODO: Lower type information for the arguments prior to building args. + auto param_refs = semantics_ir().GetNodeBlock(function.param_refs_id); + llvm::SmallVector args; + args.resize_for_overwrite(param_refs.size()); + for (int i = 0; i < static_cast(param_refs.size()); ++i) { + args[i] = GetType(semantics_ir().GetNode(param_refs[i]).type_id()); + } + + llvm::Type* return_type = GetType(function.return_type_id.is_valid() + ? function.return_type_id + : semantics_ir().empty_tuple_type_id()); + llvm::FunctionType* function_type = + llvm::FunctionType::get(return_type, args, /*isVarArg=*/false); + auto* llvm_function = llvm::Function::Create( + function_type, llvm::Function::ExternalLinkage, + semantics_ir().GetString(function.name_id), llvm_module()); + + // Set parameter names. + for (int i = 0; i < static_cast(param_refs.size()); ++i) { + auto [param_name_id, _] = + semantics_ir().GetNode(param_refs[i]).GetAsBindName(); + llvm_function->getArg(i)->setName(semantics_ir().GetString(param_name_id)); + } + + return llvm_function; +} + +auto LoweringContext::BuildFunctionDefinition(SemanticsFunctionId function_id) + -> void { + auto function = semantics_ir().GetFunction(function_id); + auto body_id = function.body_id; + if (!body_id.is_valid()) { + // Function is probably defined in another file; not an error. + return; + } + auto* llvm_function = GetFunction(function_id); + + // Create a new basic block to start insertion into. + builder_.SetInsertPoint(llvm::BasicBlock::Create(llvm_context(), "entry", + GetFunction(function_id))); + CARBON_CHECK(locals_.empty()); + + // Add parameters to locals. + auto param_refs = semantics_ir().GetNodeBlock(function.param_refs_id); + for (int i = 0; i < static_cast(param_refs.size()); ++i) { + auto param_storage = + semantics_ir().GetNode(param_refs[i]).GetAsBindName().second; + CARBON_CHECK( + locals_.insert({param_storage, llvm_function->getArg(i)}).second) + << "Duplicate param: " << param_refs[i]; + } + + CARBON_VLOG() << "Lowering " << body_id << "\n"; + for (const auto& node_id : semantics_ir_->GetNodeBlock(body_id)) { auto node = semantics_ir_->GetNode(node_id); CARBON_VLOG() << "Lowering " << node_id << ": " << node << "\n"; switch (node.kind()) { @@ -58,6 +120,7 @@ auto LoweringContext::LowerBlock(SemanticsNodeBlockId block_id) -> void { } } + // Clear locals. locals_.clear(); } diff --git a/toolchain/lowering/lowering_context.h b/toolchain/lowering/lowering_context.h index 20927db49f06..dd019b96f69f 100644 --- a/toolchain/lowering/lowering_context.h +++ b/toolchain/lowering/lowering_context.h @@ -43,15 +43,9 @@ class LoweringContext { } // Gets a callable's function. - auto GetCallable(SemanticsCallableId callable_id) -> llvm::Function* { - CARBON_CHECK(callables_[callable_id.index] != nullptr) << callable_id; - return callables_[callable_id.index]; - } - - // Sets a callable's function. - auto SetCallable(SemanticsCallableId callable_id, llvm::Function* function) { - CARBON_CHECK(callables_[callable_id.index] == nullptr) << callable_id; - callables_[callable_id.index] = function; + auto GetFunction(SemanticsFunctionId function_id) -> llvm::Function* { + CARBON_CHECK(functions_[function_id.index] != nullptr) << function_id; + return functions_[function_id.index]; } // Returns a lowered type for the given type_id. @@ -65,14 +59,16 @@ class LoweringContext { auto llvm_module() -> llvm::Module& { return *llvm_module_; } auto builder() -> llvm::IRBuilder<>& { return builder_; } auto semantics_ir() -> const SemanticsIR& { return *semantics_ir_; } - auto todo_blocks() -> llvm::SmallVector< - std::pair>& { - return todo_blocks_; - } private: - // Runs lowering for a block. - auto LowerBlock(SemanticsNodeBlockId block_id) -> void; + // Builds the declaration for the given function, which should then be cached + // by the caller. + auto BuildFunctionDeclaration(SemanticsFunctionId function_id) + -> llvm::Function*; + + // Builds the definition for the given function. If the function is only a + // declaration with no definition, does nothing. + auto BuildFunctionDefinition(SemanticsFunctionId function_id) -> void; // Builds the type for the given node, which should then be cached by the // caller. @@ -89,10 +85,6 @@ class LoweringContext { // The optional vlog stream. llvm::raw_ostream* vlog_stream_; - // Blocks which we've observed and need to lower. - llvm::SmallVector> - todo_blocks_; - // Maps a function's SemanticsIR nodes to lowered values. // TODO: Handle nested scopes. Right now this is just cleared at the end of // every block. @@ -100,7 +92,7 @@ class LoweringContext { // Maps callables to lowered functions. Semantics treats callables as the // canonical form of a function, so lowering needs to do the same. - llvm::SmallVector callables_; + llvm::SmallVector functions_; // Provides lowered versions of types. llvm::SmallVector types_; diff --git a/toolchain/lowering/lowering_handle.cpp b/toolchain/lowering/lowering_handle.cpp index 7c456d98f695..88f4666fc66a 100644 --- a/toolchain/lowering/lowering_handle.cpp +++ b/toolchain/lowering/lowering_handle.cpp @@ -45,8 +45,8 @@ auto LoweringHandleBuiltin(LoweringContext& /*context*/, auto LoweringHandleCall(LoweringContext& context, SemanticsNodeId node_id, SemanticsNode node) -> void { - auto [refs_id, callable_id] = node.GetAsCall(); - auto* function = context.GetCallable(callable_id); + auto [refs_id, function_id] = node.GetAsCall(); + auto* function = context.GetFunction(function_id); std::vector args; for (auto ref_id : context.semantics_ir().GetNodeBlock(refs_id)) { args.push_back(context.GetLocalLoaded(ref_id)); @@ -62,55 +62,13 @@ auto LoweringHandleCodeBlock(LoweringContext& /*context*/, CARBON_FATAL() << "TODO: Add support: " << node; } -auto LoweringHandleFunctionDeclaration(LoweringContext& context, +auto LoweringHandleFunctionDeclaration(LoweringContext& /*context*/, SemanticsNodeId /*node_id*/, SemanticsNode node) -> void { - auto [name_id, callable_id] = node.GetAsFunctionDeclaration(); - auto callable = context.semantics_ir().GetCallable(callable_id); - - // TODO: Lower type information for the arguments prior to building args. - auto param_refs = context.semantics_ir().GetNodeBlock(callable.param_refs_id); - llvm::SmallVector args; - args.resize_for_overwrite(param_refs.size()); - for (int i = 0; i < static_cast(param_refs.size()); ++i) { - args[i] = context.GetType( - context.semantics_ir().GetNode(param_refs[i]).type_id()); - } - - llvm::Type* return_type = - context.GetType(callable.return_type_id.is_valid() - ? callable.return_type_id - : context.semantics_ir().empty_tuple_type_id()); - llvm::FunctionType* function_type = - llvm::FunctionType::get(return_type, args, /*isVarArg=*/false); - auto* function = llvm::Function::Create( - function_type, llvm::Function::ExternalLinkage, - context.semantics_ir().GetString(name_id), context.llvm_module()); - context.SetCallable(callable_id, function); - - // Set parameter names. - for (int i = 0; i < static_cast(param_refs.size()); ++i) { - auto [param_name_id, _] = - context.semantics_ir().GetNode(param_refs[i]).GetAsBindName(); - function->getArg(i)->setName( - context.semantics_ir().GetString(param_name_id)); - } -} - -auto LoweringHandleFunctionDefinition(LoweringContext& context, - SemanticsNodeId /*node_id*/, - SemanticsNode node) -> void { - auto [declaration_id, body_block_id] = node.GetAsFunctionDefinition(); - auto [name_id, callable_id] = - context.semantics_ir().GetNode(declaration_id).GetAsFunctionDeclaration(); - - llvm::Function* function = context.llvm_module().getFunction( - context.semantics_ir().GetString(name_id)); - - // Create a new basic block to start insertion into. - llvm::BasicBlock* body = - llvm::BasicBlock::Create(context.llvm_context(), "entry", function); - context.todo_blocks().push_back({body, body_block_id}); + CARBON_FATAL() + << "Should not be encountered. If that changes, we may want to change " + "higher-level logic to skip them rather than calling this. " + << node; } auto LoweringHandleIntegerLiteral(LoweringContext& context, diff --git a/toolchain/lowering/testdata/function/call/empty_struct.carbon b/toolchain/lowering/testdata/function/call/empty_struct.carbon index 68acfe1cf623..17c7a229742e 100644 --- a/toolchain/lowering/testdata/function/call/empty_struct.carbon +++ b/toolchain/lowering/testdata/function/call/empty_struct.carbon @@ -6,25 +6,30 @@ // CHECK:STDOUT: ; ModuleID = 'empty_struct.carbon' // CHECK:STDOUT: source_filename = "empty_struct.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: %EmptyTupleType = type {} // CHECK:STDOUT: %StructLiteralType = type {} +// CHECK:STDOUT: %EmptyTupleType = type {} // CHECK:STDOUT: -// CHECK:STDOUT: define %EmptyTupleType @Echo(%StructLiteralType %a) { +// CHECK:STDOUT: define %StructLiteralType @Echo(%StructLiteralType %a) { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %StructLiteralValue = alloca %StructLiteralType, align 8 +// CHECK:STDOUT: %0 = load %StructLiteralType, ptr %StructLiteralValue, align 1 +// CHECK:STDOUT: ret %StructLiteralType %0 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define %EmptyTupleType @Main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %StructLiteralValue = alloca %StructLiteralType, align 8 -// CHECK:STDOUT: %0 = load %StructLiteralType, ptr %StructLiteralValue, align 1 -// CHECK:STDOUT: %Echo = call %EmptyTupleType @Echo(%StructLiteralType %0) +// CHECK:STDOUT: %var = alloca %StructLiteralType, align 8 +// CHECK:STDOUT: %StructLiteralValue1 = alloca %StructLiteralType, align 8 +// CHECK:STDOUT: %0 = load %StructLiteralType, ptr %StructLiteralValue1, align 1 +// CHECK:STDOUT: %Echo = call %StructLiteralType @Echo(%StructLiteralType %0) +// CHECK:STDOUT: store %StructLiteralType %Echo, ptr %var, align 1 // CHECK:STDOUT: } -fn Echo(a: {}) { - // TODO: Set return type to `{}` and return `a` back. +fn Echo(a: {}) -> {} { + return {}; } fn Main() { - // TODO: Store the returned `{}`. - Echo({}); + var b: {} = Echo({}); } diff --git a/toolchain/lowering/testdata/function/call/i32.carbon b/toolchain/lowering/testdata/function/call/i32.carbon index d5bedbd77bee..9b580317edf7 100644 --- a/toolchain/lowering/testdata/function/call/i32.carbon +++ b/toolchain/lowering/testdata/function/call/i32.carbon @@ -10,7 +10,7 @@ // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Echo(i32 %a) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret i32 1 +// CHECK:STDOUT: ret i32 %a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define %EmptyTupleType @Main() { @@ -19,13 +19,9 @@ // CHECK:STDOUT: %Echo = call i32 @Echo(i32 1) // CHECK:STDOUT: store i32 %Echo, ptr %var, align 4 // CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; uselistorder directives -// CHECK:STDOUT: uselistorder i32 1, { 1, 2, 0 } fn Echo(a: i32) -> i32 { - // TODO: `return a;` requires the parameter to be in name lookup. - return 1; + return a; } fn Main() { diff --git a/toolchain/semantics/semantics_context.cpp b/toolchain/semantics/semantics_context.cpp index efe837fb555a..412b4340991c 100644 --- a/toolchain/semantics/semantics_context.cpp +++ b/toolchain/semantics/semantics_context.cpp @@ -75,7 +75,9 @@ auto SemanticsContext::AddNodeAndPush(ParseTree::Node parse_node, auto SemanticsContext::AddNameToLookup(ParseTree::Node name_node, SemanticsStringId name_id, SemanticsNodeId target_id) -> void { - if (!AddNameToLookupImpl(name_id, target_id)) { + if (current_scope().names.insert(name_id).second) { + name_lookup_[name_id].push_back(target_id); + } else { CARBON_DIAGNOSTIC(NameRedefined, Error, "Redefining {0} in the same scope.", llvm::StringRef); CARBON_DIAGNOSTIC(PreviousDefinition, Note, "Previous definition is here."); @@ -88,49 +90,6 @@ auto SemanticsContext::AddNameToLookup(ParseTree::Node name_node, } } -auto SemanticsContext::AddNameToLookupImpl(SemanticsStringId name_id, - SemanticsNodeId target_id) -> bool { - if (current_scope().names.insert(name_id).second) { - name_lookup_[name_id].push_back(target_id); - return true; - } else { - return false; - } -} - -auto SemanticsContext::BindName(ParseTree::Node name_node, - SemanticsTypeId type_id, - SemanticsNodeId target_id) - -> SemanticsStringId { - CARBON_CHECK(parse_tree_->node_kind(name_node) == ParseNodeKind::DeclaredName) - << parse_tree_->node_kind(name_node); - auto name_str = parse_tree_->GetNodeText(name_node); - auto name_id = semantics_ir_->AddString(name_str); - - AddNode( - SemanticsNode::BindName::Make(name_node, type_id, name_id, target_id)); - AddNameToLookup(name_node, name_id, target_id); - return name_id; -} - -auto SemanticsContext::TempRemoveLatestNameFromLookup() -> SemanticsNodeId { - // Save the storage ID. - auto it = name_lookup_.find( - node_stack_.Peek(ParseNodeKind::PatternBinding)); - CARBON_CHECK(it != name_lookup_.end()); - CARBON_CHECK(!it->second.empty()); - auto storage_id = it->second.back(); - - // Pop the name from lookup. - if (it->second.size() == 1) { - // Erase names that no longer resolve. - name_lookup_.erase(it); - } else { - it->second.pop_back(); - } - return storage_id; -} - auto SemanticsContext::LookupName(ParseTree::Node parse_node, llvm::StringRef name) -> SemanticsNodeId { CARBON_DIAGNOSTIC(NameNotFound, Error, "Name {0} not found", llvm::StringRef); @@ -185,7 +144,7 @@ auto SemanticsContext::ImplicitAsForArgs( if (arg_refs.size() != param_refs.size()) { CARBON_CHECK(diagnostic != nullptr) << "Should have validated first"; CARBON_DIAGNOSTIC(CallArgCountMismatch, Note, - "Callable cannot be used: Received {0} argument(s), but " + "Function cannot be used: Received {0} argument(s), but " "require {1} argument(s).", int, int); diagnostic->Note(param_parse_node, CallArgCountMismatch, arg_refs.size(), @@ -204,7 +163,7 @@ auto SemanticsContext::ImplicitAsForArgs( ImplicitAsKind::Incompatible) { CARBON_CHECK(diagnostic != nullptr) << "Should have validated first"; CARBON_DIAGNOSTIC(CallArgTypeMismatch, Note, - "Callable cannot be used: Cannot implicityly convert " + "Function cannot be used: Cannot implicityly convert " "argument {0} from `{1}` to `{2}`.", size_t, std::string, std::string); diagnostic->Note(param_parse_node, CallArgTypeMismatch, i, diff --git a/toolchain/semantics/semantics_context.h b/toolchain/semantics/semantics_context.h index b45ee71117d4..ad0b373673e9 100644 --- a/toolchain/semantics/semantics_context.h +++ b/toolchain/semantics/semantics_context.h @@ -43,28 +43,6 @@ class SemanticsContext { auto AddNameToLookup(ParseTree::Node name_node, SemanticsStringId name_id, SemanticsNodeId target_id) -> void; - // Adds a name to name lookup. Ignores any name conflicts; the caller should - // ensure they were previously diagnosed by AddNameToLookup. - auto AddNameToLookupIgnoreConflicts(SemanticsStringId name_id, - SemanticsNodeId target_id) -> void { - AddNameToLookupImpl(name_id, target_id); - } - - // Binds a DeclaredName to a target node with the given type. - auto BindName(ParseTree::Node name_node, SemanticsTypeId type_id, - SemanticsNodeId target_id) -> SemanticsStringId; - - // Temporarily remove name lookup entries added by the `var`. These will be - // restored by `VariableDeclaration` using `ReaddNameToLookup`. - auto TempRemoveLatestNameFromLookup() -> SemanticsNodeId; - - // Re-adds a name to name lookup. This is typically done through BindName, but - // can also be used to restore removed names. - auto ReaddNameToLookup(SemanticsStringId name_id, SemanticsNodeId storage_id) - -> void { - name_lookup_[name_id].push_back(storage_id); - } - // Lookup up a name, returning the referenced node. auto LookupName(ParseTree::Node parse_node, llvm::StringRef name) -> SemanticsNodeId; @@ -194,10 +172,6 @@ class SemanticsContext { // TODO: This likely needs to track things which need to be destructed. }; - // Adds a name to lookup. Returns false on a name conflict. - auto AddNameToLookupImpl(SemanticsStringId name_id, SemanticsNodeId target_id) - -> bool; - // Runs ImplicitAs behavior to convert `value` to `as_type`, returning the // result type. The result will be the node to use to replace `value`. // diff --git a/toolchain/semantics/semantics_handle.cpp b/toolchain/semantics/semantics_handle.cpp index cac752cb40a6..516aac542bb3 100644 --- a/toolchain/semantics/semantics_handle.cpp +++ b/toolchain/semantics/semantics_handle.cpp @@ -372,20 +372,19 @@ auto SemanticsHandlePatternBinding(SemanticsContext& context, auto cast_type_id = context.ExpressionAsType(type_node, parsed_type_id); // Get the name. - auto name_node = context.node_stack().PopForSoloParseNode(); + auto name_node = + context.node_stack().PopForSoloParseNode(ParseNodeKind::DeclaredName); + auto name_str = context.parse_tree().GetNodeText(name_node); + auto name_id = context.semantics_ir().AddString(name_str); // Allocate storage, linked to the name for error locations. auto storage_id = context.AddNode(SemanticsNode::VarStorage::Make(name_node, cast_type_id)); // Bind the name to storage. - auto name_id = context.BindName(name_node, cast_type_id, storage_id); - - // If this node's result is used, it'll be for either the name or the - // storage address. The storage address can be found through the name, so we - // push the name. - context.node_stack().Push(parse_node, name_id); - + context.AddNodeAndPush(parse_node, + SemanticsNode::BindName::Make(name_node, cast_type_id, + name_id, storage_id)); return true; } @@ -404,8 +403,8 @@ auto SemanticsHandleReturnStatement(SemanticsContext& context, CARBON_CHECK(!context.return_scope_stack().empty()); const auto& fn_node = context.semantics_ir().GetNode(context.return_scope_stack().back()); - const auto callable = context.semantics_ir().GetCallable( - fn_node.GetAsFunctionDeclaration().second); + const auto callable = + context.semantics_ir().GetFunction(fn_node.GetAsFunctionDeclaration()); if (context.parse_tree().node_kind(context.node_stack().PeekParseNode()) == ParseNodeKind::ReturnStatementStart) { @@ -495,22 +494,28 @@ auto SemanticsHandleTupleLiteralComma(SemanticsContext& context, auto SemanticsHandleVariableDeclaration(SemanticsContext& context, ParseTree::Node parse_node) -> bool { - auto [last_parse_node, last_node_id] = - context.node_stack().PopWithParseNode(); - - if (context.parse_tree().node_kind(last_parse_node) != - ParseNodeKind::PatternBinding) { - auto storage_id = context.node_stack().Pop( + // Handle the optional initializer. + auto expr_node_id = SemanticsNodeId::Invalid; + bool has_init = + context.parse_tree().node_kind(context.node_stack().PeekParseNode()) != + ParseNodeKind::PatternBinding; + if (has_init) { + expr_node_id = context.node_stack().Pop(); + context.node_stack().PopAndDiscardSoloParseNode( ParseNodeKind::VariableInitializer); + } - auto binding = context.node_stack().PopWithParseNode( - ParseNodeKind::PatternBinding); - - // Restore the name now that the initializer is complete. - context.ReaddNameToLookup(binding.second, storage_id); + // Get the storage and add it to name lookup. + auto binding_id = + context.node_stack().Pop(ParseNodeKind::PatternBinding); + auto binding = context.semantics_ir().GetNode(binding_id); + auto [name_id, storage_id] = binding.GetAsBindName(); + context.AddNameToLookup(binding.parse_node(), name_id, storage_id); + // If there was an initializer, assign it to storage. + if (has_init) { auto cast_value_id = context.ImplicitAsRequired( - parse_node, last_node_id, + parse_node, expr_node_id, context.semantics_ir().GetNode(storage_id).type_id()); context.AddNode(SemanticsNode::Assign::Make( parse_node, context.semantics_ir().GetNode(cast_value_id).type_id(), @@ -533,8 +538,8 @@ auto SemanticsHandleVariableIntroducer(SemanticsContext& context, auto SemanticsHandleVariableInitializer(SemanticsContext& context, ParseTree::Node parse_node) -> bool { - auto storage_id = context.TempRemoveLatestNameFromLookup(); - context.node_stack().Push(parse_node, storage_id); + // No action, just a bracketing node. + context.node_stack().Push(parse_node); return true; } diff --git a/toolchain/semantics/semantics_handle_call_expression.cpp b/toolchain/semantics/semantics_handle_call_expression.cpp index 27d239ed6f8e..2746dd945302 100644 --- a/toolchain/semantics/semantics_handle_call_expression.cpp +++ b/toolchain/semantics/semantics_handle_call_expression.cpp @@ -23,8 +23,8 @@ auto SemanticsHandleCallExpression(SemanticsContext& context, return true; } - auto [_, callable_id] = name_node.GetAsFunctionDeclaration(); - auto callable = context.semantics_ir().GetCallable(callable_id); + auto function_id = name_node.GetAsFunctionDeclaration(); + auto callable = context.semantics_ir().GetFunction(function_id); CARBON_DIAGNOSTIC(NoMatchingCall, Error, "No matching callable was found."); auto diagnostic = @@ -42,7 +42,7 @@ auto SemanticsHandleCallExpression(SemanticsContext& context, // TODO: Propagate return types from callable. auto call_node_id = context.AddNode(SemanticsNode::Call::Make( - call_expr_parse_node, callable.return_type_id, refs_id, callable_id)); + call_expr_parse_node, callable.return_type_id, refs_id, function_id)); context.node_stack().Push(parse_node, call_node_id); return true; diff --git a/toolchain/semantics/semantics_handle_function.cpp b/toolchain/semantics/semantics_handle_function.cpp index 3cd51c47d18c..9fe0de7bcece 100644 --- a/toolchain/semantics/semantics_handle_function.cpp +++ b/toolchain/semantics/semantics_handle_function.cpp @@ -12,21 +12,22 @@ auto SemanticsHandleFunctionDeclaration(SemanticsContext& context, } auto SemanticsHandleFunctionDefinition(SemanticsContext& context, - ParseTree::Node parse_node) -> bool { + ParseTree::Node /*parse_node*/) -> bool { // Merges code block children up under the FunctionDefinitionStart. while (context.parse_tree().node_kind(context.node_stack().PeekParseNode()) != ParseNodeKind::FunctionDefinitionStart) { context.node_stack().PopAndIgnore(); } - auto decl_id = context.node_stack().Pop( + auto function_id = context.node_stack().Pop( ParseNodeKind::FunctionDefinitionStart); context.return_scope_stack().pop_back(); context.PopScope(); - auto block_id = context.node_block_stack().Pop(); - context.AddNode( - SemanticsNode::FunctionDefinition::Make(parse_node, decl_id, block_id)); - context.node_stack().Push(parse_node); + auto body_id = context.node_block_stack().Pop(); + auto& function = context.semantics_ir().GetFunction(function_id); + CARBON_CHECK(!function.body_id.is_valid()) + << "Already have function body: " << function.body_id; + function.body_id = body_id; return true; } @@ -53,10 +54,15 @@ auto SemanticsHandleFunctionDefinitionStart(SemanticsContext& context, auto name_str = context.parse_tree().GetNodeText(name_node); auto name_id = context.semantics_ir().AddString(name_str); - auto callable_id = context.semantics_ir().AddCallable( - {.param_refs_id = param_refs_id, .return_type_id = return_type_id}); + // Add the callable, but with an invalid body for now. The body ID is only + // finalized on function completion. + auto function_id = context.semantics_ir().AddFunction( + {.name_id = name_id, + .param_refs_id = param_refs_id, + .return_type_id = return_type_id, + .body_id = SemanticsNodeBlockId::Invalid}); auto decl_id = context.AddNode( - SemanticsNode::FunctionDeclaration::Make(fn_node, name_id, callable_id)); + SemanticsNode::FunctionDeclaration::Make(fn_node, function_id)); context.AddNameToLookup(name_node, name_id, decl_id); context.node_block_stack().Push(); @@ -64,10 +70,10 @@ auto SemanticsHandleFunctionDefinitionStart(SemanticsContext& context, for (auto ref_id : context.semantics_ir().GetNodeBlock(param_refs_id)) { auto ref = context.semantics_ir().GetNode(ref_id); auto [name_id, target_id] = ref.GetAsBindName(); - context.AddNameToLookupIgnoreConflicts(name_id, target_id); + context.AddNameToLookup(ref.parse_node(), name_id, target_id); } context.return_scope_stack().push_back(decl_id); - context.node_stack().Push(parse_node, decl_id); + context.node_stack().Push(parse_node, function_id); return true; } diff --git a/toolchain/semantics/semantics_ir.cpp b/toolchain/semantics/semantics_ir.cpp index bb6a38397d2b..6df1cc559920 100644 --- a/toolchain/semantics/semantics_ir.cpp +++ b/toolchain/semantics/semantics_ir.cpp @@ -112,7 +112,7 @@ auto SemanticsIR::Print(llvm::raw_ostream& out, bool include_builtins) const -> void { out << "cross_reference_irs_size: " << cross_reference_irs_.size() << "\n"; - PrintList(out, "callables", callables_); + PrintList(out, "functions", functions_); PrintList(out, "integer_literals", integer_literals_); PrintList(out, "real_literals", real_literals_); PrintList(out, "strings", strings_); @@ -203,7 +203,6 @@ auto SemanticsIR::StringifyType(SemanticsTypeId type_id) -> std::string { case SemanticsNodeKind::CodeBlock: case SemanticsNodeKind::CrossReference: case SemanticsNodeKind::FunctionDeclaration: - case SemanticsNodeKind::FunctionDefinition: case SemanticsNodeKind::IntegerLiteral: case SemanticsNodeKind::RealLiteral: case SemanticsNodeKind::Return: diff --git a/toolchain/semantics/semantics_ir.h b/toolchain/semantics/semantics_ir.h index 1ca46d53a208..83654ed8a983 100644 --- a/toolchain/semantics/semantics_ir.h +++ b/toolchain/semantics/semantics_ir.h @@ -12,20 +12,29 @@ namespace Carbon { -// A callable object. -struct SemanticsCallable { +// A function. +struct SemanticsFunction { auto Print(llvm::raw_ostream& out) const -> void { - out << "{param_refs: " << param_refs_id; + out << "{name: " << name_id << ", " + << "param_refs: " << param_refs_id; if (return_type_id.is_valid()) { out << ", return_type: " << return_type_id; } + if (body_id.is_valid()) { + out << ", body: " << body_id; + } out << "}"; } + // The function name. + SemanticsStringId name_id; // A block containing a single reference node per parameter. SemanticsNodeBlockId param_refs_id; // The return type. This will be invalid if the return type wasn't specified. SemanticsTypeId return_type_id; + // The body. This will be invalid for declarations which don't have a visible + // definition. + SemanticsNodeBlockId body_id; }; struct SemanticsRealLiteral { @@ -66,15 +75,20 @@ class SemanticsIR { auto Print(llvm::raw_ostream& out, bool include_builtins) const -> void; // Adds a callable, returning an ID to reference it. - auto AddCallable(SemanticsCallable callable) -> SemanticsCallableId { - SemanticsCallableId id(callables_.size()); - callables_.push_back(callable); + auto AddFunction(SemanticsFunction function) -> SemanticsFunctionId { + SemanticsFunctionId id(functions_.size()); + functions_.push_back(function); return id; } // Returns the requested callable. - auto GetCallable(SemanticsCallableId callable_id) const -> SemanticsCallable { - return callables_[callable_id.index]; + auto GetFunction(SemanticsFunctionId function_id) const -> SemanticsFunction { + return functions_[function_id.index]; + } + + // Returns the requested callable. + auto GetFunction(SemanticsFunctionId function_id) -> SemanticsFunction& { + return functions_[function_id.index]; } // Adds an integer literal, returning an ID to reference it. @@ -194,7 +208,7 @@ class SemanticsIR { // Produces a string version of a type. auto StringifyType(SemanticsTypeId type_id) -> std::string; - auto callables_size() const -> int { return callables_.size(); } + auto functions_size() const -> int { return functions_.size(); } auto nodes_size() const -> int { return nodes_.size(); } auto types() const -> const llvm::SmallVector& { @@ -227,7 +241,7 @@ class SemanticsIR { bool has_errors_ = false; // Storage for callable objects. - llvm::SmallVector callables_; + llvm::SmallVector functions_; // Related IRs. There will always be at least 2 entries, the builtin IR (used // for references of builtins) followed by the current IR (used for references diff --git a/toolchain/semantics/semantics_ir_test.cpp b/toolchain/semantics/semantics_ir_test.cpp index e30bdae25413..b4bbfdb82142 100644 --- a/toolchain/semantics/semantics_ir_test.cpp +++ b/toolchain/semantics/semantics_ir_test.cpp @@ -51,7 +51,7 @@ TEST(SemanticsIRTest, YAML) { Yaml::Value::FromText(print_output), ElementsAre(Yaml::Mapping(ElementsAre( Pair("cross_reference_irs_size", "1"), - Pair("callables", Yaml::Sequence(IsEmpty())), + Pair("functions", Yaml::Sequence(IsEmpty())), Pair("integer_literals", Yaml::Sequence(ElementsAre("0"))), Pair("real_literals", Yaml::Sequence(IsEmpty())), Pair("strings", Yaml::Sequence(ElementsAre("x"))), diff --git a/toolchain/semantics/semantics_node.h b/toolchain/semantics/semantics_node.h index b333c157f065..6b05de13470e 100644 --- a/toolchain/semantics/semantics_node.h +++ b/toolchain/semantics/semantics_node.h @@ -50,11 +50,11 @@ constexpr SemanticsNodeId SemanticsNodeId::Invalid = SemanticsNodeId(SemanticsBuiltinKind::Name.AsInt()); #include "toolchain/semantics/semantics_builtin_kind.def" -// The ID of a callable, such as a function. -struct SemanticsCallableId : public IndexBase { +// The ID of a function. +struct SemanticsFunctionId : public IndexBase { using IndexBase::IndexBase; auto Print(llvm::raw_ostream& out) const -> void { - out << "callable"; + out << "function"; IndexBase::Print(out); } }; @@ -280,7 +280,7 @@ class SemanticsNode { using Call = Factory; + SemanticsFunctionId /*function_id*/>; using CodeBlock = FactoryNoType; @@ -303,13 +303,7 @@ class SemanticsNode { using FunctionDeclaration = FactoryNoType; - - using FunctionDefinition = - FactoryNoType; + SemanticsFunctionId /*function_id*/>; using IntegerLiteral = Factory; diff --git a/toolchain/semantics/semantics_node_kind.def b/toolchain/semantics/semantics_node_kind.def index e1ec3d7fe701..784e222a9ae1 100644 --- a/toolchain/semantics/semantics_node_kind.def +++ b/toolchain/semantics/semantics_node_kind.def @@ -27,7 +27,6 @@ CARBON_SEMANTICS_NODE_KIND(Builtin) CARBON_SEMANTICS_NODE_KIND(Call) CARBON_SEMANTICS_NODE_KIND(CodeBlock) CARBON_SEMANTICS_NODE_KIND(FunctionDeclaration) -CARBON_SEMANTICS_NODE_KIND(FunctionDefinition) CARBON_SEMANTICS_NODE_KIND(IntegerLiteral) CARBON_SEMANTICS_NODE_KIND(RealLiteral) CARBON_SEMANTICS_NODE_KIND(Return) diff --git a/toolchain/semantics/semantics_node_stack.h b/toolchain/semantics/semantics_node_stack.h index 46a0c4a3586a..a8d96250d8f5 100644 --- a/toolchain/semantics/semantics_node_stack.h +++ b/toolchain/semantics/semantics_node_stack.h @@ -139,6 +139,8 @@ class SemanticsNodeStack { explicit Entry(ParseTree::Node parse_node, SemanticsNodeBlockId node_block_id) : parse_node(parse_node), node_block_id(node_block_id) {} + explicit Entry(ParseTree::Node parse_node, SemanticsFunctionId function_id) + : parse_node(parse_node), function_id(function_id) {} explicit Entry(ParseTree::Node parse_node, SemanticsStringId name_id) : parse_node(parse_node), name_id(name_id) {} explicit Entry(ParseTree::Node parse_node, SemanticsTypeId type_id) @@ -153,6 +155,9 @@ class SemanticsNodeStack { if constexpr (std::is_same()) { return node_block_id; } + if constexpr (std::is_same()) { + return function_id; + } if constexpr (std::is_same()) { return name_id; } @@ -172,6 +177,7 @@ class SemanticsNodeStack { union { SemanticsNodeId node_id; SemanticsNodeBlockId node_block_id; + SemanticsFunctionId function_id; SemanticsStringId name_id; SemanticsTypeId type_id; }; @@ -184,6 +190,8 @@ class SemanticsNodeStack { "Need standard layout for type punning"); static_assert(std::is_standard_layout_v, "Need standard layout for type punning"); + static_assert(std::is_standard_layout_v, + "Need standard layout for type punning"); static_assert(std::is_standard_layout_v, "Need standard layout for type punning"); static_assert(std::is_standard_layout_v, diff --git a/toolchain/semantics/testdata/basics/builtin_types.carbon b/toolchain/semantics/testdata/basics/builtin_types.carbon index 77c5d72b0d3f..71ea748d8dd9 100644 --- a/toolchain/semantics/testdata/basics/builtin_types.carbon +++ b/toolchain/semantics/testdata/basics/builtin_types.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 0, diff --git a/toolchain/semantics/testdata/basics/empty.carbon b/toolchain/semantics/testdata/basics/empty.carbon index c901e09d9281..264027dc491c 100644 --- a/toolchain/semantics/testdata/basics/empty.carbon +++ b/toolchain/semantics/testdata/basics/empty.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/basics/empty_decl.carbon b/toolchain/semantics/testdata/basics/empty_decl.carbon index 383a20dd2162..0da891a4fc01 100644 --- a/toolchain/semantics/testdata/basics/empty_decl.carbon +++ b/toolchain/semantics/testdata/basics/empty_decl.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/basics/fail_name_lookup.carbon b/toolchain/semantics/testdata/basics/fail_name_lookup.carbon index f210ba9355f1..9fed8695edf8 100644 --- a/toolchain/semantics/testdata/basics/fail_name_lookup.carbon +++ b/toolchain/semantics/testdata/basics/fail_name_lookup.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block0}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -18,15 +18,13 @@ // CHECK:STDOUT: nodeEmptyTupleType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+1, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/designators/fail_unsupported.carbon b/toolchain/semantics/testdata/designators/fail_unsupported.carbon index 941453233ed3..49f6a32ebcad 100644 --- a/toolchain/semantics/testdata/designators/fail_unsupported.carbon +++ b/toolchain/semantics/testdata/designators/fail_unsupported.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/call/empty_struct.carbon b/toolchain/semantics/testdata/function/call/empty_struct.carbon index b6266c2c9bb8..b1804257475e 100644 --- a/toolchain/semantics/testdata/function/call/empty_struct.carbon +++ b/toolchain/semantics/testdata/function/call/empty_struct.carbon @@ -4,9 +4,9 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2, return_type: type0}, -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str1, param_refs: block2, return_type: type0, body: block4}, +// CHECK:STDOUT: {name: str2, param_refs: block0, body: block5}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -27,14 +27,12 @@ // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+2, type: type0}, // CHECK:STDOUT: {kind: StructValue, arg0: block0, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: ReturnExpression, arg0: node+2, type: type0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+5, arg1: block4}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str2, arg1: callable1}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, // CHECK:STDOUT: {kind: StructValue, arg0: block0, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+9, type: type0}, -// CHECK:STDOUT: {kind: Call, arg0: block6, arg1: callable0, type: type0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+8, arg1: block5}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+8, type: type0}, +// CHECK:STDOUT: {kind: Call, arg0: block6, arg1: function0, type: type0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -52,19 +50,17 @@ // CHECK:STDOUT: node+4, // CHECK:STDOUT: node+5, // CHECK:STDOUT: node+7, -// CHECK:STDOUT: node+8, -// CHECK:STDOUT: node+12, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+6, // CHECK:STDOUT: ], // CHECK:STDOUT: [ +// CHECK:STDOUT: node+8, // CHECK:STDOUT: node+9, // CHECK:STDOUT: node+10, -// CHECK:STDOUT: node+11, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+10, +// CHECK:STDOUT: node+9, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/call/fail_param_count.carbon b/toolchain/semantics/testdata/function/call/fail_param_count.carbon index b57470b12052..1b4162a4885f 100644 --- a/toolchain/semantics/testdata/function/call/fail_param_count.carbon +++ b/toolchain/semantics/testdata/function/call/fail_param_count.carbon @@ -4,11 +4,11 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, -// CHECK:STDOUT: {param_refs: block3}, -// CHECK:STDOUT: {param_refs: block5}, -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block0}, +// CHECK:STDOUT: {name: str2, param_refs: block3, body: block0}, +// CHECK:STDOUT: {name: str4, param_refs: block5, body: block0}, +// CHECK:STDOUT: {name: str5, param_refs: block0, body: block6}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, @@ -33,64 +33,59 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: VarStorage, type: type1}, -// CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+2, type: type1}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str2, arg1: callable1}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+4, arg1: block0}, +// CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+1, type: type1}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, // CHECK:STDOUT: {kind: VarStorage, type: type1}, -// CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+6, type: type1}, +// CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+4, type: type1}, // CHECK:STDOUT: {kind: VarStorage, type: type1}, -// CHECK:STDOUT: {kind: BindName, arg0: str3, arg1: node+8, type: type1}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str4, arg1: callable2}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+10, arg1: block0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str5, arg1: callable3}, +// CHECK:STDOUT: {kind: BindName, arg0: str3, arg1: node+6, type: type1}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function2}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function3}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type1}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+13, type: type1}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+10, type: type1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int1, type: type1}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+15, type: type1}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+12, type: type1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int2, type: type1}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+17, type: type1}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+14, type: type1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int3, type: type1}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+19, type: type1}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+16, type: type1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int4, type: type1}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+21, type: type1}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+18, type: type1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int5, type: type1}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+23, type: type1}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+12, arg1: block6}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+20, type: type1}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+1, -// CHECK:STDOUT: node+4, -// CHECK:STDOUT: node+5, -// CHECK:STDOUT: node+10, -// CHECK:STDOUT: node+11, -// CHECK:STDOUT: node+12, -// CHECK:STDOUT: node+25, -// CHECK:STDOUT: ], -// CHECK:STDOUT: [ -// CHECK:STDOUT: node+2, // CHECK:STDOUT: node+3, -// CHECK:STDOUT: ], -// CHECK:STDOUT: [ -// CHECK:STDOUT: node+3, -// CHECK:STDOUT: ], -// CHECK:STDOUT: [ -// CHECK:STDOUT: node+6, -// CHECK:STDOUT: node+7, // CHECK:STDOUT: node+8, // CHECK:STDOUT: node+9, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+7, -// CHECK:STDOUT: node+9, +// CHECK:STDOUT: node+1, +// CHECK:STDOUT: node+2, // CHECK:STDOUT: ], // CHECK:STDOUT: [ +// CHECK:STDOUT: node+2, +// CHECK:STDOUT: ], +// CHECK:STDOUT: [ +// CHECK:STDOUT: node+4, +// CHECK:STDOUT: node+5, +// CHECK:STDOUT: node+6, +// CHECK:STDOUT: node+7, +// CHECK:STDOUT: ], +// CHECK:STDOUT: [ +// CHECK:STDOUT: node+5, +// CHECK:STDOUT: node+7, +// CHECK:STDOUT: ], +// CHECK:STDOUT: [ +// CHECK:STDOUT: node+10, +// CHECK:STDOUT: node+11, +// CHECK:STDOUT: node+12, // CHECK:STDOUT: node+13, // CHECK:STDOUT: node+14, // CHECK:STDOUT: node+15, @@ -100,23 +95,20 @@ // CHECK:STDOUT: node+19, // CHECK:STDOUT: node+20, // CHECK:STDOUT: node+21, -// CHECK:STDOUT: node+22, -// CHECK:STDOUT: node+23, -// CHECK:STDOUT: node+24, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+14, +// CHECK:STDOUT: node+11, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+16, -// CHECK:STDOUT: node+18, +// CHECK:STDOUT: node+13, +// CHECK:STDOUT: node+15, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+20, -// CHECK:STDOUT: node+22, +// CHECK:STDOUT: node+17, +// CHECK:STDOUT: node+19, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+24, +// CHECK:STDOUT: node+21, // CHECK:STDOUT: ], // CHECK:STDOUT: ] @@ -126,23 +118,23 @@ fn Run2(a: i32, b: i32) {} fn Main() { // CHECK:STDERR: fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found. - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-6]]:1: Callable cannot be used: Received 1 argument(s), but require 0 argument(s). + // CHECK:STDERR: fail_param_count.carbon:[[@LINE-6]]:1: Function cannot be used: Received 1 argument(s), but require 0 argument(s). Run0(1); // CHECK:STDERR: fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found. - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-9]]:1: Callable cannot be used: Received 2 argument(s), but require 0 argument(s). + // CHECK:STDERR: fail_param_count.carbon:[[@LINE-9]]:1: Function cannot be used: Received 2 argument(s), but require 0 argument(s). Run0(0, 1); // CHECK:STDERR: fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found. - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-12]]:1: Callable cannot be used: Received 0 argument(s), but require 1 argument(s). + // CHECK:STDERR: fail_param_count.carbon:[[@LINE-12]]:1: Function cannot be used: Received 0 argument(s), but require 1 argument(s). Run1(); // CHECK:STDERR: fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found. - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-15]]:1: Callable cannot be used: Received 2 argument(s), but require 1 argument(s). + // CHECK:STDERR: fail_param_count.carbon:[[@LINE-15]]:1: Function cannot be used: Received 2 argument(s), but require 1 argument(s). Run1(0, 1); // CHECK:STDERR: fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found. - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-18]]:1: Callable cannot be used: Received 0 argument(s), but require 2 argument(s). + // CHECK:STDERR: fail_param_count.carbon:[[@LINE-18]]:1: Function cannot be used: Received 0 argument(s), but require 2 argument(s). Run2(); // CHECK:STDERR: fail_param_count.carbon:[[@LINE+2]]:7: No matching callable was found. - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-21]]:1: Callable cannot be used: Received 1 argument(s), but require 2 argument(s). + // CHECK:STDERR: fail_param_count.carbon:[[@LINE-21]]:1: Function cannot be used: Received 1 argument(s), but require 2 argument(s). Run2(0); } diff --git a/toolchain/semantics/testdata/function/call/fail_param_type.carbon b/toolchain/semantics/testdata/function/call/fail_param_type.carbon index a51aaa3a549e..e83edf36a404 100644 --- a/toolchain/semantics/testdata/function/call/fail_param_type.carbon +++ b/toolchain/semantics/testdata/function/call/fail_param_type.carbon @@ -4,9 +4,9 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2}, -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str1, param_refs: block2, body: block0}, +// CHECK:STDOUT: {name: str2, param_refs: block0, body: block4}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -26,12 +26,10 @@ // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+2, arg1: block0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str2, arg1: callable1}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, // CHECK:STDOUT: {kind: RealLiteral, arg0: real0, type: type2}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+5, type: type2}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+4, arg1: block4}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+4, type: type2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -46,15 +44,13 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: node+2, // CHECK:STDOUT: node+3, +// CHECK:STDOUT: ], +// CHECK:STDOUT: [ // CHECK:STDOUT: node+4, -// CHECK:STDOUT: node+7, +// CHECK:STDOUT: node+5, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+5, -// CHECK:STDOUT: node+6, -// CHECK:STDOUT: ], -// CHECK:STDOUT: [ -// CHECK:STDOUT: node+6, // CHECK:STDOUT: ], // CHECK:STDOUT: ] @@ -62,6 +58,6 @@ fn Run(a: i32) {} fn Main() { // CHECK:STDERR: fail_param_type.carbon:[[@LINE+2]]:6: No matching callable was found. - // CHECK:STDERR: fail_param_type.carbon:[[@LINE-4]]:1: Callable cannot be used: Cannot implicityly convert argument 0 from `f64` to `i32`. + // CHECK:STDERR: fail_param_type.carbon:[[@LINE-4]]:1: Function cannot be used: Cannot implicityly convert argument 0 from `f64` to `i32`. Run(1.0); } diff --git a/toolchain/semantics/testdata/function/call/fail_return_type_mismatch.carbon b/toolchain/semantics/testdata/function/call/fail_return_type_mismatch.carbon index 1880a1102c67..9890eb292431 100644 --- a/toolchain/semantics/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/semantics/testdata/function/call/fail_return_type_mismatch.carbon @@ -4,9 +4,9 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0, return_type: type0}, -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, return_type: type0, body: block2}, +// CHECK:STDOUT: {name: str1, param_refs: block0, body: block3}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -24,16 +24,14 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: RealLiteral, arg0: real0, type: type0}, // CHECK:STDOUT: {kind: ReturnExpression, arg0: node+1, type: type0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable1}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, // CHECK:STDOUT: {kind: VarStorage, type: type2}, -// CHECK:STDOUT: {kind: BindName, arg0: str2, arg1: node+5, type: type2}, -// CHECK:STDOUT: {kind: Call, arg0: block0, arg1: callable0, type: type0}, -// CHECK:STDOUT: {kind: Assign, arg0: node+5, arg1: nodeInvalidType, type: typeInvalidType}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+4, arg1: block3}, +// CHECK:STDOUT: {kind: BindName, arg0: str2, arg1: node+4, type: type2}, +// CHECK:STDOUT: {kind: Call, arg0: block0, arg1: function0, type: type0}, +// CHECK:STDOUT: {kind: Assign, arg0: node+4, arg1: nodeInvalidType, type: typeInvalidType}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -41,18 +39,16 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, // CHECK:STDOUT: node+3, -// CHECK:STDOUT: node+4, -// CHECK:STDOUT: node+9, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, // CHECK:STDOUT: node+2, // CHECK:STDOUT: ], // CHECK:STDOUT: [ +// CHECK:STDOUT: node+4, // CHECK:STDOUT: node+5, // CHECK:STDOUT: node+6, // CHECK:STDOUT: node+7, -// CHECK:STDOUT: node+8, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/call/i32.carbon b/toolchain/semantics/testdata/function/call/i32.carbon index 149e82c14e57..55a58f9782c5 100644 --- a/toolchain/semantics/testdata/function/call/i32.carbon +++ b/toolchain/semantics/testdata/function/call/i32.carbon @@ -4,9 +4,9 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2, return_type: type0}, -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str1, param_refs: block2, return_type: type0, body: block4}, +// CHECK:STDOUT: {name: str2, param_refs: block0, body: block5}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, @@ -26,17 +26,15 @@ // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: ReturnExpression, arg0: node+0, type: type0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+2, arg1: block4}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str2, arg1: callable1}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, // CHECK:STDOUT: {kind: VarStorage, type: type0}, -// CHECK:STDOUT: {kind: BindName, arg0: str3, arg1: node+6, type: type0}, +// CHECK:STDOUT: {kind: BindName, arg0: str3, arg1: node+5, type: type0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+8, type: type0}, -// CHECK:STDOUT: {kind: Call, arg0: block6, arg1: callable0, type: type0}, -// CHECK:STDOUT: {kind: Assign, arg0: node+6, arg1: node+10, type: type0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+5, arg1: block5}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+7, type: type0}, +// CHECK:STDOUT: {kind: Call, arg0: block6, arg1: function0, type: type0}, +// CHECK:STDOUT: {kind: Assign, arg0: node+5, arg1: node+9, type: type0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -51,22 +49,20 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: node+2, // CHECK:STDOUT: node+4, -// CHECK:STDOUT: node+5, -// CHECK:STDOUT: node+12, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+3, // CHECK:STDOUT: ], // CHECK:STDOUT: [ +// CHECK:STDOUT: node+5, // CHECK:STDOUT: node+6, // CHECK:STDOUT: node+7, // CHECK:STDOUT: node+8, // CHECK:STDOUT: node+9, // CHECK:STDOUT: node+10, -// CHECK:STDOUT: node+11, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+9, +// CHECK:STDOUT: node+8, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/call/more_param_ir.carbon b/toolchain/semantics/testdata/function/call/more_param_ir.carbon index ed929e7bd84a..5a2dfdcb2ff5 100644 --- a/toolchain/semantics/testdata/function/call/more_param_ir.carbon +++ b/toolchain/semantics/testdata/function/call/more_param_ir.carbon @@ -4,9 +4,9 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2}, -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str3, param_refs: block2, body: block0}, +// CHECK:STDOUT: {name: str4, param_refs: block0, body: block4}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, @@ -36,23 +36,21 @@ // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+2, type: type0}, // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str2, arg1: node+4, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str3, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+6, arg1: block0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str4, arg1: callable1}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int1, type: type0}, -// CHECK:STDOUT: {kind: BinaryOperatorAdd, arg0: node+9, arg1: node+10, type: type0}, +// CHECK:STDOUT: {kind: BinaryOperatorAdd, arg0: node+8, arg1: node+9, type: type0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int2, type: type0}, -// CHECK:STDOUT: {kind: BinaryOperatorAdd, arg0: node+11, arg1: node+12, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+13, type: type0}, +// CHECK:STDOUT: {kind: BinaryOperatorAdd, arg0: node+10, arg1: node+11, type: type0}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+12, type: type0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int3, type: type0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int4, type: type0}, -// CHECK:STDOUT: {kind: BinaryOperatorAdd, arg0: node+15, arg1: node+16, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+17, type: type0}, +// CHECK:STDOUT: {kind: BinaryOperatorAdd, arg0: node+14, arg1: node+15, type: type0}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+16, type: type0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int5, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+19, type: type0}, -// CHECK:STDOUT: {kind: Call, arg0: block5, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+8, arg1: block4}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+18, type: type0}, +// CHECK:STDOUT: {kind: Call, arg0: block5, arg1: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -73,10 +71,9 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: node+6, // CHECK:STDOUT: node+7, -// CHECK:STDOUT: node+8, -// CHECK:STDOUT: node+22, // CHECK:STDOUT: ], // CHECK:STDOUT: [ +// CHECK:STDOUT: node+8, // CHECK:STDOUT: node+9, // CHECK:STDOUT: node+10, // CHECK:STDOUT: node+11, @@ -89,12 +86,11 @@ // CHECK:STDOUT: node+18, // CHECK:STDOUT: node+19, // CHECK:STDOUT: node+20, -// CHECK:STDOUT: node+21, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+14, -// CHECK:STDOUT: node+18, -// CHECK:STDOUT: node+20, +// CHECK:STDOUT: node+13, +// CHECK:STDOUT: node+17, +// CHECK:STDOUT: node+19, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/call/params_one.carbon b/toolchain/semantics/testdata/function/call/params_one.carbon index 4c6d848f8d44..f4f8e5b1e184 100644 --- a/toolchain/semantics/testdata/function/call/params_one.carbon +++ b/toolchain/semantics/testdata/function/call/params_one.carbon @@ -4,9 +4,9 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2}, -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str1, param_refs: block2, body: block0}, +// CHECK:STDOUT: {name: str2, param_refs: block0, body: block4}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, @@ -25,13 +25,11 @@ // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+2, arg1: block0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str2, arg1: callable1}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+5, type: type0}, -// CHECK:STDOUT: {kind: Call, arg0: block5, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+4, arg1: block4}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+4, type: type0}, +// CHECK:STDOUT: {kind: Call, arg0: block5, arg1: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -46,16 +44,14 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: node+2, // CHECK:STDOUT: node+3, +// CHECK:STDOUT: ], +// CHECK:STDOUT: [ // CHECK:STDOUT: node+4, -// CHECK:STDOUT: node+8, +// CHECK:STDOUT: node+5, +// CHECK:STDOUT: node+6, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+5, -// CHECK:STDOUT: node+6, -// CHECK:STDOUT: node+7, -// CHECK:STDOUT: ], -// CHECK:STDOUT: [ -// CHECK:STDOUT: node+6, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/call/params_one_comma.carbon b/toolchain/semantics/testdata/function/call/params_one_comma.carbon index a72ce19b7ca6..5ac3e2f7e1df 100644 --- a/toolchain/semantics/testdata/function/call/params_one_comma.carbon +++ b/toolchain/semantics/testdata/function/call/params_one_comma.carbon @@ -4,9 +4,9 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2}, -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str1, param_refs: block2, body: block0}, +// CHECK:STDOUT: {name: str2, param_refs: block0, body: block4}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, @@ -26,16 +26,14 @@ // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+2, arg1: block0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str2, arg1: callable1}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+5, type: type0}, -// CHECK:STDOUT: {kind: Call, arg0: block5, arg1: callable0}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+4, type: type0}, +// CHECK:STDOUT: {kind: Call, arg0: block5, arg1: function0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int1, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+8, type: type0}, -// CHECK:STDOUT: {kind: Call, arg0: block6, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+4, arg1: block4}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+7, type: type0}, +// CHECK:STDOUT: {kind: Call, arg0: block6, arg1: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -50,22 +48,20 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: node+2, // CHECK:STDOUT: node+3, -// CHECK:STDOUT: node+4, -// CHECK:STDOUT: node+11, // CHECK:STDOUT: ], // CHECK:STDOUT: [ +// CHECK:STDOUT: node+4, // CHECK:STDOUT: node+5, // CHECK:STDOUT: node+6, // CHECK:STDOUT: node+7, // CHECK:STDOUT: node+8, // CHECK:STDOUT: node+9, -// CHECK:STDOUT: node+10, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+6, +// CHECK:STDOUT: node+5, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+9, +// CHECK:STDOUT: node+8, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/call/params_two.carbon b/toolchain/semantics/testdata/function/call/params_two.carbon index f00ee749cab5..41beda7f60e1 100644 --- a/toolchain/semantics/testdata/function/call/params_two.carbon +++ b/toolchain/semantics/testdata/function/call/params_two.carbon @@ -4,9 +4,9 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2}, -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str2, param_refs: block2, body: block0}, +// CHECK:STDOUT: {name: str3, param_refs: block0, body: block4}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, @@ -29,15 +29,13 @@ // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+2, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str2, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+4, arg1: block0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str3, arg1: callable1}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+7, type: type0}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+6, type: type0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int1, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+9, type: type0}, -// CHECK:STDOUT: {kind: Call, arg0: block5, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+6, arg1: block4}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+8, type: type0}, +// CHECK:STDOUT: {kind: Call, arg0: block5, arg1: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -55,19 +53,17 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: node+4, // CHECK:STDOUT: node+5, -// CHECK:STDOUT: node+6, -// CHECK:STDOUT: node+12, // CHECK:STDOUT: ], // CHECK:STDOUT: [ +// CHECK:STDOUT: node+6, // CHECK:STDOUT: node+7, // CHECK:STDOUT: node+8, // CHECK:STDOUT: node+9, // CHECK:STDOUT: node+10, -// CHECK:STDOUT: node+11, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+8, -// CHECK:STDOUT: node+10, +// CHECK:STDOUT: node+7, +// CHECK:STDOUT: node+9, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/call/params_two_comma.carbon b/toolchain/semantics/testdata/function/call/params_two_comma.carbon index ebf101799efe..50afe4998794 100644 --- a/toolchain/semantics/testdata/function/call/params_two_comma.carbon +++ b/toolchain/semantics/testdata/function/call/params_two_comma.carbon @@ -4,9 +4,9 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2}, -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str2, param_refs: block2, body: block0}, +// CHECK:STDOUT: {name: str3, param_refs: block0, body: block4}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, @@ -31,20 +31,18 @@ // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+2, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str2, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+4, arg1: block0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str3, arg1: callable1}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+7, type: type0}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+6, type: type0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int1, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+9, type: type0}, -// CHECK:STDOUT: {kind: Call, arg0: block5, arg1: callable0}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+8, type: type0}, +// CHECK:STDOUT: {kind: Call, arg0: block5, arg1: function0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int2, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+12, type: type0}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+11, type: type0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int3, type: type0}, -// CHECK:STDOUT: {kind: StubReference, arg0: node+14, type: type0}, -// CHECK:STDOUT: {kind: Call, arg0: block6, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+6, arg1: block4}, +// CHECK:STDOUT: {kind: StubReference, arg0: node+13, type: type0}, +// CHECK:STDOUT: {kind: Call, arg0: block6, arg1: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -62,10 +60,9 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: node+4, // CHECK:STDOUT: node+5, -// CHECK:STDOUT: node+6, -// CHECK:STDOUT: node+17, // CHECK:STDOUT: ], // CHECK:STDOUT: [ +// CHECK:STDOUT: node+6, // CHECK:STDOUT: node+7, // CHECK:STDOUT: node+8, // CHECK:STDOUT: node+9, @@ -75,15 +72,14 @@ // CHECK:STDOUT: node+13, // CHECK:STDOUT: node+14, // CHECK:STDOUT: node+15, -// CHECK:STDOUT: node+16, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+8, -// CHECK:STDOUT: node+10, +// CHECK:STDOUT: node+7, +// CHECK:STDOUT: node+9, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+13, -// CHECK:STDOUT: node+15, +// CHECK:STDOUT: node+12, +// CHECK:STDOUT: node+14, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/call/params_zero.carbon b/toolchain/semantics/testdata/function/call/params_zero.carbon index b20e6fc1f0c6..50ea6007bbc4 100644 --- a/toolchain/semantics/testdata/function/call/params_zero.carbon +++ b/toolchain/semantics/testdata/function/call/params_zero.carbon @@ -4,9 +4,9 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block0}, +// CHECK:STDOUT: {name: str1, param_refs: block0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -20,11 +20,9 @@ // CHECK:STDOUT: nodeEmptyTupleType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable1}, -// CHECK:STDOUT: {kind: Call, arg0: block0, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+2, arg1: block2}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, +// CHECK:STDOUT: {kind: Call, arg0: block0, arg1: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -32,11 +30,9 @@ // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, // CHECK:STDOUT: node+1, -// CHECK:STDOUT: node+2, -// CHECK:STDOUT: node+4, // CHECK:STDOUT: ], // CHECK:STDOUT: [ -// CHECK:STDOUT: node+3, +// CHECK:STDOUT: node+2, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/definition/fail_param_name_conflict.carbon b/toolchain/semantics/testdata/function/definition/fail_param_name_conflict.carbon index 2d113782a996..1594468c8510 100644 --- a/toolchain/semantics/testdata/function/definition/fail_param_name_conflict.carbon +++ b/toolchain/semantics/testdata/function/definition/fail_param_name_conflict.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str1, param_refs: block2, body: block0}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -24,8 +24,7 @@ // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+2, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+4, arg1: block0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -42,7 +41,6 @@ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+4, -// CHECK:STDOUT: node+5, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/definition/order.carbon b/toolchain/semantics/testdata/function/definition/order.carbon index 4154d762498f..517e6e4b4084 100644 --- a/toolchain/semantics/testdata/function/definition/order.carbon +++ b/toolchain/semantics/testdata/function/definition/order.carbon @@ -4,10 +4,10 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, -// CHECK:STDOUT: {param_refs: block0}, -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block0}, +// CHECK:STDOUT: {name: str1, param_refs: block0, body: block0}, +// CHECK:STDOUT: {name: str2, param_refs: block0, body: block0}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -22,12 +22,9 @@ // CHECK:STDOUT: nodeEmptyTupleType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable1}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+2, arg1: block0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str2, arg1: callable2}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+4, arg1: block0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -36,9 +33,6 @@ // CHECK:STDOUT: node+0, // CHECK:STDOUT: node+1, // CHECK:STDOUT: node+2, -// CHECK:STDOUT: node+3, -// CHECK:STDOUT: node+4, -// CHECK:STDOUT: node+5, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/definition/params_one.carbon b/toolchain/semantics/testdata/function/definition/params_one.carbon index 41c5fb55069b..c0169825cd08 100644 --- a/toolchain/semantics/testdata/function/definition/params_one.carbon +++ b/toolchain/semantics/testdata/function/definition/params_one.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str1, param_refs: block2, body: block0}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -22,8 +22,7 @@ // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+2, arg1: block0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -37,7 +36,6 @@ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+2, -// CHECK:STDOUT: node+3, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/definition/params_one_comma.carbon b/toolchain/semantics/testdata/function/definition/params_one_comma.carbon index 570e8e026f7a..d8f40919a478 100644 --- a/toolchain/semantics/testdata/function/definition/params_one_comma.carbon +++ b/toolchain/semantics/testdata/function/definition/params_one_comma.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str1, param_refs: block2, body: block0}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -22,8 +22,7 @@ // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+2, arg1: block0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -37,7 +36,6 @@ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+2, -// CHECK:STDOUT: node+3, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/definition/params_two.carbon b/toolchain/semantics/testdata/function/definition/params_two.carbon index c2639e01ee57..0e1b618101e5 100644 --- a/toolchain/semantics/testdata/function/definition/params_two.carbon +++ b/toolchain/semantics/testdata/function/definition/params_two.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str2, param_refs: block2, body: block0}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -25,8 +25,7 @@ // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+2, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str2, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+4, arg1: block0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -43,7 +42,6 @@ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+4, -// CHECK:STDOUT: node+5, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/definition/params_two_comma.carbon b/toolchain/semantics/testdata/function/definition/params_two_comma.carbon index d504af1871de..b508b2d1ddb7 100644 --- a/toolchain/semantics/testdata/function/definition/params_two_comma.carbon +++ b/toolchain/semantics/testdata/function/definition/params_two_comma.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str2, param_refs: block2, body: block0}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -25,8 +25,7 @@ // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+2, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str2, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+4, arg1: block0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -43,7 +42,6 @@ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+4, -// CHECK:STDOUT: node+5, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/definition/params_zero.carbon b/toolchain/semantics/testdata/function/definition/params_zero.carbon index d4b23afbcc01..b1fe8b956a8b 100644 --- a/toolchain/semantics/testdata/function/definition/params_zero.carbon +++ b/toolchain/semantics/testdata/function/definition/params_zero.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block0}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -18,15 +18,13 @@ // CHECK:STDOUT: nodeEmptyTupleType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+1, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/function/definition/same_param_name.carbon b/toolchain/semantics/testdata/function/definition/same_param_name.carbon index 07cc52222489..06ac0f3ae416 100644 --- a/toolchain/semantics/testdata/function/definition/same_param_name.carbon +++ b/toolchain/semantics/testdata/function/definition/same_param_name.carbon @@ -4,9 +4,9 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block2}, -// CHECK:STDOUT: {param_refs: block5}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str1, param_refs: block2, body: block0}, +// CHECK:STDOUT: {name: str2, param_refs: block5, body: block0}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -24,12 +24,10 @@ // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+2, arg1: block0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: VarStorage, type: type0}, -// CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+4, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str2, arg1: callable1}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+6, arg1: block0}, +// CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+3, type: type0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function1}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -43,16 +41,14 @@ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+2, +// CHECK:STDOUT: node+5, +// CHECK:STDOUT: ], +// CHECK:STDOUT: [ // CHECK:STDOUT: node+3, -// CHECK:STDOUT: node+6, -// CHECK:STDOUT: node+7, +// CHECK:STDOUT: node+4, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+4, -// CHECK:STDOUT: node+5, -// CHECK:STDOUT: ], -// CHECK:STDOUT: [ -// CHECK:STDOUT: node+5, // CHECK:STDOUT: ], // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/operators/binary_op.carbon b/toolchain/semantics/testdata/operators/binary_op.carbon index 4c0888c14d5e..d8396bced031 100644 --- a/toolchain/semantics/testdata/operators/binary_op.carbon +++ b/toolchain/semantics/testdata/operators/binary_op.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0, return_type: type0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, return_type: type0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 12, @@ -20,19 +20,17 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int1, type: type0}, // CHECK:STDOUT: {kind: BinaryOperatorAdd, arg0: node+1, arg1: node+2, type: type0}, // CHECK:STDOUT: {kind: ReturnExpression, arg0: node+3, type: type0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+5, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/operators/fail_type_mismatch.carbon b/toolchain/semantics/testdata/operators/fail_type_mismatch.carbon index bd394a09c78f..b484ba7b6613 100644 --- a/toolchain/semantics/testdata/operators/fail_type_mismatch.carbon +++ b/toolchain/semantics/testdata/operators/fail_type_mismatch.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0, return_type: type0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, return_type: type0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 12, @@ -21,19 +21,17 @@ // CHECK:STDOUT: nodeFloatingPointType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type0}, // CHECK:STDOUT: {kind: RealLiteral, arg0: real0, type: type1}, // CHECK:STDOUT: {kind: BinaryOperatorAdd, arg0: nodeInvalidType, arg1: node+2, type: typeInvalidType}, // CHECK:STDOUT: {kind: ReturnExpression, arg0: node+3, type: typeInvalidType}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+5, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/operators/fail_type_mismatch_once.carbon b/toolchain/semantics/testdata/operators/fail_type_mismatch_once.carbon index 36f819f7b00f..aad7ae8ec70a 100644 --- a/toolchain/semantics/testdata/operators/fail_type_mismatch_once.carbon +++ b/toolchain/semantics/testdata/operators/fail_type_mismatch_once.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0, return_type: type0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, return_type: type0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 12, @@ -22,21 +22,19 @@ // CHECK:STDOUT: nodeFloatingPointType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type0}, // CHECK:STDOUT: {kind: RealLiteral, arg0: real0, type: type1}, // CHECK:STDOUT: {kind: BinaryOperatorAdd, arg0: nodeInvalidType, arg1: node+2, type: typeInvalidType}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int1, type: type0}, // CHECK:STDOUT: {kind: BinaryOperatorAdd, arg0: node+3, arg1: node+4, type: typeInvalidType}, // CHECK:STDOUT: {kind: ReturnExpression, arg0: node+5, type: typeInvalidType}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+7, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/return/fail_type_mismatch.carbon b/toolchain/semantics/testdata/return/fail_type_mismatch.carbon index 000bfcdb9915..bcc74893131a 100644 --- a/toolchain/semantics/testdata/return/fail_type_mismatch.carbon +++ b/toolchain/semantics/testdata/return/fail_type_mismatch.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0, return_type: type0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, return_type: type0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -20,17 +20,15 @@ // CHECK:STDOUT: nodeFloatingPointType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: RealLiteral, arg0: real0, type: type1}, // CHECK:STDOUT: {kind: ReturnExpression, arg0: nodeInvalidType, type: typeInvalidType}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+3, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/return/fail_value_disallowed.carbon b/toolchain/semantics/testdata/return/fail_value_disallowed.carbon index 8fda32d1208a..41fe1437b5ea 100644 --- a/toolchain/semantics/testdata/return/fail_value_disallowed.carbon +++ b/toolchain/semantics/testdata/return/fail_value_disallowed.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 0, @@ -20,17 +20,15 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type1}, // CHECK:STDOUT: {kind: ReturnExpression, arg0: node+1, type: type1}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+3, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/return/fail_value_missing.carbon b/toolchain/semantics/testdata/return/fail_value_missing.carbon index 2321faa05bc6..a652039f0835 100644 --- a/toolchain/semantics/testdata/return/fail_value_missing.carbon +++ b/toolchain/semantics/testdata/return/fail_value_missing.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0, return_type: type0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, return_type: type0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -18,16 +18,14 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: Return}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+2, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/return/no_value.carbon b/toolchain/semantics/testdata/return/no_value.carbon index 339e1d83630c..e5e170534e8b 100644 --- a/toolchain/semantics/testdata/return/no_value.carbon +++ b/toolchain/semantics/testdata/return/no_value.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -18,16 +18,14 @@ // CHECK:STDOUT: nodeEmptyTupleType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: Return}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+2, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/return/struct.carbon b/toolchain/semantics/testdata/return/struct.carbon index 795e7006b466..d1f4ad85c93d 100644 --- a/toolchain/semantics/testdata/return/struct.carbon +++ b/toolchain/semantics/testdata/return/struct.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0, return_type: type1}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str1, param_refs: block0, return_type: type1, body: block3}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 3, @@ -23,13 +23,12 @@ // CHECK:STDOUT: nodes: [ // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: type0}, // CHECK:STDOUT: {kind: StructType, arg0: block2, type: typeTypeType}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type0}, // CHECK:STDOUT: {kind: StructTypeField, arg0: str0, type: type0}, // CHECK:STDOUT: {kind: StubReference, arg0: node+3, type: type0}, // CHECK:STDOUT: {kind: StructValue, arg0: block5, type: type1}, // CHECK:STDOUT: {kind: ReturnExpression, arg0: node+6, type: type1}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+2, arg1: block3}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -38,7 +37,6 @@ // CHECK:STDOUT: node+0, // CHECK:STDOUT: node+1, // CHECK:STDOUT: node+2, -// CHECK:STDOUT: node+8, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, diff --git a/toolchain/semantics/testdata/return/value.carbon b/toolchain/semantics/testdata/return/value.carbon index 750a45ec2766..0ff6a508e770 100644 --- a/toolchain/semantics/testdata/return/value.carbon +++ b/toolchain/semantics/testdata/return/value.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0, return_type: type0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, return_type: type0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 0, @@ -19,17 +19,15 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type0}, // CHECK:STDOUT: {kind: ReturnExpression, arg0: node+1, type: type0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+3, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/struct/empty.carbon b/toolchain/semantics/testdata/struct/empty.carbon index da7036b28a7d..b3344f6c420b 100644 --- a/toolchain/semantics/testdata/struct/empty.carbon +++ b/toolchain/semantics/testdata/struct/empty.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/struct/fail_assign_empty.carbon b/toolchain/semantics/testdata/struct/fail_assign_empty.carbon index 75cd0e9c4184..1fb2cc7fa947 100644 --- a/toolchain/semantics/testdata/struct/fail_assign_empty.carbon +++ b/toolchain/semantics/testdata/struct/fail_assign_empty.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/struct/fail_assign_to_empty.carbon b/toolchain/semantics/testdata/struct/fail_assign_to_empty.carbon index 7dbd9343e382..7d662d13d16e 100644 --- a/toolchain/semantics/testdata/struct/fail_assign_to_empty.carbon +++ b/toolchain/semantics/testdata/struct/fail_assign_to_empty.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, diff --git a/toolchain/semantics/testdata/struct/fail_field_name_mismatch.carbon b/toolchain/semantics/testdata/struct/fail_field_name_mismatch.carbon index 2b6e2d486340..059a88aa3bce 100644 --- a/toolchain/semantics/testdata/struct/fail_field_name_mismatch.carbon +++ b/toolchain/semantics/testdata/struct/fail_field_name_mismatch.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, diff --git a/toolchain/semantics/testdata/struct/fail_field_type_mismatch.carbon b/toolchain/semantics/testdata/struct/fail_field_type_mismatch.carbon index d8d929e6713d..ffdd68cf5c00 100644 --- a/toolchain/semantics/testdata/struct/fail_field_type_mismatch.carbon +++ b/toolchain/semantics/testdata/struct/fail_field_type_mismatch.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/struct/fail_member_access_type.carbon b/toolchain/semantics/testdata/struct/fail_member_access_type.carbon index 4b5366d6ec92..793c44dd3c45 100644 --- a/toolchain/semantics/testdata/struct/fail_member_access_type.carbon +++ b/toolchain/semantics/testdata/struct/fail_member_access_type.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/struct/fail_non_member_access.carbon b/toolchain/semantics/testdata/struct/fail_non_member_access.carbon index 22f0fa2fad46..cc9aa2465c82 100644 --- a/toolchain/semantics/testdata/struct/fail_non_member_access.carbon +++ b/toolchain/semantics/testdata/struct/fail_non_member_access.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 4, diff --git a/toolchain/semantics/testdata/struct/fail_too_few_values.carbon b/toolchain/semantics/testdata/struct/fail_too_few_values.carbon index f85b5370cd35..34453bf187d2 100644 --- a/toolchain/semantics/testdata/struct/fail_too_few_values.carbon +++ b/toolchain/semantics/testdata/struct/fail_too_few_values.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, diff --git a/toolchain/semantics/testdata/struct/fail_type_assign.carbon b/toolchain/semantics/testdata/struct/fail_type_assign.carbon index a5ef2c2974b5..25029a6d0332 100644 --- a/toolchain/semantics/testdata/struct/fail_type_assign.carbon +++ b/toolchain/semantics/testdata/struct/fail_type_assign.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/struct/fail_value_as_type.carbon b/toolchain/semantics/testdata/struct/fail_value_as_type.carbon index b9844881266b..25d60004b60c 100644 --- a/toolchain/semantics/testdata/struct/fail_value_as_type.carbon +++ b/toolchain/semantics/testdata/struct/fail_value_as_type.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, diff --git a/toolchain/semantics/testdata/struct/member_access.carbon b/toolchain/semantics/testdata/struct/member_access.carbon index 6c34b16c14a1..366e945f4e20 100644 --- a/toolchain/semantics/testdata/struct/member_access.carbon +++ b/toolchain/semantics/testdata/struct/member_access.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, diff --git a/toolchain/semantics/testdata/struct/one_entry.carbon b/toolchain/semantics/testdata/struct/one_entry.carbon index 3a21a6e270e0..fb7d42251346 100644 --- a/toolchain/semantics/testdata/struct/one_entry.carbon +++ b/toolchain/semantics/testdata/struct/one_entry.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 4, diff --git a/toolchain/semantics/testdata/struct/two_entries.carbon b/toolchain/semantics/testdata/struct/two_entries.carbon index 42098be6e5d1..dd723d1b1d6b 100644 --- a/toolchain/semantics/testdata/struct/two_entries.carbon +++ b/toolchain/semantics/testdata/struct/two_entries.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, diff --git a/toolchain/semantics/testdata/var/decl.carbon b/toolchain/semantics/testdata/var/decl.carbon index 26dd66b07362..0c53f2358ddf 100644 --- a/toolchain/semantics/testdata/var/decl.carbon +++ b/toolchain/semantics/testdata/var/decl.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -20,17 +20,15 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: VarStorage, type: type1}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+1, type: type1}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+3, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/var/decl_with_init.carbon b/toolchain/semantics/testdata/var/decl_with_init.carbon index 94d7ec297009..11ce995185dc 100644 --- a/toolchain/semantics/testdata/var/decl_with_init.carbon +++ b/toolchain/semantics/testdata/var/decl_with_init.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 0, @@ -21,19 +21,17 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: VarStorage, type: type1}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+1, type: type1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type1}, // CHECK:STDOUT: {kind: Assign, arg0: node+1, arg1: node+3, type: type1}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+5, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/var/fail_duplicate_decl.carbon b/toolchain/semantics/testdata/var/fail_duplicate_decl.carbon index d5607971e697..8bffb7594543 100644 --- a/toolchain/semantics/testdata/var/fail_duplicate_decl.carbon +++ b/toolchain/semantics/testdata/var/fail_duplicate_decl.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 0, @@ -22,7 +22,7 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: VarStorage, type: type1}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+1, type: type1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type1}, @@ -30,15 +30,13 @@ // CHECK:STDOUT: {kind: VarStorage, type: type1}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+5, type: type1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int1, type: type1}, -// CHECK:STDOUT: {kind: Assign, arg0: node+1, arg1: node+7, type: type1}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, +// CHECK:STDOUT: {kind: Assign, arg0: node+5, arg1: node+7, type: type1}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+9, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/var/fail_init_type_mismatch.carbon b/toolchain/semantics/testdata/var/fail_init_type_mismatch.carbon index 940fe8adb044..271d841c7cb0 100644 --- a/toolchain/semantics/testdata/var/fail_init_type_mismatch.carbon +++ b/toolchain/semantics/testdata/var/fail_init_type_mismatch.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -22,19 +22,17 @@ // CHECK:STDOUT: nodeFloatingPointType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: VarStorage, type: type1}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+1, type: type1}, // CHECK:STDOUT: {kind: RealLiteral, arg0: real0, type: type2}, // CHECK:STDOUT: {kind: Assign, arg0: node+1, arg1: nodeInvalidType, type: typeInvalidType}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+5, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/var/fail_init_with_self.carbon b/toolchain/semantics/testdata/var/fail_init_with_self.carbon index abff08a353e4..735ee05bfcb5 100644 --- a/toolchain/semantics/testdata/var/fail_init_with_self.carbon +++ b/toolchain/semantics/testdata/var/fail_init_with_self.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -20,18 +20,16 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: VarStorage, type: type1}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+1, type: type1}, // CHECK:STDOUT: {kind: Assign, arg0: node+1, arg1: nodeInvalidType, type: typeInvalidType}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+4, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/var/fail_lookup_outside_scope.carbon b/toolchain/semantics/testdata/var/fail_lookup_outside_scope.carbon index 588daa903357..5601a4c60677 100644 --- a/toolchain/semantics/testdata/var/fail_lookup_outside_scope.carbon +++ b/toolchain/semantics/testdata/var/fail_lookup_outside_scope.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] @@ -21,13 +21,12 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: VarStorage, type: type1}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+1, type: type1}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: {kind: VarStorage, type: type1}, -// CHECK:STDOUT: {kind: BindName, arg0: str2, arg1: node+4, type: type1}, -// CHECK:STDOUT: {kind: Assign, arg0: node+4, arg1: nodeInvalidType, type: typeInvalidType}, +// CHECK:STDOUT: {kind: BindName, arg0: str2, arg1: node+3, type: type1}, +// CHECK:STDOUT: {kind: Assign, arg0: node+3, arg1: nodeInvalidType, type: typeInvalidType}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -37,7 +36,6 @@ // CHECK:STDOUT: node+3, // CHECK:STDOUT: node+4, // CHECK:STDOUT: node+5, -// CHECK:STDOUT: node+6, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/var/fail_storage_is_literal.carbon b/toolchain/semantics/testdata/var/fail_storage_is_literal.carbon index 9df487cb3055..7e9abccc736b 100644 --- a/toolchain/semantics/testdata/var/fail_storage_is_literal.carbon +++ b/toolchain/semantics/testdata/var/fail_storage_is_literal.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 1, @@ -22,20 +22,18 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type1}, // CHECK:STDOUT: {kind: VarStorage, type: typeInvalidType}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+2, type: typeInvalidType}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int1, type: type1}, // CHECK:STDOUT: {kind: Assign, arg0: node+2, arg1: nodeInvalidType, type: typeInvalidType}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+6, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1, diff --git a/toolchain/semantics/testdata/var/global_decl.carbon b/toolchain/semantics/testdata/var/global_decl.carbon index c66198b4b4cc..77f19a1bad05 100644 --- a/toolchain/semantics/testdata/var/global_decl.carbon +++ b/toolchain/semantics/testdata/var/global_decl.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: ] diff --git a/toolchain/semantics/testdata/var/global_decl_with_init.carbon b/toolchain/semantics/testdata/var/global_decl_with_init.carbon index d08f2a3fad28..acb0081f4586 100644 --- a/toolchain/semantics/testdata/var/global_decl_with_init.carbon +++ b/toolchain/semantics/testdata/var/global_decl_with_init.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 0, diff --git a/toolchain/semantics/testdata/var/global_lookup.carbon b/toolchain/semantics/testdata/var/global_lookup.carbon index ca1ecc7d2a17..6cfbf6c88e9f 100644 --- a/toolchain/semantics/testdata/var/global_lookup.carbon +++ b/toolchain/semantics/testdata/var/global_lookup.carbon @@ -4,7 +4,7 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ +// CHECK:STDOUT: functions: [ // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 0, diff --git a/toolchain/semantics/testdata/var/global_lookup_in_scope.carbon b/toolchain/semantics/testdata/var/global_lookup_in_scope.carbon index acac0e63e26a..85fb16803896 100644 --- a/toolchain/semantics/testdata/var/global_lookup_in_scope.carbon +++ b/toolchain/semantics/testdata/var/global_lookup_in_scope.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str1, param_refs: block0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 0, @@ -26,11 +26,10 @@ // CHECK:STDOUT: {kind: BindName, arg0: str0, arg1: node+0, type: type0}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type0}, // CHECK:STDOUT: {kind: Assign, arg0: node+0, arg1: node+2, type: type0}, -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str1, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: VarStorage, type: type0}, // CHECK:STDOUT: {kind: BindName, arg0: str2, arg1: node+5, type: type0}, // CHECK:STDOUT: {kind: Assign, arg0: node+5, arg1: node+0, type: type0}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+4, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ @@ -41,7 +40,6 @@ // CHECK:STDOUT: node+2, // CHECK:STDOUT: node+3, // CHECK:STDOUT: node+4, -// CHECK:STDOUT: node+8, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+5, diff --git a/toolchain/semantics/testdata/var/lookup.carbon b/toolchain/semantics/testdata/var/lookup.carbon index 58d197c74aae..f629107e8b3a 100644 --- a/toolchain/semantics/testdata/var/lookup.carbon +++ b/toolchain/semantics/testdata/var/lookup.carbon @@ -4,8 +4,8 @@ // // AUTOUPDATE // CHECK:STDOUT: cross_reference_irs_size: 1 -// CHECK:STDOUT: callables: [ -// CHECK:STDOUT: {param_refs: block0}, +// CHECK:STDOUT: functions: [ +// CHECK:STDOUT: {name: str0, param_refs: block0, body: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: integer_literals: [ // CHECK:STDOUT: 0, @@ -21,19 +21,17 @@ // CHECK:STDOUT: nodeIntegerType, // CHECK:STDOUT: ] // CHECK:STDOUT: nodes: [ -// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: str0, arg1: callable0}, +// CHECK:STDOUT: {kind: FunctionDeclaration, arg0: function0}, // CHECK:STDOUT: {kind: VarStorage, type: type1}, // CHECK:STDOUT: {kind: BindName, arg0: str1, arg1: node+1, type: type1}, // CHECK:STDOUT: {kind: IntegerLiteral, arg0: int0, type: type1}, // CHECK:STDOUT: {kind: Assign, arg0: node+1, arg1: node+3, type: type1}, -// CHECK:STDOUT: {kind: FunctionDefinition, arg0: node+0, arg1: block2}, // CHECK:STDOUT: ] // CHECK:STDOUT: node_blocks: [ // CHECK:STDOUT: [ // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+0, -// CHECK:STDOUT: node+5, // CHECK:STDOUT: ], // CHECK:STDOUT: [ // CHECK:STDOUT: node+1,