From 5f4e6c768a0154c5899f39a789910eb4f0f00b08 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 28 Feb 2024 13:28:59 -0800 Subject: [PATCH] Format the decl block for a declaration as a trailing block. (#3731) Previously we used the default inst block formatting, which writes out a parenthesized list of references, which would always be 'unexpected instref's because nothing else prints the instructions in the decl block. In addition, track the decl block for function declarations like we do for other kinds of declaration. This means that the parameter declarations for a function are now properly rendered into the formatted IR. Note that this adds a lot of verbosity to `function_decl`, but it does accurately reflect the IR, and we'll probably want this information to be printed once we start supporting more complex generic function declarations. This removes almost all the 'unexpected instref's in our formatted output. There are remaining cases when a declarative scope contains multiple blocks, where we only track one of those blocks. That happens when there is control flow within declarative scopes, and for error recovery when a class or interface or similar is defined more than once. As requested in #3730. --- toolchain/check/handle_function.cpp | 11 +- toolchain/check/import_ref.cpp | 6 +- .../alias/fail_local_in_namespace.carbon | 4 +- .../testdata/alias/fail_not_constant.carbon | 2 +- .../check/testdata/alias/in_namespace.carbon | 10 +- toolchain/check/testdata/alias/local.carbon | 4 +- .../testdata/array/array_in_place.carbon | 8 +- .../testdata/array/array_vs_tuple.carbon | 2 +- .../testdata/array/assign_return_value.carbon | 8 +- .../array/fail_incomplete_element.carbon | 2 +- .../testdata/array/function_param.carbon | 14 +- toolchain/check/testdata/as/basic.carbon | 4 +- toolchain/check/testdata/as/identity.carbon | 22 ++- toolchain/check/testdata/as/tuple.carbon | 11 +- .../check/testdata/basics/fail_bad_run.carbon | 4 +- .../testdata/basics/fail_bad_run_2.carbon | 5 +- .../testdata/basics/fail_name_lookup.carbon | 2 +- .../check/testdata/basics/multifile.carbon | 4 +- .../multifile_raw_and_textual_ir.carbon | 8 +- .../testdata/basics/multifile_raw_ir.carbon | 4 +- .../testdata/basics/numeric_literals.carbon | 2 +- .../testdata/basics/raw_and_textual_ir.carbon | 10 +- .../testdata/basics/raw_identifier.carbon | 18 ++- toolchain/check/testdata/basics/raw_ir.carbon | 2 +- toolchain/check/testdata/basics/run.carbon | 2 +- .../check/testdata/basics/run_i32.carbon | 4 +- .../check/testdata/basics/textual_ir.carbon | 8 +- toolchain/check/testdata/class/base.carbon | 18 ++- .../check/testdata/class/base_field.carbon | 13 +- .../class/base_function_unqualified.carbon | 12 +- .../check/testdata/class/base_method.carbon | 27 +++- .../testdata/class/base_method_shadow.carbon | 57 ++++++-- toolchain/check/testdata/class/basic.carbon | 28 +++- .../testdata/class/derived_to_base.carbon | 54 +++++-- .../check/testdata/class/fail_abstract.carbon | 18 ++- .../testdata/class/fail_addr_not_self.carbon | 20 ++- .../testdata/class/fail_addr_self.carbon | 31 +++- .../testdata/class/fail_base_bad_type.carbon | 135 +++++++++++++++--- .../class/fail_base_method_define.carbon | 14 +- .../testdata/class/fail_base_modifiers.carbon | 10 +- .../testdata/class/fail_base_no_extend.carbon | 4 +- .../testdata/class/fail_base_repeated.carbon | 8 +- .../testdata/class/fail_base_unbound.carbon | 4 +- .../class/fail_convert_to_invalid.carbon | 7 +- .../class/fail_derived_to_base.carbon | 28 +++- .../class/fail_field_modifiers.carbon | 2 +- .../testdata/class/fail_import_misuses.carbon | 10 +- .../testdata/class/fail_incomplete.carbon | 57 ++++++-- .../check/testdata/class/fail_init.carbon | 4 +- .../class/fail_init_as_inplace.carbon | 11 +- .../class/fail_memaccess_category.carbon | 24 +++- .../testdata/class/fail_member_of_let.carbon | 8 +- .../check/testdata/class/fail_method.carbon | 20 ++- .../class/fail_method_modifiers.carbon | 46 ++++-- .../testdata/class/fail_modifiers.carbon | 12 +- .../class/fail_out_of_line_decl.carbon | 4 +- .../fail_redeclaration_introducer.carbon | 30 ++-- .../class/fail_redeclaration_scope.carbon | 18 +-- .../testdata/class/fail_redefinition.carbon | 14 +- .../check/testdata/class/fail_reorder.carbon | 10 +- .../check/testdata/class/fail_scope.carbon | 10 +- .../check/testdata/class/fail_self.carbon | 40 ++++-- .../testdata/class/fail_todo_generic.carbon | 2 +- .../class/fail_todo_generic_method.carbon | 23 ++- .../fail_todo_import_forward_decl.carbon | 6 +- .../testdata/class/fail_todo_modifiers.carbon | 20 +-- .../testdata/class/fail_unbound_field.carbon | 10 +- .../testdata/class/fail_unknown_member.carbon | 9 +- .../check/testdata/class/field_access.carbon | 4 +- .../class/field_access_in_value.carbon | 4 +- .../testdata/class/forward_declared.carbon | 12 +- toolchain/check/testdata/class/import.carbon | 38 +++-- .../check/testdata/class/import_base.carbon | 26 ++-- .../testdata/class/import_member_cycle.carbon | 6 +- .../testdata/class/import_struct_cyle.carbon | 8 +- toolchain/check/testdata/class/init.carbon | 24 +++- toolchain/check/testdata/class/init_as.carbon | 6 +- .../check/testdata/class/init_nested.carbon | 14 +- toolchain/check/testdata/class/method.carbon | 78 ++++++++-- toolchain/check/testdata/class/nested.carbon | 11 +- .../check/testdata/class/nested_name.carbon | 18 ++- .../check/testdata/class/raw_self.carbon | 44 +++++- .../check/testdata/class/raw_self_type.carbon | 4 +- .../check/testdata/class/redeclaration.carbon | 8 +- .../class/redeclaration_introducer.carbon | 12 +- .../check/testdata/class/reenter_scope.carbon | 14 +- toolchain/check/testdata/class/scope.carbon | 16 ++- toolchain/check/testdata/class/self.carbon | 34 ++++- .../testdata/class/self_conversion.carbon | 44 ++++-- .../check/testdata/class/self_type.carbon | 18 ++- .../check/testdata/class/static_method.carbon | 10 +- toolchain/check/testdata/const/basic.carbon | 22 ++- .../check/testdata/const/collapse.carbon | 13 +- .../check/testdata/const/fail_collapse.carbon | 12 +- toolchain/check/testdata/const/import.carbon | 5 +- .../check/testdata/eval/fail_symbolic.carbon | 5 +- toolchain/check/testdata/eval/symbolic.carbon | 5 +- .../expr_category/in_place_tuple_init.carbon | 16 ++- .../check/testdata/function/call/alias.carbon | 6 +- .../function/call/empty_struct.carbon | 12 +- .../testdata/function/call/empty_tuple.carbon | 12 +- .../function/call/fail_not_callable.carbon | 2 +- .../function/call/fail_param_count.carbon | 16 ++- .../function/call/fail_param_type.carbon | 7 +- .../call/fail_return_type_mismatch.carbon | 6 +- .../check/testdata/function/call/i32.carbon | 8 +- .../function/call/more_param_ir.carbon | 9 +- .../testdata/function/call/params_one.carbon | 7 +- .../function/call/params_one_comma.carbon | 7 +- .../testdata/function/call/params_two.carbon | 9 +- .../function/call/params_two_comma.carbon | 9 +- .../testdata/function/call/params_zero.carbon | 4 +- .../function/call/return_implicit.carbon | 4 +- .../declaration/fail_modifiers.carbon | 12 +- .../declaration/fail_param_in_type.carbon | 9 +- .../declaration/fail_param_redecl.carbon | 7 +- .../declaration/fail_todo_modifiers.carbon | 2 +- .../function/declaration/import.carbon | 17 ++- .../declaration/param_same_name.carbon | 10 +- .../function/declaration/simple.carbon | 4 +- .../fail_todo_import_forward_decl.carbon | 4 +- .../function/definition/forward_decl.carbon | 4 +- .../function/definition/import.carbon | 17 ++- .../testdata/function/definition/order.carbon | 6 +- .../function/definition/params_one.carbon | 5 +- .../definition/params_one_comma.carbon | 5 +- .../function/definition/params_two.carbon | 7 +- .../definition/params_two_comma.carbon | 7 +- .../function/definition/params_zero.carbon | 2 +- .../generic/fail_todo_param_in_type.carbon | 10 +- .../generic/fail_type_param_mismatch.carbon | 7 +- .../function/generic/type_param.carbon | 5 +- .../function/generic/type_param_scope.carbon | 10 +- .../check/testdata/global/class_obj.carbon | 2 +- .../testdata/global/class_with_fun.carbon | 9 +- .../testdata/global/simple_with_fun.carbon | 4 +- toolchain/check/testdata/if/else.carbon | 11 +- .../if/fail_reachable_fallthrough.carbon | 18 ++- toolchain/check/testdata/if/fail_scope.carbon | 6 +- toolchain/check/testdata/if/no_else.carbon | 9 +- .../if/unreachable_fallthrough.carbon | 6 +- toolchain/check/testdata/if_expr/basic.carbon | 10 +- .../if_expr/constant_condition.carbon | 16 ++- .../testdata/if_expr/control_flow.carbon | 14 +- .../if_expr/fail_not_in_function.carbon | 2 +- .../check/testdata/if_expr/nested.carbon | 10 +- .../check/testdata/if_expr/struct.carbon | 11 +- toolchain/check/testdata/impl/basic.carbon | 10 +- .../check/testdata/impl/declaration.carbon | 6 +- toolchain/check/testdata/impl/empty.carbon | 6 +- .../impl/fail_extend_impl_forall.carbon | 30 +++- .../impl/fail_extend_impl_scope.carbon | 6 +- .../impl/fail_extend_impl_type_as.carbon | 22 ++- .../impl/fail_extend_non_interface.carbon | 4 +- ..._extend_partially_defined_interface.carbon | 8 +- .../fail_extend_undefined_interface.carbon | 8 +- .../testdata/impl/fail_impl_as_scope.carbon | 10 +- .../impl/fail_impl_bad_interface.carbon | 4 +- .../testdata/impl/fail_impl_bad_type.carbon | 7 +- .../testdata/impl/fail_redefinition.carbon | 10 +- .../impl/fail_todo_extend_impl.carbon | 18 ++- toolchain/check/testdata/impl/impl_as.carbon | 12 +- .../check/testdata/impl/impl_forall.carbon | 13 +- .../check/testdata/impl/redeclaration.carbon | 16 ++- .../check/testdata/index/expr_category.carbon | 20 ++- .../index/fail_empty_tuple_access.carbon | 4 +- .../testdata/index/fail_expr_category.carbon | 13 +- .../testdata/index/fail_invalid_base.carbon | 2 +- .../testdata/index/fail_name_not_found.carbon | 2 +- .../index/fail_non_tuple_access.carbon | 2 +- .../index/tuple_return_value_access.carbon | 10 +- .../check/testdata/interface/as_type.carbon | 8 +- .../check/testdata/interface/basic.carbon | 8 +- .../fail_add_member_outside_definition.carbon | 12 +- .../interface/fail_as_type_of_type.carbon | 8 +- .../testdata/interface/fail_duplicate.carbon | 14 +- .../interface/fail_lookup_undefined.carbon | 16 ++- .../interface/fail_member_lookup.carbon | 6 +- .../testdata/interface/fail_modifiers.carbon | 8 +- .../interface/fail_redeclare_member.carbon | 6 +- .../fail_todo_define_out_of_line.carbon | 6 +- .../interface/fail_todo_facet_lookup.carbon | 10 +- .../interface/fail_todo_generic.carbon | 2 +- .../interface/fail_todo_modifiers.carbon | 8 +- .../check/testdata/interface/import.carbon | 28 ++-- .../ir/duplicate_name_same_line.carbon | 2 +- toolchain/check/testdata/let/convert.carbon | 4 +- .../testdata/let/fail_duplicate_decl.carbon | 2 +- .../check/testdata/let/fail_generic.carbon | 6 +- .../testdata/let/fail_use_in_init.carbon | 2 +- toolchain/check/testdata/let/generic.carbon | 2 +- toolchain/check/testdata/let/global.carbon | 4 +- toolchain/check/testdata/let/local.carbon | 6 +- .../check/testdata/let/shadowed_decl.carbon | 6 +- .../testdata/namespace/add_to_import.carbon | 4 +- .../check/testdata/namespace/alias.carbon | 12 +- .../fail_conflict_after_merge.carbon | 4 +- ...l_conflict_imported_namespace_first.carbon | 4 +- ..._conflict_imported_namespace_second.carbon | 4 +- ...conflict_in_imports_namespace_first.carbon | 6 +- ...onflict_in_imports_namespace_second.carbon | 6 +- .../namespace/fail_decl_in_alias.carbon | 4 +- .../testdata/namespace/fail_duplicate.carbon | 4 +- .../namespace/fail_unresolved_scope.carbon | 2 +- .../check/testdata/namespace/function.carbon | 6 +- .../check/testdata/namespace/imported.carbon | 4 +- .../namespace/imported_indirect.carbon | 2 +- .../check/testdata/namespace/merging.carbon | 10 +- .../check/testdata/namespace/nested.carbon | 4 +- .../check/testdata/namespace/shadow.carbon | 8 +- .../namespace/unqualified_lookup.carbon | 12 +- toolchain/check/testdata/operators/and.carbon | 12 +- .../testdata/operators/assignment.carbon | 2 +- .../operators/fail_assignment_to_error.carbon | 2 +- .../fail_assignment_to_non_assignable.carbon | 6 +- .../operators/fail_type_mismatch.carbon | 2 +- .../fail_type_mismatch_assignment.carbon | 2 +- toolchain/check/testdata/operators/or.carbon | 12 +- .../check/testdata/operators/unary_op.carbon | 6 +- .../package_expr/fail_not_found.carbon | 2 +- .../check/testdata/package_expr/syntax.carbon | 10 +- .../fail_conflict_no_namespaces.carbon | 2 +- .../testdata/packages/loaded_global.carbon | 4 +- .../packages/unused_lazy_import.carbon | 2 +- .../testdata/pointer/address_of_deref.carbon | 4 +- .../testdata/pointer/address_of_lvalue.carbon | 2 +- toolchain/check/testdata/pointer/basic.carbon | 4 +- .../pointer/fail_address_of_error.carbon | 2 +- .../pointer/fail_address_of_value.carbon | 24 ++-- .../pointer/fail_deref_function.carbon | 2 +- .../pointer/fail_deref_namespace.carbon | 2 +- .../pointer/fail_deref_not_pointer.carbon | 5 +- .../pointer/fail_type_mismatch.carbon | 14 +- .../testdata/pointer/nested_const.carbon | 12 +- toolchain/check/testdata/pointer/types.carbon | 18 ++- .../testdata/return/code_after_return.carbon | 2 +- .../return/code_after_return_value.carbon | 6 +- .../testdata/return/fail_call_in_type.carbon | 12 +- .../testdata/return/fail_error_in_type.carbon | 5 +- .../return/fail_missing_return.carbon | 4 +- .../fail_missing_return_empty_tuple.carbon | 6 +- .../fail_return_var_no_returned_var.carbon | 4 +- .../fail_return_with_returned_var.carbon | 11 +- .../fail_returned_var_no_return_type.carbon | 2 +- .../return/fail_returned_var_shadow.carbon | 8 +- .../return/fail_returned_var_type.carbon | 4 +- .../testdata/return/fail_type_mismatch.carbon | 4 +- .../return/fail_value_disallowed.carbon | 2 +- .../testdata/return/fail_value_missing.carbon | 4 +- .../testdata/return/fail_var_in_type.carbon | 6 +- .../missing_return_no_return_type.carbon | 2 +- .../check/testdata/return/no_value.carbon | 2 +- .../check/testdata/return/returned_var.carbon | 11 +- .../testdata/return/returned_var_scope.carbon | 10 +- toolchain/check/testdata/return/struct.carbon | 5 +- toolchain/check/testdata/return/tuple.carbon | 6 +- toolchain/check/testdata/return/value.carbon | 4 +- .../struct/fail_access_into_invalid.carbon | 2 +- .../struct/fail_duplicate_name.carbon | 4 +- .../struct/fail_member_of_function.carbon | 2 +- .../struct/fail_nested_incomplete.carbon | 2 +- .../struct/literal_member_access.carbon | 9 +- .../struct/nested_struct_in_place.carbon | 8 +- .../testdata/struct/reorder_fields.carbon | 13 +- .../tuples/fail_nested_incomplete.carbon | 2 +- .../tuples/nested_tuple_in_place.carbon | 10 +- toolchain/check/testdata/var/decl.carbon | 2 +- .../check/testdata/var/decl_with_init.carbon | 2 +- .../testdata/var/fail_duplicate_decl.carbon | 2 +- .../check/testdata/var/fail_generic.carbon | 2 +- .../var/fail_init_type_mismatch.carbon | 2 +- .../testdata/var/fail_init_with_self.carbon | 2 +- .../var/fail_lookup_outside_scope.carbon | 2 +- .../testdata/var/fail_not_copyable.carbon | 8 +- .../var/fail_storage_is_literal.carbon | 2 +- .../var/global_lookup_in_scope.carbon | 2 +- toolchain/check/testdata/var/lookup.carbon | 2 +- toolchain/check/testdata/var/shadowing.carbon | 2 +- .../testdata/while/break_continue.carbon | 34 +++-- .../testdata/while/fail_bad_condition.carbon | 2 +- .../testdata/while/fail_break_continue.carbon | 2 +- .../testdata/while/unreachable_end.carbon | 12 +- toolchain/check/testdata/while/while.carbon | 12 +- toolchain/sem_ir/formatter.cpp | 61 ++++++-- toolchain/sem_ir/typed_insts.h | 3 + 285 files changed, 2152 insertions(+), 828 deletions(-) diff --git a/toolchain/check/handle_function.cpp b/toolchain/check/handle_function.cpp index ce399b5e4c9e..caaab6719577 100644 --- a/toolchain/check/handle_function.cpp +++ b/toolchain/check/handle_function.cpp @@ -60,14 +60,7 @@ static auto BuildFunctionDecl(Context& context, Parse::AnyFunctionDeclId parse_node, bool is_definition) -> std::pair { - // TODO: This contains the IR block for the parameters and return type. At - // present, it's just loose, but it's not strictly required for parameter - // refs; we should either stop constructing it completely or, if it turns out - // to be needed, store it. Note, the underlying issue is that the LLVM IR has - // nowhere clear to emit, so changing storage would require addressing that - // problem. For comparison with function calls, the IR needs to be emitted - // prior to the call. - context.inst_block_stack().Pop(); + auto decl_block_id = context.inst_block_stack().Pop(); auto return_type_id = SemIR::TypeId::Invalid; auto return_slot_id = SemIR::InstId::Invalid; @@ -123,7 +116,7 @@ static auto BuildFunctionDecl(Context& context, // Add the function declaration. auto function_decl = SemIR::FunctionDecl{ context.GetBuiltinType(SemIR::BuiltinKind::FunctionType), - SemIR::FunctionId::Invalid}; + SemIR::FunctionId::Invalid, decl_block_id}; auto function_decl_id = context.AddPlaceholderInst({parse_node, function_decl}); diff --git a/toolchain/check/import_ref.cpp b/toolchain/check/import_ref.cpp index 75b1f9916e08..c03a38f53d97 100644 --- a/toolchain/check/import_ref.cpp +++ b/toolchain/check/import_ref.cpp @@ -550,9 +550,9 @@ class ImportRefResolver { } // Add the function declaration. - auto function_decl = - SemIR::FunctionDecl{context_.GetTypeIdForTypeConstant(type_const_id), - SemIR::FunctionId::Invalid}; + auto function_decl = SemIR::FunctionDecl{ + context_.GetTypeIdForTypeConstant(type_const_id), + SemIR::FunctionId::Invalid, SemIR::InstBlockId::Empty}; auto function_decl_id = context_.AddPlaceholderInstInNoBlock( {Parse::NodeId::Invalid, function_decl}); diff --git a/toolchain/check/testdata/alias/fail_local_in_namespace.carbon b/toolchain/check/testdata/alias/fail_local_in_namespace.carbon index 3a5758014ab0..de6ad969775a 100644 --- a/toolchain/check/testdata/alias/fail_local_in_namespace.carbon +++ b/toolchain/check/testdata/alias/fail_local_in_namespace.carbon @@ -29,7 +29,9 @@ fn F() -> bool { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.NS = %.loc7, .F = %F} [template] // CHECK:STDOUT: %.loc7: = namespace {} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref bool = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { diff --git a/toolchain/check/testdata/alias/fail_not_constant.carbon b/toolchain/check/testdata/alias/fail_not_constant.carbon index f7ac37b191ab..7bd83700ff2d 100644 --- a/toolchain/check/testdata/alias/fail_not_constant.carbon +++ b/toolchain/check/testdata/alias/fail_not_constant.carbon @@ -22,7 +22,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/alias/in_namespace.carbon b/toolchain/check/testdata/alias/in_namespace.carbon index 8295b1ddffd5..e215f99c25cc 100644 --- a/toolchain/check/testdata/alias/in_namespace.carbon +++ b/toolchain/check/testdata/alias/in_namespace.carbon @@ -23,11 +23,15 @@ fn F() -> NS.a { // CHECK:STDOUT: package: = namespace {.NS = %.loc7, .F = %F} [template] // CHECK:STDOUT: %.loc7: = namespace {.a = %a} [template] // CHECK:STDOUT: %a: type = bind_alias a, bool [template = bool] -// CHECK:STDOUT: %NS.ref: = name_ref NS, %.loc7 [template = %.loc7] -// CHECK:STDOUT: %a.ref: type = name_ref a, %a [template = bool] +// CHECK:STDOUT: %NS.ref.loc10: = name_ref NS, %.loc7 [template = %.loc7] +// CHECK:STDOUT: %a.ref.loc10: type = name_ref a, %a [template = bool] // CHECK:STDOUT: %.loc10: bool = bool_literal false [template = constants.%.1] // CHECK:STDOUT: %b: bool = bind_name b, %.loc10 -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %NS.ref.loc12: = name_ref NS, %.loc7 [template = %.loc7] +// CHECK:STDOUT: %a.ref.loc12: type = name_ref a, %a [template = bool] +// CHECK:STDOUT: %return.var: ref bool = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { diff --git a/toolchain/check/testdata/alias/local.carbon b/toolchain/check/testdata/alias/local.carbon index 2b42e4125608..76acf233dca5 100644 --- a/toolchain/check/testdata/alias/local.carbon +++ b/toolchain/check/testdata/alias/local.carbon @@ -18,7 +18,9 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { diff --git a/toolchain/check/testdata/array/array_in_place.carbon b/toolchain/check/testdata/array/array_in_place.carbon index 8dea8d373641..cd3ecf6c71c8 100644 --- a/toolchain/check/testdata/array/array_in_place.carbon +++ b/toolchain/check/testdata/array/array_in_place.carbon @@ -26,8 +26,12 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc7_25.1: (type, type, type) = tuple_literal (i32, i32, i32) +// CHECK:STDOUT: %.loc7_25.2: type = converted %.loc7_25.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: @F.%return: ref (i32, i32, i32) = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: (i32, i32, i32); diff --git a/toolchain/check/testdata/array/array_vs_tuple.carbon b/toolchain/check/testdata/array/array_vs_tuple.carbon index cabcb728391f..b8d7301bc5b0 100644 --- a/toolchain/check/testdata/array/array_vs_tuple.carbon +++ b/toolchain/check/testdata/array/array_vs_tuple.carbon @@ -30,7 +30,7 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.G = %G} [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { diff --git a/toolchain/check/testdata/array/assign_return_value.carbon b/toolchain/check/testdata/array/assign_return_value.carbon index ef7c7586b92b..ed8136237bc7 100644 --- a/toolchain/check/testdata/array/assign_return_value.carbon +++ b/toolchain/check/testdata/array/assign_return_value.carbon @@ -25,8 +25,12 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .Run = %Run} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc7_16.1: (type,) = tuple_literal (i32) +// CHECK:STDOUT: %.loc7_16.2: type = converted %.loc7_16.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %return.var: ref (i32,) = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Run: = fn_decl @Run {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> (i32,) { diff --git a/toolchain/check/testdata/array/fail_incomplete_element.carbon b/toolchain/check/testdata/array/fail_incomplete_element.carbon index 7cb254e4d41c..c509f4d5d86a 100644 --- a/toolchain/check/testdata/array/fail_incomplete_element.carbon +++ b/toolchain/check/testdata/array/fail_incomplete_element.carbon @@ -28,7 +28,7 @@ var p: Incomplete* = &a[0]; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Incomplete = %Incomplete.decl, .a = %a, .p = %p} [template] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete {} [template = constants.%Incomplete] // CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] // CHECK:STDOUT: %.loc15_21: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc15_22: type = array_type %.loc15_21, Incomplete [template = constants.%.2] diff --git a/toolchain/check/testdata/array/function_param.carbon b/toolchain/check/testdata/array/function_param.carbon index 031511316d51..531ae493cc2a 100644 --- a/toolchain/check/testdata/array/function_param.carbon +++ b/toolchain/check/testdata/array/function_param.carbon @@ -29,8 +29,18 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc7_17: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_18: type = array_type %.loc7_17, i32 [template = constants.%.2] +// CHECK:STDOUT: %arr.loc7_6.1: [i32; 3] = param arr +// CHECK:STDOUT: @F.%arr: [i32; 3] = bind_name arr, %arr.loc7_6.1 +// CHECK:STDOUT: %i.loc7_21.1: i32 = param i +// CHECK:STDOUT: @F.%i: i32 = bind_name i, %i.loc7_21.1 +// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %return.var.loc11: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%arr: [i32; 3], %i: i32) -> i32 { diff --git a/toolchain/check/testdata/as/basic.carbon b/toolchain/check/testdata/as/basic.carbon index 2c509a14652d..b2fef450d3ab 100644 --- a/toolchain/check/testdata/as/basic.carbon +++ b/toolchain/check/testdata/as/basic.carbon @@ -16,7 +16,9 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { diff --git a/toolchain/check/testdata/as/identity.carbon b/toolchain/check/testdata/as/identity.carbon index 7d645b8e9089..364fa8f66f92 100644 --- a/toolchain/check/testdata/as/identity.carbon +++ b/toolchain/check/testdata/as/identity.carbon @@ -36,11 +36,23 @@ fn Initializing() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.X = %X.decl, .Value = %Value, .Reference = %Reference, .Make = %Make, .Initializing = %Initializing} [template] -// CHECK:STDOUT: %X.decl = class_decl @X, () [template = constants.%X] -// CHECK:STDOUT: %Value: = fn_decl @Value [template] -// CHECK:STDOUT: %Reference: = fn_decl @Reference [template] -// CHECK:STDOUT: %Make: = fn_decl @Make [template] -// CHECK:STDOUT: %Initializing: = fn_decl @Initializing [template] +// CHECK:STDOUT: %X.decl = class_decl @X {} [template = constants.%X] +// CHECK:STDOUT: %Value: = fn_decl @Value { +// CHECK:STDOUT: %X.ref.loc13: type = name_ref X, %X.decl [template = constants.%X] +// CHECK:STDOUT: %n.loc13_10.1: X = param n +// CHECK:STDOUT: @Value.%n: X = bind_name n, %n.loc13_10.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Reference: = fn_decl @Reference { +// CHECK:STDOUT: %X.ref.loc17: type = name_ref X, %X.decl [template = constants.%X] +// CHECK:STDOUT: %.loc17: type = ptr_type X [template = constants.%.4] +// CHECK:STDOUT: %p.loc17_14.1: X* = param p +// CHECK:STDOUT: @Reference.%p: X* = bind_name p, %p.loc17_14.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Make: = fn_decl @Make { +// CHECK:STDOUT: %X.ref.loc21: type = name_ref X, %X.decl [template = constants.%X] +// CHECK:STDOUT: @Make.%return: ref X = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Initializing: = fn_decl @Initializing {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @X { diff --git a/toolchain/check/testdata/as/tuple.carbon b/toolchain/check/testdata/as/tuple.carbon index c7d5d1ac59ee..bd52a682a640 100644 --- a/toolchain/check/testdata/as/tuple.carbon +++ b/toolchain/check/testdata/as/tuple.carbon @@ -35,10 +35,13 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.X = %X.decl, .Make = %Make, .Let = %Let, .Var = %Var} [template] -// CHECK:STDOUT: %X.decl = class_decl @X, () [template = constants.%X] -// CHECK:STDOUT: %Make: = fn_decl @Make [template] -// CHECK:STDOUT: %Let: = fn_decl @Let [template] -// CHECK:STDOUT: %Var: = fn_decl @Var [template] +// CHECK:STDOUT: %X.decl = class_decl @X {} [template = constants.%X] +// CHECK:STDOUT: %Make: = fn_decl @Make { +// CHECK:STDOUT: %X.ref: type = name_ref X, %X.decl [template = constants.%X] +// CHECK:STDOUT: @Make.%return: ref X = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Let: = fn_decl @Let {} [template] +// CHECK:STDOUT: %Var: = fn_decl @Var {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @X { diff --git a/toolchain/check/testdata/basics/fail_bad_run.carbon b/toolchain/check/testdata/basics/fail_bad_run.carbon index 441aa607f359..ff1dad2825ec 100644 --- a/toolchain/check/testdata/basics/fail_bad_run.carbon +++ b/toolchain/check/testdata/basics/fail_bad_run.carbon @@ -21,7 +21,9 @@ fn Run() -> String {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Run = %Run} [template] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Run: = fn_decl @Run { +// CHECK:STDOUT: @Run.%return: ref String = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> %return: String { diff --git a/toolchain/check/testdata/basics/fail_bad_run_2.carbon b/toolchain/check/testdata/basics/fail_bad_run_2.carbon index 013d0260fa8e..6ad3e93268f2 100644 --- a/toolchain/check/testdata/basics/fail_bad_run_2.carbon +++ b/toolchain/check/testdata/basics/fail_bad_run_2.carbon @@ -13,7 +13,10 @@ fn Run(n: i32) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Run = %Run} [template] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Run: = fn_decl @Run { +// CHECK:STDOUT: %n.loc10_8.1: i32 = param n +// CHECK:STDOUT: @Run.%n: i32 = bind_name n, %n.loc10_8.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run(%n: i32) { diff --git a/toolchain/check/testdata/basics/fail_name_lookup.carbon b/toolchain/check/testdata/basics/fail_name_lookup.carbon index 2fd2d0701051..18473fb478d6 100644 --- a/toolchain/check/testdata/basics/fail_name_lookup.carbon +++ b/toolchain/check/testdata/basics/fail_name_lookup.carbon @@ -15,7 +15,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/basics/multifile.carbon b/toolchain/check/testdata/basics/multifile.carbon index 9f2a26426879..d7fbc4420328 100644 --- a/toolchain/check/testdata/basics/multifile.carbon +++ b/toolchain/check/testdata/basics/multifile.carbon @@ -18,7 +18,7 @@ fn B() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] +// CHECK:STDOUT: %A: = fn_decl @A {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -30,7 +30,7 @@ fn B() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B = %B} [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] +// CHECK:STDOUT: %B: = fn_decl @B {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() { diff --git a/toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon b/toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon index 113290d0371f..53b89b994bc2 100644 --- a/toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon +++ b/toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon @@ -34,7 +34,7 @@ fn B() {} // CHECK:STDOUT: type_blocks: {} // CHECK:STDOUT: insts: // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: name_scope0, arg1: inst, type: type0} -// CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, type: type1} +// CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1} // CHECK:STDOUT: inst+2: {kind: Return} // CHECK:STDOUT: constant_values: // CHECK:STDOUT: inst+0: template inst+0 @@ -55,7 +55,7 @@ fn B() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] +// CHECK:STDOUT: %A: = fn_decl @A {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -79,7 +79,7 @@ fn B() {} // CHECK:STDOUT: type_blocks: {} // CHECK:STDOUT: insts: // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: name_scope0, arg1: inst, type: type0} -// CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, type: type1} +// CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1} // CHECK:STDOUT: inst+2: {kind: Return} // CHECK:STDOUT: constant_values: // CHECK:STDOUT: inst+0: template inst+0 @@ -100,7 +100,7 @@ fn B() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B = %B} [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] +// CHECK:STDOUT: %B: = fn_decl @B {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() { diff --git a/toolchain/check/testdata/basics/multifile_raw_ir.carbon b/toolchain/check/testdata/basics/multifile_raw_ir.carbon index 9d556815c650..29959758582a 100644 --- a/toolchain/check/testdata/basics/multifile_raw_ir.carbon +++ b/toolchain/check/testdata/basics/multifile_raw_ir.carbon @@ -34,7 +34,7 @@ fn B() {} // CHECK:STDOUT: type_blocks: {} // CHECK:STDOUT: insts: // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: name_scope0, arg1: inst, type: type0} -// CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, type: type1} +// CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1} // CHECK:STDOUT: inst+2: {kind: Return} // CHECK:STDOUT: constant_values: // CHECK:STDOUT: inst+0: template inst+0 @@ -66,7 +66,7 @@ fn B() {} // CHECK:STDOUT: type_blocks: {} // CHECK:STDOUT: insts: // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: name_scope0, arg1: inst, type: type0} -// CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, type: type1} +// CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1} // CHECK:STDOUT: inst+2: {kind: Return} // CHECK:STDOUT: constant_values: // CHECK:STDOUT: inst+0: template inst+0 diff --git a/toolchain/check/testdata/basics/numeric_literals.carbon b/toolchain/check/testdata/basics/numeric_literals.carbon index a77a84cdd29a..707172ec1e17 100644 --- a/toolchain/check/testdata/basics/numeric_literals.carbon +++ b/toolchain/check/testdata/basics/numeric_literals.carbon @@ -59,7 +59,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/basics/raw_and_textual_ir.carbon b/toolchain/check/testdata/basics/raw_and_textual_ir.carbon index 92ee4658fe66..bea48514e68e 100644 --- a/toolchain/check/testdata/basics/raw_and_textual_ir.carbon +++ b/toolchain/check/testdata/basics/raw_and_textual_ir.carbon @@ -54,7 +54,7 @@ fn Foo(n: i32) -> (i32, i32, f64) { // CHECK:STDOUT: inst+6: {kind: Converted, arg0: inst+4, arg1: inst+5, type: typeTypeType} // CHECK:STDOUT: inst+7: {kind: VarStorage, arg0: nameReturnSlot, type: type4} // CHECK:STDOUT: inst+8: {kind: PointerType, arg0: type4, type: typeTypeType} -// CHECK:STDOUT: inst+9: {kind: FunctionDecl, arg0: function0, type: type6} +// CHECK:STDOUT: inst+9: {kind: FunctionDecl, arg0: function0, arg1: block5, type: type6} // CHECK:STDOUT: inst+10: {kind: NameRef, arg0: name1, arg1: inst+2, type: type1} // CHECK:STDOUT: inst+11: {kind: IntLiteral, arg0: int4, type: type1} // CHECK:STDOUT: inst+12: {kind: IntLiteral, arg0: int4, type: type1} @@ -139,7 +139,13 @@ fn Foo(n: i32) -> (i32, i32, f64) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo { +// CHECK:STDOUT: %n.loc11_8.1: i32 = param n +// CHECK:STDOUT: @Foo.%n: i32 = bind_name n, %n.loc11_8.1 +// CHECK:STDOUT: %.loc11_33.1: (type, type, type) = tuple_literal (i32, i32, f64) +// CHECK:STDOUT: %.loc11_33.2: type = converted %.loc11_33.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: @Foo.%return: ref (i32, i32, f64) = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%n: i32) -> %return: (i32, i32, f64) { diff --git a/toolchain/check/testdata/basics/raw_identifier.carbon b/toolchain/check/testdata/basics/raw_identifier.carbon index 2543297df078..d13e34e6d7ce 100644 --- a/toolchain/check/testdata/basics/raw_identifier.carbon +++ b/toolchain/check/testdata/basics/raw_identifier.carbon @@ -24,9 +24,21 @@ fn C(r#if: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A, .B = %B, .C = %C} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] -// CHECK:STDOUT: %C: = fn_decl @C [template] +// CHECK:STDOUT: %A: = fn_decl @A { +// CHECK:STDOUT: %n.loc11_6.1: i32 = param n +// CHECK:STDOUT: @A.%n: i32 = bind_name n, %n.loc11_6.1 +// CHECK:STDOUT: %return.var.loc11: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %B: = fn_decl @B { +// CHECK:STDOUT: %n.loc15_6.1: i32 = param n +// CHECK:STDOUT: @B.%n: i32 = bind_name n, %n.loc15_6.1 +// CHECK:STDOUT: %return.var.loc15: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %C: = fn_decl @C { +// CHECK:STDOUT: %if.loc19_6.1: i32 = param r#if +// CHECK:STDOUT: @C.%if: i32 = bind_name r#if, %if.loc19_6.1 +// CHECK:STDOUT: %return.var.loc19: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(%n: i32) -> i32 { diff --git a/toolchain/check/testdata/basics/raw_ir.carbon b/toolchain/check/testdata/basics/raw_ir.carbon index 8a2552795ec5..57365eb13ebd 100644 --- a/toolchain/check/testdata/basics/raw_ir.carbon +++ b/toolchain/check/testdata/basics/raw_ir.carbon @@ -54,7 +54,7 @@ fn Foo(n: i32) -> (i32, i32, f64) { // CHECK:STDOUT: inst+6: {kind: Converted, arg0: inst+4, arg1: inst+5, type: typeTypeType} // CHECK:STDOUT: inst+7: {kind: VarStorage, arg0: nameReturnSlot, type: type4} // CHECK:STDOUT: inst+8: {kind: PointerType, arg0: type4, type: typeTypeType} -// CHECK:STDOUT: inst+9: {kind: FunctionDecl, arg0: function0, type: type6} +// CHECK:STDOUT: inst+9: {kind: FunctionDecl, arg0: function0, arg1: block5, type: type6} // CHECK:STDOUT: inst+10: {kind: NameRef, arg0: name1, arg1: inst+2, type: type1} // CHECK:STDOUT: inst+11: {kind: IntLiteral, arg0: int4, type: type1} // CHECK:STDOUT: inst+12: {kind: IntLiteral, arg0: int4, type: type1} diff --git a/toolchain/check/testdata/basics/run.carbon b/toolchain/check/testdata/basics/run.carbon index 503163937fb1..37e054280fd5 100644 --- a/toolchain/check/testdata/basics/run.carbon +++ b/toolchain/check/testdata/basics/run.carbon @@ -10,7 +10,7 @@ fn Run() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Run = %Run} [template] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Run: = fn_decl @Run {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { diff --git a/toolchain/check/testdata/basics/run_i32.carbon b/toolchain/check/testdata/basics/run_i32.carbon index 0fe7c0e2b053..6a2061b638a4 100644 --- a/toolchain/check/testdata/basics/run_i32.carbon +++ b/toolchain/check/testdata/basics/run_i32.carbon @@ -14,7 +14,9 @@ fn Run() -> i32 { return 0; } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Run = %Run} [template] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Run: = fn_decl @Run { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { diff --git a/toolchain/check/testdata/basics/textual_ir.carbon b/toolchain/check/testdata/basics/textual_ir.carbon index 840f8ab6f469..ab64ec8bd1d8 100644 --- a/toolchain/check/testdata/basics/textual_ir.carbon +++ b/toolchain/check/testdata/basics/textual_ir.carbon @@ -24,7 +24,13 @@ fn Foo(n: i32) -> (i32, i32, f64) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo { +// CHECK:STDOUT: %n.loc11_8.1: i32 = param n +// CHECK:STDOUT: @Foo.%n: i32 = bind_name n, %n.loc11_8.1 +// CHECK:STDOUT: %.loc11_33.1: (type, type, type) = tuple_literal (i32, i32, f64) +// CHECK:STDOUT: %.loc11_33.2: type = converted %.loc11_33.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: @Foo.%return: ref (i32, i32, f64) = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%n: i32) -> %return: (i32, i32, f64) { diff --git a/toolchain/check/testdata/class/base.carbon b/toolchain/check/testdata/class/base.carbon index 62b1bf65dd9a..c1e2fb2974d0 100644 --- a/toolchain/check/testdata/class/base.carbon +++ b/toolchain/check/testdata/class/base.carbon @@ -48,10 +48,20 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Derived = %Derived.decl, .Make = %Make, .Access = %Access} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] -// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () [template = constants.%Derived] -// CHECK:STDOUT: %Make: = fn_decl @Make [template] -// CHECK:STDOUT: %Access: = fn_decl @Access [template] +// CHECK:STDOUT: %Base.decl = class_decl @Base {} [template = constants.%Base] +// CHECK:STDOUT: %Derived.decl = class_decl @Derived {} [template = constants.%Derived] +// CHECK:STDOUT: %Make: = fn_decl @Make { +// CHECK:STDOUT: %Derived.ref.loc17: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: @Make.%return: ref Derived = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Access: = fn_decl @Access { +// CHECK:STDOUT: %Derived.ref.loc21: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %d.loc21_11.1: Derived = param d +// CHECK:STDOUT: @Access.%d: Derived = bind_name d, %d.loc21_11.1 +// CHECK:STDOUT: %.loc21_35.1: (type, type) = tuple_literal (i32, i32) +// CHECK:STDOUT: %.loc21_35.2: type = converted %.loc21_35.1, constants.%.16 [template = constants.%.16] +// CHECK:STDOUT: @Access.%return: ref (i32, i32) = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { diff --git a/toolchain/check/testdata/class/base_field.carbon b/toolchain/check/testdata/class/base_field.carbon index 5924710754e5..3afd6fba3b8a 100644 --- a/toolchain/check/testdata/class/base_field.carbon +++ b/toolchain/check/testdata/class/base_field.carbon @@ -41,9 +41,16 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Derived = %Derived.decl, .Access = %Access} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] -// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () [template = constants.%Derived] -// CHECK:STDOUT: %Access: = fn_decl @Access [template] +// CHECK:STDOUT: %Base.decl = class_decl @Base {} [template = constants.%Base] +// CHECK:STDOUT: %Derived.decl = class_decl @Derived {} [template = constants.%Derived] +// CHECK:STDOUT: %Access: = fn_decl @Access { +// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %.loc20_21: type = ptr_type Derived [template = constants.%.7] +// CHECK:STDOUT: %p.loc20_11.1: Derived* = param p +// CHECK:STDOUT: @Access.%p: Derived* = bind_name p, %p.loc20_11.1 +// CHECK:STDOUT: %.loc20_30: type = ptr_type i32 [template = constants.%.8] +// CHECK:STDOUT: %return.var: ref i32* = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { diff --git a/toolchain/check/testdata/class/base_function_unqualified.carbon b/toolchain/check/testdata/class/base_function_unqualified.carbon index 53dc010f32e8..4472d2d5ad8d 100644 --- a/toolchain/check/testdata/class/base_function_unqualified.carbon +++ b/toolchain/check/testdata/class/base_function_unqualified.carbon @@ -33,13 +33,13 @@ fn Derived.H() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Derived = %Derived.decl} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] -// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () [template = constants.%Derived] -// CHECK:STDOUT: %H: = fn_decl @H [template] +// CHECK:STDOUT: %Base.decl = class_decl @Base {} [template = constants.%Base] +// CHECK:STDOUT: %Derived.decl = class_decl @Derived {} [template = constants.%Derived] +// CHECK:STDOUT: %H: = fn_decl @H {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -48,8 +48,8 @@ fn Derived.H() { // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc12: = base_decl Base, element0 [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %H: = fn_decl @H [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] +// CHECK:STDOUT: %H: = fn_decl @H {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc12 diff --git a/toolchain/check/testdata/class/base_method.carbon b/toolchain/check/testdata/class/base_method.carbon index 72fa2dc7d917..14c2e5029c51 100644 --- a/toolchain/check/testdata/class/base_method.carbon +++ b/toolchain/check/testdata/class/base_method.carbon @@ -42,15 +42,32 @@ fn Call(p: Derived*) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Derived = %Derived.decl, .Call = %Call} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () [template = constants.%Derived] -// CHECK:STDOUT: %Call: = fn_decl @Call [template] +// CHECK:STDOUT: %Base.decl = class_decl @Base {} [template = constants.%Base] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Base.ref: type = name_ref Base, %Base.decl [template = constants.%Base] +// CHECK:STDOUT: %.loc13_26: type = ptr_type Base [template = constants.%.2] +// CHECK:STDOUT: %self.loc13_16.1: Base* = param self +// CHECK:STDOUT: @F.%self: Base* = bind_name self, %self.loc13_16.1 +// CHECK:STDOUT: @F.%.loc13: Base* = addr_pattern @F.%self +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Derived.decl = class_decl @Derived {} [template = constants.%Derived] +// CHECK:STDOUT: %Call: = fn_decl @Call { +// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %.loc21: type = ptr_type Derived [template = constants.%.8] +// CHECK:STDOUT: %p.loc21_9.1: Derived* = param p +// CHECK:STDOUT: @Call.%p: Derived* = bind_name p, %p.loc21_9.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { // CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Base [template = constants.%Base] +// CHECK:STDOUT: %.loc10_23: type = ptr_type Base [template = constants.%.2] +// CHECK:STDOUT: %self.loc10_13.1: Base* = param self +// CHECK:STDOUT: %self.loc10_13.3: Base* = bind_name self, %self.loc10_13.1 +// CHECK:STDOUT: %.loc10_8: Base* = addr_pattern %self.loc10_13.3 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %.loc8 diff --git a/toolchain/check/testdata/class/base_method_shadow.carbon b/toolchain/check/testdata/class/base_method_shadow.carbon index 0be606e2e63e..e1769787fd53 100644 --- a/toolchain/check/testdata/class/base_method_shadow.carbon +++ b/toolchain/check/testdata/class/base_method_shadow.carbon @@ -56,15 +56,38 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl, .B = %B.decl, .C = %C.decl, .D = %D.decl, .Call = %Call} [template] -// CHECK:STDOUT: %A.decl = class_decl @A, () [template = constants.%A] -// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %D.decl = class_decl @D, () [template = constants.%D] -// CHECK:STDOUT: %Call: = fn_decl @Call [template] +// CHECK:STDOUT: %A.decl = class_decl @A {} [template = constants.%A] +// CHECK:STDOUT: %B.decl = class_decl @B {} [template = constants.%B] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %D.decl = class_decl @D {} [template = constants.%D] +// CHECK:STDOUT: %Call: = fn_decl @Call { +// CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] +// CHECK:STDOUT: %.loc25_13: type = ptr_type A [template = constants.%.1] +// CHECK:STDOUT: %a.loc25_9.1: A* = param a +// CHECK:STDOUT: @Call.%a: A* = bind_name a, %a.loc25_9.1 +// CHECK:STDOUT: %B.ref: type = name_ref B, %B.decl [template = constants.%B] +// CHECK:STDOUT: %.loc25_20: type = ptr_type B [template = constants.%.6] +// CHECK:STDOUT: %b.loc25_16.1: B* = param b +// CHECK:STDOUT: @Call.%b: B* = bind_name b, %b.loc25_16.1 +// CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc25_27: type = ptr_type C [template = constants.%.11] +// CHECK:STDOUT: %c.loc25_23.1: C* = param c +// CHECK:STDOUT: @Call.%c: C* = bind_name c, %c.loc25_23.1 +// CHECK:STDOUT: %D.ref: type = name_ref D, %D.decl [template = constants.%D] +// CHECK:STDOUT: %.loc25_34: type = ptr_type D [template = constants.%.14] +// CHECK:STDOUT: %d.loc25_30.1: D* = param d +// CHECK:STDOUT: @Call.%d: D* = bind_name d, %d.loc25_30.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] +// CHECK:STDOUT: %F: = fn_decl @F.1 { +// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%A [template = constants.%A] +// CHECK:STDOUT: %.loc8_23: type = ptr_type A [template = constants.%.1] +// CHECK:STDOUT: %self.loc8_13.1: A* = param self +// CHECK:STDOUT: %self.loc8_13.3: A* = bind_name self, %self.loc8_13.1 +// CHECK:STDOUT: %.loc8_8: A* = addr_pattern %self.loc8_13.3 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -73,7 +96,13 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: class @B { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %.loc12: = base_decl A, element0 [template] -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %F: = fn_decl @F.2 { +// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%B [template = constants.%B] +// CHECK:STDOUT: %.loc13_23: type = ptr_type B [template = constants.%.6] +// CHECK:STDOUT: %self.loc13_13.1: B* = param self +// CHECK:STDOUT: %self.loc13_13.3: B* = bind_name self, %self.loc13_13.1 +// CHECK:STDOUT: %.loc13_8: B* = addr_pattern %self.loc13_13.3 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc12 @@ -84,7 +113,13 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: class @C { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc17: = base_decl B, element0 [template] -// CHECK:STDOUT: %F: = fn_decl @F.3 [template] +// CHECK:STDOUT: %F: = fn_decl @F.3 { +// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C] +// CHECK:STDOUT: %.loc18_23: type = ptr_type C [template = constants.%.11] +// CHECK:STDOUT: %self.loc18_13.1: C* = param self +// CHECK:STDOUT: %self.loc18_13.3: C* = bind_name self, %self.loc18_13.1 +// CHECK:STDOUT: %.loc18_8: C* = addr_pattern %self.loc18_13.3 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc17 @@ -101,11 +136,11 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.1[addr %self: A*](); +// CHECK:STDOUT: fn @F.1[addr @A.%self.loc8_13.3: A*](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2[addr %self: B*](); +// CHECK:STDOUT: fn @F.2[addr @B.%self.loc13_13.3: B*](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.3[addr %self: C*](); +// CHECK:STDOUT: fn @F.3[addr @C.%self.loc18_13.3: C*](); // CHECK:STDOUT: // CHECK:STDOUT: fn @Call(%a: A*, %b: B*, %c: C*, %d: D*) { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/class/basic.carbon b/toolchain/check/testdata/class/basic.carbon index 812330792c78..02b3b2914b04 100644 --- a/toolchain/check/testdata/class/basic.carbon +++ b/toolchain/check/testdata/class/basic.carbon @@ -33,14 +33,28 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .Run = %Run} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %n.loc17_12.1: i32 = param n +// CHECK:STDOUT: @G.%n: i32 = bind_name n, %n.loc17_12.1 +// CHECK:STDOUT: %return.var.loc17: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Run: = fn_decl @Run { +// CHECK:STDOUT: %return.var.loc21: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %n.loc8_8.1: i32 = param n +// CHECK:STDOUT: %n.loc8_8.2: i32 = bind_name n, %n.loc8_8.1 +// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %n.loc12_8.1: i32 = param n +// CHECK:STDOUT: %n.loc12_8.2: i32 = bind_name n, %n.loc12_8.1 +// CHECK:STDOUT: %return.var.loc12: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %.loc14: = field_decl k, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -49,9 +63,9 @@ fn Run() -> i32 { // CHECK:STDOUT: .k = %.loc14 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%n: i32) -> i32 { +// CHECK:STDOUT: fn @F(@Class.%n.loc8_8.2: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: i32 = name_ref n, %n +// CHECK:STDOUT: %n.ref: i32 = name_ref n, @Class.%n.loc8_8.2 // CHECK:STDOUT: return %n.ref // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/derived_to_base.carbon b/toolchain/check/testdata/class/derived_to_base.carbon index 83a57362f888..2b03a922588f 100644 --- a/toolchain/check/testdata/class/derived_to_base.carbon +++ b/toolchain/check/testdata/class/derived_to_base.carbon @@ -70,15 +70,51 @@ fn ConvertInit() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl, .B = %B.decl, .C = %C.decl, .ConvertCToB = %ConvertCToB, .ConvertBToA = %ConvertBToA, .ConvertCToA = %ConvertCToA, .ConvertValue = %ConvertValue, .ConvertRef = %ConvertRef, .ConvertInit = %ConvertInit} [template] -// CHECK:STDOUT: %A.decl = class_decl @A, () [template = constants.%A] -// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %ConvertCToB: = fn_decl @ConvertCToB [template] -// CHECK:STDOUT: %ConvertBToA: = fn_decl @ConvertBToA [template] -// CHECK:STDOUT: %ConvertCToA: = fn_decl @ConvertCToA [template] -// CHECK:STDOUT: %ConvertValue: = fn_decl @ConvertValue [template] -// CHECK:STDOUT: %ConvertRef: = fn_decl @ConvertRef [template] -// CHECK:STDOUT: %ConvertInit: = fn_decl @ConvertInit [template] +// CHECK:STDOUT: %A.decl = class_decl @A {} [template = constants.%A] +// CHECK:STDOUT: %B.decl = class_decl @B {} [template = constants.%B] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %ConvertCToB: = fn_decl @ConvertCToB { +// CHECK:STDOUT: %C.ref.loc21: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc21_20: type = ptr_type C [template = constants.%.13] +// CHECK:STDOUT: %p.loc21_16.1: C* = param p +// CHECK:STDOUT: @ConvertCToB.%p: C* = bind_name p, %p.loc21_16.1 +// CHECK:STDOUT: %B.ref.loc21: type = name_ref B, %B.decl [template = constants.%B] +// CHECK:STDOUT: %.loc21_27: type = ptr_type B [template = constants.%.14] +// CHECK:STDOUT: %return.var.loc21: ref B* = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %ConvertBToA: = fn_decl @ConvertBToA { +// CHECK:STDOUT: %B.ref.loc22: type = name_ref B, %B.decl [template = constants.%B] +// CHECK:STDOUT: %.loc22_20: type = ptr_type B [template = constants.%.14] +// CHECK:STDOUT: %p.loc22_16.1: B* = param p +// CHECK:STDOUT: @ConvertBToA.%p: B* = bind_name p, %p.loc22_16.1 +// CHECK:STDOUT: %A.ref.loc22: type = name_ref A, %A.decl [template = constants.%A] +// CHECK:STDOUT: %.loc22_27: type = ptr_type A [template = constants.%.18] +// CHECK:STDOUT: %return.var.loc22: ref A* = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %ConvertCToA: = fn_decl @ConvertCToA { +// CHECK:STDOUT: %C.ref.loc23: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc23_20: type = ptr_type C [template = constants.%.13] +// CHECK:STDOUT: %p.loc23_16.1: C* = param p +// CHECK:STDOUT: @ConvertCToA.%p: C* = bind_name p, %p.loc23_16.1 +// CHECK:STDOUT: %A.ref.loc23: type = name_ref A, %A.decl [template = constants.%A] +// CHECK:STDOUT: %.loc23_27: type = ptr_type A [template = constants.%.18] +// CHECK:STDOUT: %return.var.loc23: ref A* = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %ConvertValue: = fn_decl @ConvertValue { +// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %c.loc25_17.1: C = param c +// CHECK:STDOUT: @ConvertValue.%c: C = bind_name c, %c.loc25_17.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %ConvertRef: = fn_decl @ConvertRef { +// CHECK:STDOUT: %C.ref.loc29: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc29_19: type = ptr_type C [template = constants.%.13] +// CHECK:STDOUT: %c.loc29_15.1: C* = param c +// CHECK:STDOUT: @ConvertRef.%c: C* = bind_name c, %c.loc29_15.1 +// CHECK:STDOUT: %A.ref.loc29: type = name_ref A, %A.decl [template = constants.%A] +// CHECK:STDOUT: %.loc29_26: type = ptr_type A [template = constants.%.18] +// CHECK:STDOUT: %return.var.loc29: ref A* = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %ConvertInit: = fn_decl @ConvertInit {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { diff --git a/toolchain/check/testdata/class/fail_abstract.carbon b/toolchain/check/testdata/class/fail_abstract.carbon index cd8910386fea..922ceb38fda5 100644 --- a/toolchain/check/testdata/class/fail_abstract.carbon +++ b/toolchain/check/testdata/class/fail_abstract.carbon @@ -50,10 +50,20 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Abstract = %Abstract.decl, .Derived = %Derived.decl, .Make = %Make, .Access = %Access} [template] -// CHECK:STDOUT: %Abstract.decl = class_decl @Abstract, () [template = constants.%Abstract] -// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () [template = constants.%Derived] -// CHECK:STDOUT: %Make: = fn_decl @Make [template] -// CHECK:STDOUT: %Access: = fn_decl @Access [template] +// CHECK:STDOUT: %Abstract.decl = class_decl @Abstract {} [template = constants.%Abstract] +// CHECK:STDOUT: %Derived.decl = class_decl @Derived {} [template = constants.%Derived] +// CHECK:STDOUT: %Make: = fn_decl @Make { +// CHECK:STDOUT: %Derived.ref.loc17: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: @Make.%return: ref Derived = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Access: = fn_decl @Access { +// CHECK:STDOUT: %Derived.ref.loc25: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %d.loc25_11.1: Derived = param d +// CHECK:STDOUT: @Access.%d: Derived = bind_name d, %d.loc25_11.1 +// CHECK:STDOUT: %.loc25_35.1: (type, type) = tuple_literal (i32, i32) +// CHECK:STDOUT: %.loc25_35.2: type = converted %.loc25_35.1, constants.%.14 [template = constants.%.14] +// CHECK:STDOUT: @Access.%return: ref (i32, i32) = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Abstract { diff --git a/toolchain/check/testdata/class/fail_addr_not_self.carbon b/toolchain/check/testdata/class/fail_addr_not_self.carbon index e9eef43010ad..22298f2000e7 100644 --- a/toolchain/check/testdata/class/fail_addr_not_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_not_self.carbon @@ -26,19 +26,29 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Class.ref.loc11: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc11: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %a.loc11_13.1: Class* = param a +// CHECK:STDOUT: %a.loc11_13.2: Class* = bind_name a, %a.loc11_13.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc16: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %b.loc16_13.1: Class* = param b +// CHECK:STDOUT: %b.loc16_13.2: Class* = bind_name b, %b.loc16_13.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F // CHECK:STDOUT: .G = %G // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F[%a: Class*](); +// CHECK:STDOUT: fn @F[@Class.%a.loc11_13.2: Class*](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @G(%b: Class*); +// CHECK:STDOUT: fn @G(@Class.%b.loc16_13.2: Class*); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_addr_self.carbon b/toolchain/check/testdata/class/fail_addr_self.carbon index efe666eedc8f..53acda4b0d37 100644 --- a/toolchain/check/testdata/class/fail_addr_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_self.carbon @@ -50,22 +50,41 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .F = %F} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F.2 { +// CHECK:STDOUT: %Class.ref.loc12_9: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %c.loc12_6.1: Class = param c +// CHECK:STDOUT: @F.2.%c: Class = bind_name c, %c.loc12_6.1 +// CHECK:STDOUT: %Class.ref.loc12_19: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc12: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %p.loc12_16.1: Class* = param p +// CHECK:STDOUT: @F.2.%p: Class* = bind_name p, %p.loc12_16.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F.1 { +// CHECK:STDOUT: %Class.ref.loc8: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc8_24: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %self.loc8_13.1: Class* = param self +// CHECK:STDOUT: %self.loc8_13.3: Class* = bind_name self, %self.loc8_13.1 +// CHECK:STDOUT: %.loc8_8: Class* = addr_pattern %self.loc8_13.3 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Class.ref.loc9: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc9_13.1: Class = param self +// CHECK:STDOUT: %self.loc9_13.3: Class = bind_name self, %self.loc9_13.1 +// CHECK:STDOUT: %.loc9: Class = addr_pattern %self.loc9_13.3 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F // CHECK:STDOUT: .G = %G // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.1[addr %self: Class*](); +// CHECK:STDOUT: fn @F.1[addr @Class.%self.loc8_13.3: Class*](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @G[addr %self: Class](); +// CHECK:STDOUT: fn @G[addr @Class.%self.loc9_13.3: Class](); // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2(%c: Class, %p: Class*) { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/class/fail_base_bad_type.carbon b/toolchain/check/testdata/class/fail_base_bad_type.carbon index 9b7dffdb0ea4..34967aa0aee8 100644 --- a/toolchain/check/testdata/class/fail_base_bad_type.carbon +++ b/toolchain/check/testdata/class/fail_base_bad_type.carbon @@ -161,29 +161,118 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Final = %Final.decl, .DeriveFromError = %DeriveFromError.decl, .AccessMemberWithInvalidBaseError = %AccessMemberWithInvalidBaseError, .DeriveFromNonType = %DeriveFromNonType.decl, .AccessMemberWithInvalidBasNonType = %AccessMemberWithInvalidBasNonType, .DeriveFromi32 = %DeriveFromi32.decl, .ConvertToBadBasei32 = %ConvertToBadBasei32, .AccessMemberWithInvalidBasei32 = %AccessMemberWithInvalidBasei32, .DeriveFromTuple = %DeriveFromTuple.decl, .ConvertToBadBaseTuple = %ConvertToBadBaseTuple, .AccessMemberWithInvalidBaseTuple = %AccessMemberWithInvalidBaseTuple, .DeriveFromStruct = %DeriveFromStruct.decl, .ConvertToBadBaseStruct = %ConvertToBadBaseStruct, .AccessMemberWithInvalidBaseStruct = %AccessMemberWithInvalidBaseStruct, .Incomplete = %Incomplete.decl, .DeriveFromIncomplete = %DeriveFromIncomplete.decl, .ConvertToBadBaseIncomplete = %ConvertToBadBaseIncomplete, .AccessMemberWithInvalidBaseIncomplete = %AccessMemberWithInvalidBaseIncomplete, .DeriveFromFinal = %DeriveFromFinal.decl, .ConvertToBadBaseFinal = %ConvertToBadBaseFinal, .AccessMemberWithInvalidBaseFinal_WithMember = %AccessMemberWithInvalidBaseFinal_WithMember, .AccessMemberWithInvalidBaseFinal_NoMember = %AccessMemberWithInvalidBaseFinal_NoMember} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] -// CHECK:STDOUT: %Final.decl = class_decl @Final, () [template = constants.%Final] -// CHECK:STDOUT: %DeriveFromError.decl = class_decl @DeriveFromError, () [template = constants.%DeriveFromError] -// CHECK:STDOUT: %AccessMemberWithInvalidBaseError: = fn_decl @AccessMemberWithInvalidBaseError [template] -// CHECK:STDOUT: %DeriveFromNonType.decl = class_decl @DeriveFromNonType, () [template = constants.%DeriveFromNonType] -// CHECK:STDOUT: %AccessMemberWithInvalidBasNonType: = fn_decl @AccessMemberWithInvalidBasNonType [template] -// CHECK:STDOUT: %DeriveFromi32.decl = class_decl @DeriveFromi32, () [template = constants.%DeriveFromi32] -// CHECK:STDOUT: %ConvertToBadBasei32: = fn_decl @ConvertToBadBasei32 [template] -// CHECK:STDOUT: %AccessMemberWithInvalidBasei32: = fn_decl @AccessMemberWithInvalidBasei32 [template] -// CHECK:STDOUT: %DeriveFromTuple.decl = class_decl @DeriveFromTuple, () [template = constants.%DeriveFromTuple] -// CHECK:STDOUT: %ConvertToBadBaseTuple: = fn_decl @ConvertToBadBaseTuple [template] -// CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple: = fn_decl @AccessMemberWithInvalidBaseTuple [template] -// CHECK:STDOUT: %DeriveFromStruct.decl = class_decl @DeriveFromStruct, () [template = constants.%DeriveFromStruct] -// CHECK:STDOUT: %ConvertToBadBaseStruct: = fn_decl @ConvertToBadBaseStruct [template] -// CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct: = fn_decl @AccessMemberWithInvalidBaseStruct [template] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] -// CHECK:STDOUT: %DeriveFromIncomplete.decl = class_decl @DeriveFromIncomplete, () [template = constants.%DeriveFromIncomplete] -// CHECK:STDOUT: %ConvertToBadBaseIncomplete: = fn_decl @ConvertToBadBaseIncomplete [template] -// CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete: = fn_decl @AccessMemberWithInvalidBaseIncomplete [template] -// CHECK:STDOUT: %DeriveFromFinal.decl = class_decl @DeriveFromFinal, () [template = constants.%DeriveFromFinal] -// CHECK:STDOUT: %ConvertToBadBaseFinal: = fn_decl @ConvertToBadBaseFinal [template] -// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember: = fn_decl @AccessMemberWithInvalidBaseFinal_WithMember [template] -// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember: = fn_decl @AccessMemberWithInvalidBaseFinal_NoMember [template] +// CHECK:STDOUT: %Base.decl = class_decl @Base {} [template = constants.%Base] +// CHECK:STDOUT: %Final.decl = class_decl @Final {} [template = constants.%Final] +// CHECK:STDOUT: %DeriveFromError.decl = class_decl @DeriveFromError {} [template = constants.%DeriveFromError] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseError: = fn_decl @AccessMemberWithInvalidBaseError { +// CHECK:STDOUT: %DeriveFromError.ref: type = name_ref DeriveFromError, %DeriveFromError.decl [template = constants.%DeriveFromError] +// CHECK:STDOUT: %.loc20: type = ptr_type DeriveFromError [template = constants.%.4] +// CHECK:STDOUT: %p.loc20_37.1: DeriveFromError* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBaseError.%p: DeriveFromError* = bind_name p, %p.loc20_37.1 +// CHECK:STDOUT: %return.var.loc20: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %DeriveFromNonType.decl = class_decl @DeriveFromNonType {} [template = constants.%DeriveFromNonType] +// CHECK:STDOUT: %AccessMemberWithInvalidBasNonType: = fn_decl @AccessMemberWithInvalidBasNonType { +// CHECK:STDOUT: %DeriveFromNonType.ref: type = name_ref DeriveFromNonType, %DeriveFromNonType.decl [template = constants.%DeriveFromNonType] +// CHECK:STDOUT: %.loc29: type = ptr_type DeriveFromNonType [template = constants.%.6] +// CHECK:STDOUT: %p.loc29_38.1: DeriveFromNonType* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBasNonType.%p: DeriveFromNonType* = bind_name p, %p.loc29_38.1 +// CHECK:STDOUT: %return.var.loc29: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %DeriveFromi32.decl = class_decl @DeriveFromi32 {} [template = constants.%DeriveFromi32] +// CHECK:STDOUT: %ConvertToBadBasei32: = fn_decl @ConvertToBadBasei32 { +// CHECK:STDOUT: %DeriveFromi32.ref.loc43: type = name_ref DeriveFromi32, %DeriveFromi32.decl [template = constants.%DeriveFromi32] +// CHECK:STDOUT: %.loc43_40: type = ptr_type DeriveFromi32 [template = constants.%.7] +// CHECK:STDOUT: %p.loc43_24.1: DeriveFromi32* = param p +// CHECK:STDOUT: @ConvertToBadBasei32.%p: DeriveFromi32* = bind_name p, %p.loc43_24.1 +// CHECK:STDOUT: %.loc43_49: type = ptr_type i32 [template = constants.%.8] +// CHECK:STDOUT: %return.var.loc43: ref i32* = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBasei32: = fn_decl @AccessMemberWithInvalidBasei32 { +// CHECK:STDOUT: %DeriveFromi32.ref.loc45: type = name_ref DeriveFromi32, %DeriveFromi32.decl [template = constants.%DeriveFromi32] +// CHECK:STDOUT: %.loc45: type = ptr_type DeriveFromi32 [template = constants.%.7] +// CHECK:STDOUT: %p.loc45_35.1: DeriveFromi32* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBasei32.%p: DeriveFromi32* = bind_name p, %p.loc45_35.1 +// CHECK:STDOUT: %return.var.loc45: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %DeriveFromTuple.decl = class_decl @DeriveFromTuple {} [template = constants.%DeriveFromTuple] +// CHECK:STDOUT: %ConvertToBadBaseTuple: = fn_decl @ConvertToBadBaseTuple { +// CHECK:STDOUT: %DeriveFromTuple.ref.loc57: type = name_ref DeriveFromTuple, %DeriveFromTuple.decl [template = constants.%DeriveFromTuple] +// CHECK:STDOUT: %.loc57_44: type = ptr_type DeriveFromTuple [template = constants.%.14] +// CHECK:STDOUT: %p.loc57_26.1: DeriveFromTuple* = param p +// CHECK:STDOUT: @ConvertToBadBaseTuple.%p: DeriveFromTuple* = bind_name p, %p.loc57_26.1 +// CHECK:STDOUT: %Base.ref: type = name_ref Base, %Base.decl [template = constants.%Base] +// CHECK:STDOUT: %.loc57_56.1: (type,) = tuple_literal (%Base.ref) +// CHECK:STDOUT: %.loc57_56.2: type = converted %.loc57_56.1, constants.%.10 [template = constants.%.10] +// CHECK:STDOUT: %.loc57_57: type = ptr_type (Base,) [template = constants.%.15] +// CHECK:STDOUT: %return.var.loc57: ref (Base,)* = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple: = fn_decl @AccessMemberWithInvalidBaseTuple { +// CHECK:STDOUT: %DeriveFromTuple.ref.loc59: type = name_ref DeriveFromTuple, %DeriveFromTuple.decl [template = constants.%DeriveFromTuple] +// CHECK:STDOUT: %.loc59: type = ptr_type DeriveFromTuple [template = constants.%.14] +// CHECK:STDOUT: %p.loc59_37.1: DeriveFromTuple* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBaseTuple.%p: DeriveFromTuple* = bind_name p, %p.loc59_37.1 +// CHECK:STDOUT: %return.var.loc59: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %DeriveFromStruct.decl = class_decl @DeriveFromStruct {} [template = constants.%DeriveFromStruct] +// CHECK:STDOUT: %ConvertToBadBaseStruct: = fn_decl @ConvertToBadBaseStruct { +// CHECK:STDOUT: %DeriveFromStruct.ref.loc73: type = name_ref DeriveFromStruct, %DeriveFromStruct.decl [template = constants.%DeriveFromStruct] +// CHECK:STDOUT: %.loc73_46: type = ptr_type DeriveFromStruct [template = constants.%.18] +// CHECK:STDOUT: %p.loc73_27.1: DeriveFromStruct* = param p +// CHECK:STDOUT: @ConvertToBadBaseStruct.%p: DeriveFromStruct* = bind_name p, %p.loc73_27.1 +// CHECK:STDOUT: %.loc73_69: type = struct_type {.a: i32, .b: i32} [template = constants.%.16] +// CHECK:STDOUT: %.loc73_70: type = ptr_type {.a: i32, .b: i32} [template = constants.%.17] +// CHECK:STDOUT: %return.var.loc73: ref {.a: i32, .b: i32}* = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct: = fn_decl @AccessMemberWithInvalidBaseStruct { +// CHECK:STDOUT: %DeriveFromStruct.ref.loc76: type = name_ref DeriveFromStruct, %DeriveFromStruct.decl [template = constants.%DeriveFromStruct] +// CHECK:STDOUT: %.loc76: type = ptr_type DeriveFromStruct [template = constants.%.18] +// CHECK:STDOUT: %p.loc76_38.1: DeriveFromStruct* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBaseStruct.%p: DeriveFromStruct* = bind_name p, %p.loc76_38.1 +// CHECK:STDOUT: %return.var.loc76: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete {} [template = constants.%Incomplete] +// CHECK:STDOUT: %DeriveFromIncomplete.decl = class_decl @DeriveFromIncomplete {} [template = constants.%DeriveFromIncomplete] +// CHECK:STDOUT: %ConvertToBadBaseIncomplete: = fn_decl @ConvertToBadBaseIncomplete { +// CHECK:STDOUT: %DeriveFromIncomplete.ref.loc93: type = name_ref DeriveFromIncomplete, %DeriveFromIncomplete.decl [template = constants.%DeriveFromIncomplete] +// CHECK:STDOUT: %.loc93_54: type = ptr_type DeriveFromIncomplete [template = constants.%.19] +// CHECK:STDOUT: %p.loc93_31.1: DeriveFromIncomplete* = param p +// CHECK:STDOUT: @ConvertToBadBaseIncomplete.%p: DeriveFromIncomplete* = bind_name p, %p.loc93_31.1 +// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] +// CHECK:STDOUT: %.loc93_70: type = ptr_type Incomplete [template = constants.%.20] +// CHECK:STDOUT: %return.var.loc93: ref Incomplete* = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete: = fn_decl @AccessMemberWithInvalidBaseIncomplete { +// CHECK:STDOUT: %DeriveFromIncomplete.ref.loc95: type = name_ref DeriveFromIncomplete, %DeriveFromIncomplete.decl [template = constants.%DeriveFromIncomplete] +// CHECK:STDOUT: %.loc95: type = ptr_type DeriveFromIncomplete [template = constants.%.19] +// CHECK:STDOUT: %p.loc95_42.1: DeriveFromIncomplete* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBaseIncomplete.%p: DeriveFromIncomplete* = bind_name p, %p.loc95_42.1 +// CHECK:STDOUT: %return.var.loc95: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %DeriveFromFinal.decl = class_decl @DeriveFromFinal {} [template = constants.%DeriveFromFinal] +// CHECK:STDOUT: %ConvertToBadBaseFinal: = fn_decl @ConvertToBadBaseFinal { +// CHECK:STDOUT: %DeriveFromFinal.ref.loc105: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] +// CHECK:STDOUT: %.loc105_44: type = ptr_type DeriveFromFinal [template = constants.%.24] +// CHECK:STDOUT: %p.loc105_26.1: DeriveFromFinal* = param p +// CHECK:STDOUT: @ConvertToBadBaseFinal.%p: DeriveFromFinal* = bind_name p, %p.loc105_26.1 +// CHECK:STDOUT: %Final.ref: type = name_ref Final, %Final.decl [template = constants.%Final] +// CHECK:STDOUT: %.loc105_55: type = ptr_type Final [template = constants.%.25] +// CHECK:STDOUT: %return.var.loc105: ref Final* = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember: = fn_decl @AccessMemberWithInvalidBaseFinal_WithMember { +// CHECK:STDOUT: %DeriveFromFinal.ref.loc109: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] +// CHECK:STDOUT: %.loc109: type = ptr_type DeriveFromFinal [template = constants.%.24] +// CHECK:STDOUT: %p.loc109_48.1: DeriveFromFinal* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_WithMember.%p: DeriveFromFinal* = bind_name p, %p.loc109_48.1 +// CHECK:STDOUT: %return.var.loc109: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember: = fn_decl @AccessMemberWithInvalidBaseFinal_NoMember { +// CHECK:STDOUT: %DeriveFromFinal.ref.loc113: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] +// CHECK:STDOUT: %.loc113: type = ptr_type DeriveFromFinal [template = constants.%.24] +// CHECK:STDOUT: %p.loc113_46.1: DeriveFromFinal* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_NoMember.%p: DeriveFromFinal* = bind_name p, %p.loc113_46.1 +// CHECK:STDOUT: %return.var.loc113: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { diff --git a/toolchain/check/testdata/class/fail_base_method_define.carbon b/toolchain/check/testdata/class/fail_base_method_define.carbon index 5c0bb8992694..a83351c84c3d 100644 --- a/toolchain/check/testdata/class/fail_base_method_define.carbon +++ b/toolchain/check/testdata/class/fail_base_method_define.carbon @@ -41,15 +41,15 @@ fn D.C.F() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B = %B.decl, .D = %D.decl} [template] -// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] -// CHECK:STDOUT: %D.decl = class_decl @D, () [template = constants.%D] -// CHECK:STDOUT: %F: = fn_decl @F.3 [template] -// CHECK:STDOUT: %.loc27: = fn_decl @.1 [template] +// CHECK:STDOUT: %B.decl = class_decl @B {} [template = constants.%B] +// CHECK:STDOUT: %D.decl = class_decl @D {} [template = constants.%D] +// CHECK:STDOUT: %F: = fn_decl @F.3 {} [template] +// CHECK:STDOUT: %.loc27: = fn_decl @.1 {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %F: = fn_decl @F.1 {} [template] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -57,7 +57,7 @@ fn D.C.F() {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %F: = fn_decl @F.2 {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/fail_base_modifiers.carbon b/toolchain/check/testdata/class/fail_base_modifiers.carbon index bcd887cce54f..2ca5f4c7a148 100644 --- a/toolchain/check/testdata/class/fail_base_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_base_modifiers.carbon @@ -63,11 +63,11 @@ class C4 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B = %B.decl, .C1 = %C1.decl, .C2 = %C2.decl, .C3 = %C3.decl, .C4 = %C4.decl} [template] -// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] -// CHECK:STDOUT: %C1.decl = class_decl @C1, () [template = constants.%C1] -// CHECK:STDOUT: %C2.decl = class_decl @C2, () [template = constants.%C2] -// CHECK:STDOUT: %C3.decl = class_decl @C3, () [template = constants.%C3] -// CHECK:STDOUT: %C4.decl = class_decl @C4, () [template = constants.%C4] +// CHECK:STDOUT: %B.decl = class_decl @B {} [template = constants.%B] +// CHECK:STDOUT: %C1.decl = class_decl @C1 {} [template = constants.%C1] +// CHECK:STDOUT: %C2.decl = class_decl @C2 {} [template = constants.%C2] +// CHECK:STDOUT: %C3.decl = class_decl @C3 {} [template = constants.%C3] +// CHECK:STDOUT: %C4.decl = class_decl @C4 {} [template = constants.%C4] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { diff --git a/toolchain/check/testdata/class/fail_base_no_extend.carbon b/toolchain/check/testdata/class/fail_base_no_extend.carbon index 353062026843..c76bc7d7446e 100644 --- a/toolchain/check/testdata/class/fail_base_no_extend.carbon +++ b/toolchain/check/testdata/class/fail_base_no_extend.carbon @@ -27,8 +27,8 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B = %B.decl, .C = %C.decl} [template] -// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %B.decl = class_decl @B {} [template = constants.%B] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { diff --git a/toolchain/check/testdata/class/fail_base_repeated.carbon b/toolchain/check/testdata/class/fail_base_repeated.carbon index a8b8833ec8ad..e25f8d7d3d2e 100644 --- a/toolchain/check/testdata/class/fail_base_repeated.carbon +++ b/toolchain/check/testdata/class/fail_base_repeated.carbon @@ -47,10 +47,10 @@ class D { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B1 = %B1.decl, .B2 = %B2.decl, .C = %C.decl, .D = %D.decl} [template] -// CHECK:STDOUT: %B1.decl = class_decl @B1, () [template = constants.%B1] -// CHECK:STDOUT: %B2.decl = class_decl @B2, () [template = constants.%B2] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %D.decl = class_decl @D, () [template = constants.%D] +// CHECK:STDOUT: %B1.decl = class_decl @B1 {} [template = constants.%B1] +// CHECK:STDOUT: %B2.decl = class_decl @B2 {} [template = constants.%B2] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %D.decl = class_decl @D {} [template = constants.%D] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B1 { diff --git a/toolchain/check/testdata/class/fail_base_unbound.carbon b/toolchain/check/testdata/class/fail_base_unbound.carbon index 05e329e3d837..8cc113c1b1b8 100644 --- a/toolchain/check/testdata/class/fail_base_unbound.carbon +++ b/toolchain/check/testdata/class/fail_base_unbound.carbon @@ -29,8 +29,8 @@ let b: B = C.base; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B = %B.decl, .C = %C.decl} [template] -// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %B.decl = class_decl @B {} [template = constants.%B] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] // CHECK:STDOUT: %B.ref: type = name_ref B, %B.decl [template = constants.%B] // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %base.ref: = name_ref base, @C.%.loc10 [template = @C.%.loc10] diff --git a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon index 61fcb7b7b8ec..e3d7b08816bf 100644 --- a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon +++ b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon @@ -25,8 +25,11 @@ fn Make() -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.C = %C.decl, .Make = %Make} [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %Make: = fn_decl @Make [template] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %Make: = fn_decl @Make { +// CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: @Make.%return: ref C = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { diff --git a/toolchain/check/testdata/class/fail_derived_to_base.carbon b/toolchain/check/testdata/class/fail_derived_to_base.carbon index ed2d7c576cbf..49b2ebb2ff72 100644 --- a/toolchain/check/testdata/class/fail_derived_to_base.carbon +++ b/toolchain/check/testdata/class/fail_derived_to_base.carbon @@ -54,12 +54,28 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A1 = %A1.decl, .A2 = %A2.decl, .B2 = %B2.decl, .ConvertUnrelated = %ConvertUnrelated, .Incomplete = %Incomplete.decl, .ConvertIncomplete = %ConvertIncomplete} [template] -// CHECK:STDOUT: %A1.decl = class_decl @A1, () [template = constants.%A1] -// CHECK:STDOUT: %A2.decl = class_decl @A2, () [template = constants.%A2] -// CHECK:STDOUT: %B2.decl = class_decl @B2, () [template = constants.%B2] -// CHECK:STDOUT: %ConvertUnrelated: = fn_decl @ConvertUnrelated [template] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] -// CHECK:STDOUT: %ConvertIncomplete: = fn_decl @ConvertIncomplete [template] +// CHECK:STDOUT: %A1.decl = class_decl @A1 {} [template = constants.%A1] +// CHECK:STDOUT: %A2.decl = class_decl @A2 {} [template = constants.%A2] +// CHECK:STDOUT: %B2.decl = class_decl @B2 {} [template = constants.%B2] +// CHECK:STDOUT: %ConvertUnrelated: = fn_decl @ConvertUnrelated { +// CHECK:STDOUT: %B2.ref: type = name_ref B2, %B2.decl [template = constants.%B2] +// CHECK:STDOUT: %.loc23_26: type = ptr_type B2 [template = constants.%.8] +// CHECK:STDOUT: %p.loc23_21.1: B2* = param p +// CHECK:STDOUT: @ConvertUnrelated.%p: B2* = bind_name p, %p.loc23_21.1 +// CHECK:STDOUT: %A1.ref: type = name_ref A1, %A1.decl [template = constants.%A1] +// CHECK:STDOUT: %.loc23_34: type = ptr_type A1 [template = constants.%.9] +// CHECK:STDOUT: %return.var.loc23: ref A1* = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete {} [template = constants.%Incomplete] +// CHECK:STDOUT: %ConvertIncomplete: = fn_decl @ConvertIncomplete { +// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] +// CHECK:STDOUT: %.loc30_35: type = ptr_type Incomplete [template = constants.%.13] +// CHECK:STDOUT: %p.loc30_22.1: Incomplete* = param p +// CHECK:STDOUT: @ConvertIncomplete.%p: Incomplete* = bind_name p, %p.loc30_22.1 +// CHECK:STDOUT: %A2.ref: type = name_ref A2, %A2.decl [template = constants.%A2] +// CHECK:STDOUT: %.loc30_43: type = ptr_type A2 [template = constants.%.14] +// CHECK:STDOUT: %return.var.loc30: ref A2* = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A1 { diff --git a/toolchain/check/testdata/class/fail_field_modifiers.carbon b/toolchain/check/testdata/class/fail_field_modifiers.carbon index acb86715975e..8e7969db7b68 100644 --- a/toolchain/check/testdata/class/fail_field_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_field_modifiers.carbon @@ -39,7 +39,7 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { diff --git a/toolchain/check/testdata/class/fail_import_misuses.carbon b/toolchain/check/testdata/class/fail_import_misuses.carbon index 728723c85784..c659bec1b73f 100644 --- a/toolchain/check/testdata/class/fail_import_misuses.carbon +++ b/toolchain/check/testdata/class/fail_import_misuses.carbon @@ -44,8 +44,8 @@ var a: Incomplete; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl, .Incomplete = %Incomplete.decl} [template] -// CHECK:STDOUT: %Empty.decl = class_decl @Empty, () [template = constants.%Empty] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %Empty.decl = class_decl @Empty {} [template = constants.%Empty] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete {} [template = constants.%Incomplete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Empty { @@ -68,8 +68,10 @@ var a: Incomplete; // CHECK:STDOUT: package: = namespace {.Empty = %import_ref.1, .Incomplete = %import_ref.2, .a = %a} [template] // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%Empty] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+4, used [template = constants.%Incomplete] -// CHECK:STDOUT: %.decl = class_decl @.1, () [template = constants.%.2] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %.decl = class_decl @.1 { +// CHECK:STDOUT: %Empty.decl = class_decl @Empty {} [template = constants.%Empty] +// CHECK:STDOUT: } [template = constants.%.2] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete {} [template = constants.%Incomplete] // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, %import_ref.2 [template = constants.%Incomplete] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index 37b5ecf74ddd..c4e481d8f033 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -126,20 +126,53 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .CallClassFunction = %CallClassFunction, .global_var = %global_var, .ConvertFromStruct = %ConvertFromStruct, .MemberAccess = %MemberAccess, .Copy = %Copy, .Let = %Let, .TakeIncomplete = %TakeIncomplete, .ReturnIncomplete = %ReturnIncomplete, .CallTakeIncomplete = %CallTakeIncomplete, .CallReturnIncomplete = %CallReturnIncomplete} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %.loc15: = fn_decl @.1 [template] -// CHECK:STDOUT: %CallClassFunction: = fn_decl @CallClassFunction [template] -// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %.loc15: = fn_decl @.1 {} [template] +// CHECK:STDOUT: %CallClassFunction: = fn_decl @CallClassFunction {} [template] +// CHECK:STDOUT: %Class.ref.loc33: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %global_var.var: ref = var global_var // CHECK:STDOUT: %global_var: ref = bind_name global_var, %global_var.var -// CHECK:STDOUT: %ConvertFromStruct: = fn_decl @ConvertFromStruct [template] -// CHECK:STDOUT: %MemberAccess: = fn_decl @MemberAccess [template] -// CHECK:STDOUT: %Copy: = fn_decl @Copy [template] -// CHECK:STDOUT: %Let: = fn_decl @Let [template] -// CHECK:STDOUT: %TakeIncomplete: = fn_decl @TakeIncomplete [template] -// CHECK:STDOUT: %ReturnIncomplete: = fn_decl @ReturnIncomplete [template] -// CHECK:STDOUT: %CallTakeIncomplete: = fn_decl @CallTakeIncomplete [template] -// CHECK:STDOUT: %CallReturnIncomplete: = fn_decl @CallReturnIncomplete [template] +// CHECK:STDOUT: %ConvertFromStruct: = fn_decl @ConvertFromStruct { +// CHECK:STDOUT: %Class.ref.loc41: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %return.var.loc41: ref Class = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %MemberAccess: = fn_decl @MemberAccess { +// CHECK:STDOUT: %Class.ref.loc48: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc48: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %p.loc48_17.1: Class* = param p +// CHECK:STDOUT: @MemberAccess.%p: Class* = bind_name p, %p.loc48_17.1 +// CHECK:STDOUT: %return.var.loc48: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Copy: = fn_decl @Copy { +// CHECK:STDOUT: %Class.ref.loc64_12: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc64: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %p.loc64_9.1: Class* = param p +// CHECK:STDOUT: @Copy.%p: Class* = bind_name p, %p.loc64_9.1 +// CHECK:STDOUT: %Class.ref.loc64_23: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %return.var.loc64: ref Class = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Let: = fn_decl @Let { +// CHECK:STDOUT: %Class.ref.loc68: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc68: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %p.loc68_8.1: Class* = param p +// CHECK:STDOUT: @Let.%p: Class* = bind_name p, %p.loc68_8.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %TakeIncomplete: = fn_decl @TakeIncomplete { +// CHECK:STDOUT: %Class.ref.loc78: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %c.loc78_19.1: Class = param c +// CHECK:STDOUT: @TakeIncomplete.%c: Class = bind_name c, %c.loc78_19.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %ReturnIncomplete: = fn_decl @ReturnIncomplete { +// CHECK:STDOUT: %Class.ref.loc88: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %return.var.loc88: ref Class = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %CallTakeIncomplete: = fn_decl @CallTakeIncomplete { +// CHECK:STDOUT: %Class.ref.loc90: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc90: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %p.loc90_23.1: Class* = param p +// CHECK:STDOUT: @CallTakeIncomplete.%p: Class* = bind_name p, %p.loc90_23.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %CallReturnIncomplete: = fn_decl @CallReturnIncomplete {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class; diff --git a/toolchain/check/testdata/class/fail_init.carbon b/toolchain/check/testdata/class/fail_init.carbon index 6bf15b6ec260..2a7167d5debb 100644 --- a/toolchain/check/testdata/class/fail_init.carbon +++ b/toolchain/check/testdata/class/fail_init.carbon @@ -41,8 +41,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .F = %F} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { diff --git a/toolchain/check/testdata/class/fail_init_as_inplace.carbon b/toolchain/check/testdata/class/fail_init_as_inplace.carbon index 41479352a8bd..7509408d9e87 100644 --- a/toolchain/check/testdata/class/fail_init_as_inplace.carbon +++ b/toolchain/check/testdata/class/fail_init_as_inplace.carbon @@ -38,9 +38,14 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .G = %G, .F = %F} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc12: type = ptr_type Class [template = constants.%.3] +// CHECK:STDOUT: %p.loc12_6.1: Class* = param p +// CHECK:STDOUT: @G.%p: Class* = bind_name p, %p.loc12_6.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { diff --git a/toolchain/check/testdata/class/fail_memaccess_category.carbon b/toolchain/check/testdata/class/fail_memaccess_category.carbon index 9605dba6fab0..94c19c4ebe1e 100644 --- a/toolchain/check/testdata/class/fail_memaccess_category.carbon +++ b/toolchain/check/testdata/class/fail_memaccess_category.carbon @@ -50,13 +50,27 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl, .B = %B.decl, .F = %F} [template] -// CHECK:STDOUT: %A.decl = class_decl @A, () [template = constants.%A] -// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %A.decl = class_decl @A {} [template = constants.%A] +// CHECK:STDOUT: %B.decl = class_decl @B {} [template = constants.%B] +// CHECK:STDOUT: %F: = fn_decl @F.2 { +// CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] +// CHECK:STDOUT: %.loc15: type = struct_type {.a: A} [template = constants.%.6] +// CHECK:STDOUT: %s.loc15_6.1: {.a: A} = param s +// CHECK:STDOUT: @F.2.%s: {.a: A} = bind_name s, %s.loc15_6.1 +// CHECK:STDOUT: %B.ref: type = name_ref B, %B.decl [template = constants.%B] +// CHECK:STDOUT: %b.loc15_18.1: B = param b +// CHECK:STDOUT: @F.2.%b: B = bind_name b, %b.loc15_18.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] +// CHECK:STDOUT: %F: = fn_decl @F.1 { +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] +// CHECK:STDOUT: %.loc8_20: type = ptr_type A [template = constants.%.1] +// CHECK:STDOUT: %self.loc8_13.1: A* = param self +// CHECK:STDOUT: %self.loc8_13.3: A* = bind_name self, %self.loc8_13.1 +// CHECK:STDOUT: %.loc8_8: A* = addr_pattern %self.loc8_13.3 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -70,7 +84,7 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: .a = %.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.1[addr %self: A*](); +// CHECK:STDOUT: fn @F.1[addr @A.%self.loc8_13.3: A*](); // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2(%s: {.a: A}, %b: B) { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/class/fail_member_of_let.carbon b/toolchain/check/testdata/class/fail_member_of_let.carbon index ee28258e2c1a..e9b55baa16fb 100644 --- a/toolchain/check/testdata/class/fail_member_of_let.carbon +++ b/toolchain/check/testdata/class/fail_member_of_let.carbon @@ -27,14 +27,16 @@ fn T.F() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] // CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %T: type = bind_name T, %Class.ref -// CHECK:STDOUT: %.loc19: = fn_decl @.1 [template] +// CHECK:STDOUT: %.loc19: = fn_decl @.1 {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/fail_method.carbon b/toolchain/check/testdata/class/fail_method.carbon index 6fb83cd29430..1f69d396f5ae 100644 --- a/toolchain/check/testdata/class/fail_method.carbon +++ b/toolchain/check/testdata/class/fail_method.carbon @@ -51,16 +51,24 @@ fn F(c: Class) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .A = %A, .F = %F} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc12: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %WithSelf.ref: = name_ref WithSelf, @Class.%WithSelf [template = @Class.%WithSelf] // CHECK:STDOUT: %A: = bind_alias A, @Class.%WithSelf [template = @Class.%WithSelf] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Class.ref.loc14: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %c.loc14_6.1: Class = param c +// CHECK:STDOUT: @F.%c: Class = bind_name c, %c.loc14_6.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %NoSelf: = fn_decl @NoSelf [template] -// CHECK:STDOUT: %WithSelf: = fn_decl @WithSelf [template] +// CHECK:STDOUT: %NoSelf: = fn_decl @NoSelf {} [template] +// CHECK:STDOUT: %WithSelf: = fn_decl @WithSelf { +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc9_15.1: Class = param self +// CHECK:STDOUT: %self.loc9_15.2: Class = bind_name self, %self.loc9_15.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .NoSelf = %NoSelf @@ -69,7 +77,7 @@ fn F(c: Class) { // CHECK:STDOUT: // CHECK:STDOUT: fn @NoSelf(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @WithSelf[%self: Class](); +// CHECK:STDOUT: fn @WithSelf[@Class.%self.loc9_15.2: Class](); // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%c: Class) { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/class/fail_method_modifiers.carbon b/toolchain/check/testdata/class/fail_method_modifiers.carbon index 2fd287b9aef0..2adec95f0dd3 100644 --- a/toolchain/check/testdata/class/fail_method_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_method_modifiers.carbon @@ -58,14 +58,22 @@ base class BaseClass { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.FinalClass = %FinalClass.decl, .AbstractClass = %AbstractClass.decl, .BaseClass = %BaseClass.decl} [template] -// CHECK:STDOUT: %FinalClass.decl = class_decl @FinalClass, () [template = constants.%FinalClass] -// CHECK:STDOUT: %AbstractClass.decl = class_decl @AbstractClass, () [template = constants.%AbstractClass] -// CHECK:STDOUT: %BaseClass.decl = class_decl @BaseClass, () [template = constants.%BaseClass] +// CHECK:STDOUT: %FinalClass.decl = class_decl @FinalClass {} [template = constants.%FinalClass] +// CHECK:STDOUT: %AbstractClass.decl = class_decl @AbstractClass {} [template = constants.%AbstractClass] +// CHECK:STDOUT: %BaseClass.decl = class_decl @BaseClass {} [template = constants.%BaseClass] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @FinalClass { -// CHECK:STDOUT: %Abstract: = fn_decl @Abstract.1 [template] -// CHECK:STDOUT: %Virtual: = fn_decl @Virtual [template] +// CHECK:STDOUT: %Abstract: = fn_decl @Abstract.1 { +// CHECK:STDOUT: %Self.ref.loc15: type = name_ref Self, constants.%FinalClass [template = constants.%FinalClass] +// CHECK:STDOUT: %self.loc15_24.1: FinalClass = param self +// CHECK:STDOUT: %self.loc15_24.2: FinalClass = bind_name self, %self.loc15_24.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Virtual: = fn_decl @Virtual { +// CHECK:STDOUT: %Self.ref.loc23: type = name_ref Self, constants.%FinalClass [template = constants.%FinalClass] +// CHECK:STDOUT: %self.loc23_22.1: FinalClass = param self +// CHECK:STDOUT: %self.loc23_22.2: FinalClass = bind_name self, %self.loc23_22.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Abstract = %Abstract @@ -73,8 +81,16 @@ base class BaseClass { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AbstractClass { -// CHECK:STDOUT: %Default: = fn_decl @Default [template] -// CHECK:STDOUT: %Final: = fn_decl @Final [template] +// CHECK:STDOUT: %Default: = fn_decl @Default { +// CHECK:STDOUT: %Self.ref.loc31: type = name_ref Self, constants.%AbstractClass [template = constants.%AbstractClass] +// CHECK:STDOUT: %self.loc31_22.1: AbstractClass = param self +// CHECK:STDOUT: %self.loc31_22.2: AbstractClass = bind_name self, %self.loc31_22.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Final: = fn_decl @Final { +// CHECK:STDOUT: %Self.ref.loc36: type = name_ref Self, constants.%AbstractClass [template = constants.%AbstractClass] +// CHECK:STDOUT: %self.loc36_18.1: AbstractClass = param self +// CHECK:STDOUT: %self.loc36_18.2: AbstractClass = bind_name self, %self.loc36_18.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Default = %Default @@ -82,19 +98,23 @@ base class BaseClass { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @BaseClass { -// CHECK:STDOUT: %Abstract: = fn_decl @Abstract.2 [template] +// CHECK:STDOUT: %Abstract: = fn_decl @Abstract.2 { +// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%BaseClass [template = constants.%BaseClass] +// CHECK:STDOUT: %self.loc47_24.1: BaseClass = param self +// CHECK:STDOUT: %self.loc47_24.2: BaseClass = bind_name self, %self.loc47_24.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Abstract = %Abstract // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Abstract.1[%self: FinalClass](); +// CHECK:STDOUT: fn @Abstract.1[@FinalClass.%self.loc15_24.2: FinalClass](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Virtual[%self: FinalClass](); +// CHECK:STDOUT: fn @Virtual[@FinalClass.%self.loc23_22.2: FinalClass](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Default[%self: AbstractClass](); +// CHECK:STDOUT: fn @Default[@AbstractClass.%self.loc31_22.2: AbstractClass](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Final[%self: AbstractClass](); +// CHECK:STDOUT: fn @Final[@AbstractClass.%self.loc36_18.2: AbstractClass](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Abstract.2[%self: BaseClass](); +// CHECK:STDOUT: fn @Abstract.2[@BaseClass.%self.loc47_24.2: BaseClass](); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_modifiers.carbon b/toolchain/check/testdata/class/fail_modifiers.carbon index 354b6275e125..5d1e5f5031f7 100644 --- a/toolchain/check/testdata/class/fail_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_modifiers.carbon @@ -78,12 +78,12 @@ abstract base class AbstractAndBase {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.DuplicatePrivate = %DuplicatePrivate.decl, .TwoAccess = %TwoAccess.decl, .TwoAbstract = %TwoAbstract.decl, .Virtual = %Virtual.decl, .WrongOrder = %WrongOrder.decl, .AbstractAndBase = %AbstractAndBase.decl} [template] -// CHECK:STDOUT: %DuplicatePrivate.decl = class_decl @DuplicatePrivate, () [template = constants.%DuplicatePrivate] -// CHECK:STDOUT: %TwoAccess.decl = class_decl @TwoAccess, () [template = constants.%TwoAccess] -// CHECK:STDOUT: %TwoAbstract.decl = class_decl @TwoAbstract, () [template = constants.%TwoAbstract] -// CHECK:STDOUT: %Virtual.decl = class_decl @Virtual, () [template = constants.%Virtual] -// CHECK:STDOUT: %WrongOrder.decl = class_decl @WrongOrder, () [template = constants.%WrongOrder] -// CHECK:STDOUT: %AbstractAndBase.decl = class_decl @AbstractAndBase, () [template = constants.%AbstractAndBase] +// CHECK:STDOUT: %DuplicatePrivate.decl = class_decl @DuplicatePrivate {} [template = constants.%DuplicatePrivate] +// CHECK:STDOUT: %TwoAccess.decl = class_decl @TwoAccess {} [template = constants.%TwoAccess] +// CHECK:STDOUT: %TwoAbstract.decl = class_decl @TwoAbstract {} [template = constants.%TwoAbstract] +// CHECK:STDOUT: %Virtual.decl = class_decl @Virtual {} [template = constants.%Virtual] +// CHECK:STDOUT: %WrongOrder.decl = class_decl @WrongOrder {} [template = constants.%WrongOrder] +// CHECK:STDOUT: %AbstractAndBase.decl = class_decl @AbstractAndBase {} [template = constants.%AbstractAndBase] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DuplicatePrivate; diff --git a/toolchain/check/testdata/class/fail_out_of_line_decl.carbon b/toolchain/check/testdata/class/fail_out_of_line_decl.carbon index 273ce3d3f524..3b3557ef115a 100644 --- a/toolchain/check/testdata/class/fail_out_of_line_decl.carbon +++ b/toolchain/check/testdata/class/fail_out_of_line_decl.carbon @@ -20,8 +20,8 @@ fn C.F() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.C = %C.decl} [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { diff --git a/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon b/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon index 6ca4c2dcc3f2..0b2f97cb9f80 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon @@ -89,21 +89,21 @@ base class G; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl.loc7, .B = %B.decl.loc16, .C = %C.decl.loc25, .D = %D.decl.loc34, .E = %E.decl.loc43, .F = %F.decl.loc52, .G = %G.decl.loc61} [template] -// CHECK:STDOUT: %A.decl.loc7 = class_decl @A, () [template = constants.%A] -// CHECK:STDOUT: %A.decl.loc14 = class_decl @A, () [template = constants.%A] -// CHECK:STDOUT: %B.decl.loc16 = class_decl @B, () [template = constants.%B] -// CHECK:STDOUT: %B.decl.loc23 = class_decl @B, () [template = constants.%B] -// CHECK:STDOUT: %C.decl.loc25 = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %C.decl.loc32 = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %D.decl.loc34 = class_decl @D, () [template = constants.%D] -// CHECK:STDOUT: %D.decl.loc41 = class_decl @D, () [template = constants.%D] -// CHECK:STDOUT: %E.decl.loc43 = class_decl @E, () [template = constants.%E] -// CHECK:STDOUT: %E.decl.loc50 = class_decl @E, () [template = constants.%E] -// CHECK:STDOUT: %F.decl.loc52 = class_decl @F, () [template = constants.%F] -// CHECK:STDOUT: %F.decl.loc59 = class_decl @F, () [template = constants.%F] -// CHECK:STDOUT: %G.decl.loc61 = class_decl @G, () [template = constants.%G] -// CHECK:STDOUT: %G.decl.loc68 = class_decl @G, () [template = constants.%G] -// CHECK:STDOUT: %G.decl.loc75 = class_decl @G, () [template = constants.%G] +// CHECK:STDOUT: %A.decl.loc7 = class_decl @A {} [template = constants.%A] +// CHECK:STDOUT: %A.decl.loc14 = class_decl @A {} [template = constants.%A] +// CHECK:STDOUT: %B.decl.loc16 = class_decl @B {} [template = constants.%B] +// CHECK:STDOUT: %B.decl.loc23 = class_decl @B {} [template = constants.%B] +// CHECK:STDOUT: %C.decl.loc25 = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %C.decl.loc32 = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %D.decl.loc34 = class_decl @D {} [template = constants.%D] +// CHECK:STDOUT: %D.decl.loc41 = class_decl @D {} [template = constants.%D] +// CHECK:STDOUT: %E.decl.loc43 = class_decl @E {} [template = constants.%E] +// CHECK:STDOUT: %E.decl.loc50 = class_decl @E {} [template = constants.%E] +// CHECK:STDOUT: %F.decl.loc52 = class_decl @F {} [template = constants.%F] +// CHECK:STDOUT: %F.decl.loc59 = class_decl @F {} [template = constants.%F] +// CHECK:STDOUT: %G.decl.loc61 = class_decl @G {} [template = constants.%G] +// CHECK:STDOUT: %G.decl.loc68 = class_decl @G {} [template = constants.%G] +// CHECK:STDOUT: %G.decl.loc75 = class_decl @G {} [template = constants.%G] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { diff --git a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon index b57030af018f..16203e3a6d99 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon @@ -36,29 +36,29 @@ class Y { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl.loc7, .X = %X.decl, .Y = %Y.decl} [template] -// CHECK:STDOUT: %A.decl.loc7 = class_decl @A.1, () [template = constants.%A.1] -// CHECK:STDOUT: %X.decl = class_decl @X, () [template = constants.%X] -// CHECK:STDOUT: %A.decl.loc15 = class_decl @A.1, () [template = constants.%A.1] -// CHECK:STDOUT: %Y.decl = class_decl @Y, () [template = constants.%Y] +// CHECK:STDOUT: %A.decl.loc7 = class_decl @A.1 {} [template = constants.%A.1] +// CHECK:STDOUT: %X.decl = class_decl @X {} [template = constants.%X] +// CHECK:STDOUT: %A.decl.loc15 = class_decl @A.1 {} [template = constants.%A.1] +// CHECK:STDOUT: %Y.decl = class_decl @Y {} [template = constants.%Y] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A.1 { -// CHECK:STDOUT: %B.decl = class_decl @B.2, () [template = constants.%B.2] +// CHECK:STDOUT: %B.decl = class_decl @B.2 {} [template = constants.%B.2] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @X { -// CHECK:STDOUT: %A.decl = class_decl @A.2, () [template = constants.%A.2] -// CHECK:STDOUT: %B.decl = class_decl @B.1, () [template = constants.%B.1] +// CHECK:STDOUT: %A.decl = class_decl @A.2 {} [template = constants.%A.2] +// CHECK:STDOUT: %B.decl = class_decl @B.1 {} [template = constants.%B.1] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A.2 { -// CHECK:STDOUT: %B.decl = class_decl @B.1, () [template = constants.%B.1] +// CHECK:STDOUT: %B.decl = class_decl @B.1 {} [template = constants.%B.1] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .B = %B.decl @@ -72,7 +72,7 @@ class Y { // CHECK:STDOUT: class @B.2; // CHECK:STDOUT: // CHECK:STDOUT: class @Y { -// CHECK:STDOUT: %.decl = class_decl @.1, () [template = constants.%.2] +// CHECK:STDOUT: %.decl = class_decl @.1 {} [template = constants.%.2] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_redefinition.carbon b/toolchain/check/testdata/class/fail_redefinition.carbon index ed905eb2eee3..5dd4c8215f20 100644 --- a/toolchain/check/testdata/class/fail_redefinition.carbon +++ b/toolchain/check/testdata/class/fail_redefinition.carbon @@ -33,16 +33,16 @@ fn Class.H() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl.loc7} [template] -// CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %Class.decl.loc18 = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %H: = fn_decl @H [template] +// CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %Class.decl.loc18 = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] +// CHECK:STDOUT: %H: = fn_decl @H {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %H: = fn_decl @H [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] +// CHECK:STDOUT: %H: = fn_decl @H {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = diff --git a/toolchain/check/testdata/class/fail_reorder.carbon b/toolchain/check/testdata/class/fail_reorder.carbon index b44d24060e72..2b603ed3eb74 100644 --- a/toolchain/check/testdata/class/fail_reorder.carbon +++ b/toolchain/check/testdata/class/fail_reorder.carbon @@ -35,12 +35,16 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var.loc23: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .G = %G diff --git a/toolchain/check/testdata/class/fail_scope.carbon b/toolchain/check/testdata/class/fail_scope.carbon index e7d7547f898b..97882299651c 100644 --- a/toolchain/check/testdata/class/fail_scope.carbon +++ b/toolchain/check/testdata/class/fail_scope.carbon @@ -27,12 +27,16 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .G = %G} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/fail_self.carbon b/toolchain/check/testdata/class/fail_self.carbon index 33cc8b67c69b..91e485df2e40 100644 --- a/toolchain/check/testdata/class/fail_self.carbon +++ b/toolchain/check/testdata/class/fail_self.carbon @@ -62,16 +62,34 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .WrongSelf = %WrongSelf.decl, .CallWrongSelf = %CallWrongSelf} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %WrongSelf.decl = class_decl @WrongSelf, () [template = constants.%WrongSelf] -// CHECK:STDOUT: %CallWrongSelf: = fn_decl @CallWrongSelf [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F.1 { +// CHECK:STDOUT: %Class.ref.loc25: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc25_12.1: Class = param self +// CHECK:STDOUT: @F.1.%self: Class = bind_name self, %self.loc25_12.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Class.ref.loc28: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: @G.%return: ref Class = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %WrongSelf.decl = class_decl @WrongSelf {} [template = constants.%WrongSelf] +// CHECK:STDOUT: %CallWrongSelf: = fn_decl @CallWrongSelf { +// CHECK:STDOUT: %WrongSelf.ref: type = name_ref WrongSelf, %WrongSelf.decl [template = constants.%WrongSelf] +// CHECK:STDOUT: %ws.loc43_18.1: WrongSelf = param ws +// CHECK:STDOUT: @CallWrongSelf.%ws: WrongSelf = bind_name ws, %ws.loc43_18.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F.1 { +// CHECK:STDOUT: %Class.ref.loc11: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc11_8.1: Class = param self +// CHECK:STDOUT: %self.loc11_8.2: Class = bind_name self, %self.loc11_8.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Class.ref.loc19: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %return.var: ref Class = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -79,7 +97,11 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @WrongSelf { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %F: = fn_decl @F.2 { +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc40_8.1: Class = param self +// CHECK:STDOUT: %self.loc40_8.2: Class = bind_name self, %self.loc40_8.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -100,7 +122,7 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2[%self: Class](); +// CHECK:STDOUT: fn @F.2[@WrongSelf.%self.loc40_8.2: Class](); // CHECK:STDOUT: // CHECK:STDOUT: fn @CallWrongSelf(%ws: WrongSelf) { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/class/fail_todo_generic.carbon b/toolchain/check/testdata/class/fail_todo_generic.carbon index 02a72c45e1ad..7352c08c2c8e 100644 --- a/toolchain/check/testdata/class/fail_todo_generic.carbon +++ b/toolchain/check/testdata/class/fail_todo_generic.carbon @@ -20,7 +20,7 @@ class C[](); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.C = %C.decl} [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C; diff --git a/toolchain/check/testdata/class/fail_todo_generic_method.carbon b/toolchain/check/testdata/class/fail_todo_generic_method.carbon index fe31bdafbeef..a86bbc9e803d 100644 --- a/toolchain/check/testdata/class/fail_todo_generic_method.carbon +++ b/toolchain/check/testdata/class/fail_todo_generic_method.carbon @@ -33,21 +33,34 @@ fn Class(T:! type).F[self: Self](n: T) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, (, ) [template = constants.%Class] -// CHECK:STDOUT: %.loc24: = fn_decl @.1 [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class { +// CHECK:STDOUT: %T.loc10_13.1: type = param T +// CHECK:STDOUT: %T.loc10_13.2: type = bind_symbolic_name T, %T.loc10_13.1 [symbolic] +// CHECK:STDOUT: } [template = constants.%Class] +// CHECK:STDOUT: %.loc24: = fn_decl @.1 { +// CHECK:STDOUT: %T.loc24_10.1: type = param T +// CHECK:STDOUT: @.1.%T: type = bind_symbolic_name T, %T.loc24_10.1 [symbolic] +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %T.ref: type = name_ref T, [symbolic = ] +// CHECK:STDOUT: %T.ref.loc11: type = name_ref T, file.%T.loc10_13.2 [symbolic = file.%T.loc10_13.2] // CHECK:STDOUT: %.loc11: = field_decl a, element0 [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %self.loc12_8.1: Class = param self +// CHECK:STDOUT: %self.loc12_8.2: Class = bind_name self, %self.loc12_8.1 +// CHECK:STDOUT: %T.ref.loc12: type = name_ref T, file.%T.loc10_13.2 [symbolic = file.%T.loc10_13.2] +// CHECK:STDOUT: %n.loc12_20.1: T = param n +// CHECK:STDOUT: %n.loc12_20.2: T = bind_name n, %n.loc12_20.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %.loc11 // CHECK:STDOUT: .F = %F // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F[%self: Class](%n: T); +// CHECK:STDOUT: fn @F[@Class.%self.loc12_8.2: Class](@Class.%n.loc12_20.2: T); // CHECK:STDOUT: // CHECK:STDOUT: fn @.1(%T: type); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_todo_import_forward_decl.carbon b/toolchain/check/testdata/class/fail_todo_import_forward_decl.carbon index 376270bb42d0..e4e2ebe9a560 100644 --- a/toolchain/check/testdata/class/fail_todo_import_forward_decl.carbon +++ b/toolchain/check/testdata/class/fail_todo_import_forward_decl.carbon @@ -34,7 +34,7 @@ class ForwardDecl { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.ForwardDecl = %ForwardDecl.decl} [template] -// CHECK:STDOUT: %ForwardDecl.decl = class_decl @ForwardDecl, () [template = constants.%ForwardDecl] +// CHECK:STDOUT: %ForwardDecl.decl = class_decl @ForwardDecl {} [template = constants.%ForwardDecl] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDecl; @@ -50,7 +50,9 @@ class ForwardDecl { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.ForwardDecl = %import_ref} [template] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%ForwardDecl] -// CHECK:STDOUT: %.decl = class_decl @.1, () [template = constants.%.1] +// CHECK:STDOUT: %.decl = class_decl @.1 { +// CHECK:STDOUT: %ForwardDecl.decl = class_decl @ForwardDecl {} [template = constants.%ForwardDecl] +// CHECK:STDOUT: } [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDecl; diff --git a/toolchain/check/testdata/class/fail_todo_modifiers.carbon b/toolchain/check/testdata/class/fail_todo_modifiers.carbon index 64167fe41d56..a4593e7dc66b 100644 --- a/toolchain/check/testdata/class/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_todo_modifiers.carbon @@ -71,14 +71,14 @@ abstract class Abstract { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Access = %Access.decl, .Base = %Base.decl, .Abstract = %Abstract.decl} [template] -// CHECK:STDOUT: %Access.decl = class_decl @Access, () [template = constants.%Access] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] -// CHECK:STDOUT: %Abstract.decl = class_decl @Abstract, () [template = constants.%Abstract] +// CHECK:STDOUT: %Access.decl = class_decl @Access {} [template = constants.%Access] +// CHECK:STDOUT: %Base.decl = class_decl @Base {} [template = constants.%Base] +// CHECK:STDOUT: %Abstract.decl = class_decl @Abstract {} [template = constants.%Abstract] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Access { -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] // CHECK:STDOUT: %.loc22: = field_decl k, element0 [template] // CHECK:STDOUT: %.loc27: = field_decl l, element1 [template] // CHECK:STDOUT: @@ -90,8 +90,8 @@ abstract class Abstract { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %H: = fn_decl @H [template] -// CHECK:STDOUT: %I: = fn_decl @I [template] +// CHECK:STDOUT: %H: = fn_decl @H {} [template] +// CHECK:STDOUT: %I: = fn_decl @I {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .H = %H @@ -99,9 +99,9 @@ abstract class Abstract { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Abstract { -// CHECK:STDOUT: %J: = fn_decl @J [template] -// CHECK:STDOUT: %K: = fn_decl @K [template] -// CHECK:STDOUT: %L: = fn_decl @L [template] +// CHECK:STDOUT: %J: = fn_decl @J {} [template] +// CHECK:STDOUT: %K: = fn_decl @K {} [template] +// CHECK:STDOUT: %L: = fn_decl @L {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .J = %J diff --git a/toolchain/check/testdata/class/fail_unbound_field.carbon b/toolchain/check/testdata/class/fail_unbound_field.carbon index fced53c83312..af9a1da897b8 100644 --- a/toolchain/check/testdata/class/fail_unbound_field.carbon +++ b/toolchain/check/testdata/class/fail_unbound_field.carbon @@ -31,13 +31,17 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .G = %G} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %.loc8: = field_decl field, element0 [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .field = %.loc8 diff --git a/toolchain/check/testdata/class/fail_unknown_member.carbon b/toolchain/check/testdata/class/fail_unknown_member.carbon index 4d42cf08a2b7..fe13ff349b25 100644 --- a/toolchain/check/testdata/class/fail_unknown_member.carbon +++ b/toolchain/check/testdata/class/fail_unknown_member.carbon @@ -27,8 +27,13 @@ fn G(c: Class) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .G = %G} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %c.loc11_6.1: Class = param c +// CHECK:STDOUT: @G.%c: Class = bind_name c, %c.loc11_6.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { diff --git a/toolchain/check/testdata/class/field_access.carbon b/toolchain/check/testdata/class/field_access.carbon index 4ffd2dcd1727..0ab6658fdcdc 100644 --- a/toolchain/check/testdata/class/field_access.carbon +++ b/toolchain/check/testdata/class/field_access.carbon @@ -30,8 +30,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .Run = %Run} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %Run: = fn_decl @Run {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { diff --git a/toolchain/check/testdata/class/field_access_in_value.carbon b/toolchain/check/testdata/class/field_access_in_value.carbon index 86addcce7ba2..db7928b40b15 100644 --- a/toolchain/check/testdata/class/field_access_in_value.carbon +++ b/toolchain/check/testdata/class/field_access_in_value.carbon @@ -31,8 +31,8 @@ fn Test() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .Test = %Test} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %Test: = fn_decl @Test [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %Test: = fn_decl @Test {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { diff --git a/toolchain/check/testdata/class/forward_declared.carbon b/toolchain/check/testdata/class/forward_declared.carbon index 351bb3f2ce9a..5327604a5f2e 100644 --- a/toolchain/check/testdata/class/forward_declared.carbon +++ b/toolchain/check/testdata/class/forward_declared.carbon @@ -17,8 +17,16 @@ fn F(p: Class*) -> Class* { return p; } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .F = %F} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Class.ref.loc9_9: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc9_14: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %p.loc9_6.1: Class* = param p +// CHECK:STDOUT: @F.%p: Class* = bind_name p, %p.loc9_6.1 +// CHECK:STDOUT: %Class.ref.loc9_20: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc9_25: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %return.var: ref Class* = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class; diff --git a/toolchain/check/testdata/class/import.carbon b/toolchain/check/testdata/class/import.carbon index bc00541f6380..57d23d81ef0e 100644 --- a/toolchain/check/testdata/class/import.carbon +++ b/toolchain/check/testdata/class/import.carbon @@ -60,11 +60,11 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl, .Field = %Field.decl, .ForwardDeclared = %ForwardDeclared.decl.loc11, .Incomplete = %Incomplete.decl} [template] -// CHECK:STDOUT: %Empty.decl = class_decl @Empty, () [template = constants.%Empty] -// CHECK:STDOUT: %Field.decl = class_decl @Field, () [template = constants.%Field] -// CHECK:STDOUT: %ForwardDeclared.decl.loc11 = class_decl @ForwardDeclared, () [template = constants.%ForwardDeclared] -// CHECK:STDOUT: %ForwardDeclared.decl.loc13 = class_decl @ForwardDeclared, () [template = constants.%ForwardDeclared] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %Empty.decl = class_decl @Empty {} [template = constants.%Empty] +// CHECK:STDOUT: %Field.decl = class_decl @Field {} [template = constants.%Field] +// CHECK:STDOUT: %ForwardDeclared.decl.loc11 = class_decl @ForwardDeclared {} [template = constants.%ForwardDeclared] +// CHECK:STDOUT: %ForwardDeclared.decl.loc13 = class_decl @ForwardDeclared {} [template = constants.%ForwardDeclared] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete {} [template = constants.%Incomplete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Empty { @@ -80,8 +80,18 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDeclared { -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Self.ref.loc14: type = name_ref Self, constants.%ForwardDeclared [template = constants.%ForwardDeclared] +// CHECK:STDOUT: %self.loc14_8.1: ForwardDeclared = param self +// CHECK:STDOUT: %self.loc14_8.2: ForwardDeclared = bind_name self, %self.loc14_8.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Self.ref.loc15: type = name_ref Self, constants.%ForwardDeclared [template = constants.%ForwardDeclared] +// CHECK:STDOUT: %.loc15_23: type = ptr_type ForwardDeclared [template = constants.%.4] +// CHECK:STDOUT: %self.loc15_13.1: ForwardDeclared* = param self +// CHECK:STDOUT: %self.loc15_13.3: ForwardDeclared* = bind_name self, %self.loc15_13.1 +// CHECK:STDOUT: %.loc15_8: ForwardDeclared* = addr_pattern %self.loc15_13.3 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -90,9 +100,9 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: class @Incomplete; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F[%self: ForwardDeclared](); +// CHECK:STDOUT: fn @F[@ForwardDeclared.%self.loc14_8.2: ForwardDeclared](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @G[addr %self: ForwardDeclared*](); +// CHECK:STDOUT: fn @G[addr @ForwardDeclared.%self.loc15_13.3: ForwardDeclared*](); // CHECK:STDOUT: // CHECK:STDOUT: --- b.carbon // CHECK:STDOUT: @@ -122,7 +132,7 @@ fn Run() { // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+4, used [template = constants.%Field] // CHECK:STDOUT: %import_ref.3: type = import_ref ir1, inst+11, used [template = constants.%ForwardDeclared] // CHECK:STDOUT: %import_ref.4: type = import_ref ir1, inst+25, used [template = constants.%Incomplete] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Run: = fn_decl @Run {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Empty { @@ -150,7 +160,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Empty.decl = class_decl @Empty, () [template = constants.%Empty] +// CHECK:STDOUT: %Empty.decl = class_decl @Empty {} [template = constants.%Empty] // CHECK:STDOUT: %Empty.ref: type = name_ref Empty, file.%import_ref.1 [template = constants.%Empty] // CHECK:STDOUT: %a.var: ref Empty = var a // CHECK:STDOUT: %a: ref Empty = bind_name a, %a.var @@ -158,7 +168,7 @@ fn Run() { // CHECK:STDOUT: %.loc7_19.2: init Empty = class_init (), %a.var [template = constants.%.4] // CHECK:STDOUT: %.loc7_19.3: init Empty = converted %.loc7_19.1, %.loc7_19.2 [template = constants.%.4] // CHECK:STDOUT: assign %a.var, %.loc7_19.3 -// CHECK:STDOUT: %Field.decl = class_decl @Field, () [template = constants.%Field] +// CHECK:STDOUT: %Field.decl = class_decl @Field {} [template = constants.%Field] // CHECK:STDOUT: %Field.ref: type = name_ref Field, file.%import_ref.2 [template = constants.%Field] // CHECK:STDOUT: %b.var: ref Field = var b // CHECK:STDOUT: %b: ref Field = bind_name b, %b.var @@ -173,7 +183,7 @@ fn Run() { // CHECK:STDOUT: %.loc10_4: ref i32 = class_element_access %b.ref, element0 // CHECK:STDOUT: %.loc10_9: i32 = int_literal 2 [template = constants.%.10] // CHECK:STDOUT: assign %.loc10_4, %.loc10_9 -// CHECK:STDOUT: %ForwardDeclared.decl = class_decl @ForwardDeclared, () [template = constants.%ForwardDeclared] +// CHECK:STDOUT: %ForwardDeclared.decl = class_decl @ForwardDeclared {} [template = constants.%ForwardDeclared] // CHECK:STDOUT: %ForwardDeclared.ref.loc12: type = name_ref ForwardDeclared, file.%import_ref.3 [template = constants.%ForwardDeclared] // CHECK:STDOUT: %c.var: ref ForwardDeclared = var c // CHECK:STDOUT: %c: ref ForwardDeclared = bind_name c, %c.var @@ -196,7 +206,7 @@ fn Run() { // CHECK:STDOUT: %c.ref.loc16: ref ForwardDeclared = name_ref c, %c // CHECK:STDOUT: %.loc16_29: ForwardDeclared* = addr_of %c.ref.loc16 // CHECK:STDOUT: assign %d.var, %.loc16_29 -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete {} [template = constants.%Incomplete] // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%import_ref.4 [template = constants.%Incomplete] // CHECK:STDOUT: %.loc18: type = ptr_type Incomplete [template = constants.%.13] // CHECK:STDOUT: %e.var: ref Incomplete* = var e diff --git a/toolchain/check/testdata/class/import_base.carbon b/toolchain/check/testdata/class/import_base.carbon index 8bbb1e83caa1..65f8387afd3c 100644 --- a/toolchain/check/testdata/class/import_base.carbon +++ b/toolchain/check/testdata/class/import_base.carbon @@ -46,13 +46,21 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Child = %Child.decl} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] -// CHECK:STDOUT: %Child.decl = class_decl @Child, () [template = constants.%Child] +// CHECK:STDOUT: %Base.decl = class_decl @Base {} [template = constants.%Base] +// CHECK:STDOUT: %Child.decl = class_decl @Child {} [template = constants.%Child] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %Unused: = fn_decl @Unused [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Self.ref.loc5: type = name_ref Self, constants.%Base [template = constants.%Base] +// CHECK:STDOUT: %self.loc5_8.1: Base = param self +// CHECK:STDOUT: %self.loc5_8.2: Base = bind_name self, %self.loc5_8.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Unused: = fn_decl @Unused { +// CHECK:STDOUT: %Self.ref.loc6: type = name_ref Self, constants.%Base [template = constants.%Base] +// CHECK:STDOUT: %self.loc6_13.1: Base = param self +// CHECK:STDOUT: %self.loc6_13.2: Base = bind_name self, %self.loc6_13.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %.loc8: = field_decl x, element0 [template] // CHECK:STDOUT: %.loc9: = field_decl unused, element1 [template] // CHECK:STDOUT: @@ -72,9 +80,9 @@ fn Run() { // CHECK:STDOUT: extend name_scope1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F[%self: Base](); +// CHECK:STDOUT: fn @F[@Base.%self.loc5_8.2: Base](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Unused[%self: Base](); +// CHECK:STDOUT: fn @Unused[@Base.%self.loc6_13.2: Base](); // CHECK:STDOUT: // CHECK:STDOUT: --- b.carbon // CHECK:STDOUT: @@ -101,7 +109,7 @@ fn Run() { // CHECK:STDOUT: package: = namespace {.Base = %import_ref.1, .Child = %import_ref.2, .Run = %Run} [template] // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+1, unused // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+19, used [template = constants.%Child] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Run: = fn_decl @Run {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Child { @@ -127,8 +135,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Child.decl = class_decl @Child, () [template = constants.%Child] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] +// CHECK:STDOUT: %Child.decl = class_decl @Child {} [template = constants.%Child] +// CHECK:STDOUT: %Base.decl = class_decl @Base {} [template = constants.%Base] // CHECK:STDOUT: %Child.ref: type = name_ref Child, file.%import_ref.2 [template = constants.%Child] // CHECK:STDOUT: %a.var: ref Child = var a // CHECK:STDOUT: %a: ref Child = bind_name a, %a.var diff --git a/toolchain/check/testdata/class/import_member_cycle.carbon b/toolchain/check/testdata/class/import_member_cycle.carbon index 6345984e44ee..adac1676c429 100644 --- a/toolchain/check/testdata/class/import_member_cycle.carbon +++ b/toolchain/check/testdata/class/import_member_cycle.carbon @@ -33,7 +33,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Cycle = %Cycle.decl} [template] -// CHECK:STDOUT: %Cycle.decl = class_decl @Cycle, () [template = constants.%Cycle] +// CHECK:STDOUT: %Cycle.decl = class_decl @Cycle {} [template = constants.%Cycle] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Cycle { @@ -56,7 +56,7 @@ fn Run() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Cycle = %import_ref, .Run = %Run} [template] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%Cycle] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Run: = fn_decl @Run {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Cycle { @@ -68,7 +68,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cycle.decl = class_decl @Cycle, () [template = constants.%Cycle] +// CHECK:STDOUT: %Cycle.decl = class_decl @Cycle {} [template = constants.%Cycle] // CHECK:STDOUT: %Cycle.ref: type = name_ref Cycle, file.%import_ref [template = constants.%Cycle] // CHECK:STDOUT: %.loc7: type = ptr_type Cycle [template = constants.%.1] // CHECK:STDOUT: %a.var: ref Cycle* = var a diff --git a/toolchain/check/testdata/class/import_struct_cyle.carbon b/toolchain/check/testdata/class/import_struct_cyle.carbon index 6186dce352a4..052b05ab010a 100644 --- a/toolchain/check/testdata/class/import_struct_cyle.carbon +++ b/toolchain/check/testdata/class/import_struct_cyle.carbon @@ -39,13 +39,13 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Cycle = %Cycle.decl.loc4, .a = %a} [template] -// CHECK:STDOUT: %Cycle.decl.loc4 = class_decl @Cycle, () [template = constants.%Cycle] +// CHECK:STDOUT: %Cycle.decl.loc4 = class_decl @Cycle {} [template = constants.%Cycle] // CHECK:STDOUT: %Cycle.ref: type = name_ref Cycle, %Cycle.decl.loc4 [template = constants.%Cycle] // CHECK:STDOUT: %.loc6_18: type = ptr_type Cycle [template = constants.%.1] // CHECK:STDOUT: %.loc6_19: type = struct_type {.b: Cycle*} [template = constants.%.2] // CHECK:STDOUT: %a.var: ref {.b: Cycle*} = var a // CHECK:STDOUT: %a: ref {.b: Cycle*} = bind_name a, %a.var -// CHECK:STDOUT: %Cycle.decl.loc8 = class_decl @Cycle, () [template = constants.%Cycle] +// CHECK:STDOUT: %Cycle.decl.loc8 = class_decl @Cycle {} [template = constants.%Cycle] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Cycle { @@ -73,7 +73,7 @@ fn Run() { // CHECK:STDOUT: package: = namespace {.Cycle = %import_ref.1, .a = %import_ref.2, .Run = %Run} [template] // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+1, unused // CHECK:STDOUT: %import_ref.2: ref {.b: Cycle*} = import_ref ir1, inst+11, used -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Run: = fn_decl @Run {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Cycle { @@ -85,7 +85,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cycle.decl = class_decl @Cycle, () [template = constants.%Cycle] +// CHECK:STDOUT: %Cycle.decl = class_decl @Cycle {} [template = constants.%Cycle] // CHECK:STDOUT: %a.ref.loc7_3: ref {.b: Cycle*} = name_ref a, file.%import_ref.2 // CHECK:STDOUT: %.loc7_4: ref Cycle* = struct_access %a.ref.loc7_3, element0 // CHECK:STDOUT: %a.ref.loc7_11: ref {.b: Cycle*} = name_ref a, file.%import_ref.2 diff --git a/toolchain/check/testdata/class/init.carbon b/toolchain/check/testdata/class/init.carbon index 3e50e3cffc9f..640a91f2a446 100644 --- a/toolchain/check/testdata/class/init.carbon +++ b/toolchain/check/testdata/class/init.carbon @@ -31,9 +31,27 @@ fn MakeReorder(n: i32, next: Class*) -> Class { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .Make = %Make, .MakeReorder = %MakeReorder} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %Make: = fn_decl @Make [template] -// CHECK:STDOUT: %MakeReorder: = fn_decl @MakeReorder [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %Make: = fn_decl @Make { +// CHECK:STDOUT: %n.loc12_9.1: i32 = param n +// CHECK:STDOUT: @Make.%n: i32 = bind_name n, %n.loc12_9.1 +// CHECK:STDOUT: %Class.ref.loc12_23: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc12: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %next.loc12_17.1: Class* = param next +// CHECK:STDOUT: @Make.%next: Class* = bind_name next, %next.loc12_17.1 +// CHECK:STDOUT: %Class.ref.loc12_34: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: @Make.%return: ref Class = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %MakeReorder: = fn_decl @MakeReorder { +// CHECK:STDOUT: %n.loc16_16.1: i32 = param n +// CHECK:STDOUT: @MakeReorder.%n: i32 = bind_name n, %n.loc16_16.1 +// CHECK:STDOUT: %Class.ref.loc16_30: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc16: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %next.loc16_24.1: Class* = param next +// CHECK:STDOUT: @MakeReorder.%next: Class* = bind_name next, %next.loc16_24.1 +// CHECK:STDOUT: %Class.ref.loc16_41: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: @MakeReorder.%return: ref Class = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { diff --git a/toolchain/check/testdata/class/init_as.carbon b/toolchain/check/testdata/class/init_as.carbon index 11470bcf6fc7..f8bfe677797f 100644 --- a/toolchain/check/testdata/class/init_as.carbon +++ b/toolchain/check/testdata/class/init_as.carbon @@ -27,8 +27,10 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .F = %F} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { diff --git a/toolchain/check/testdata/class/init_nested.carbon b/toolchain/check/testdata/class/init_nested.carbon index 5418e7edf783..c1fe732374c9 100644 --- a/toolchain/check/testdata/class/init_nested.carbon +++ b/toolchain/check/testdata/class/init_nested.carbon @@ -37,10 +37,16 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Inner = %Inner.decl, .MakeInner = %MakeInner, .Outer = %Outer.decl, .MakeOuter = %MakeOuter} [template] -// CHECK:STDOUT: %Inner.decl = class_decl @Inner, () [template = constants.%Inner] -// CHECK:STDOUT: %MakeInner: = fn_decl @MakeInner [template] -// CHECK:STDOUT: %Outer.decl = class_decl @Outer, () [template = constants.%Outer] -// CHECK:STDOUT: %MakeOuter: = fn_decl @MakeOuter [template] +// CHECK:STDOUT: %Inner.decl = class_decl @Inner {} [template = constants.%Inner] +// CHECK:STDOUT: %MakeInner: = fn_decl @MakeInner { +// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, %Inner.decl [template = constants.%Inner] +// CHECK:STDOUT: @MakeInner.%return: ref Inner = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Outer.decl = class_decl @Outer {} [template = constants.%Outer] +// CHECK:STDOUT: %MakeOuter: = fn_decl @MakeOuter { +// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, %Outer.decl [template = constants.%Outer] +// CHECK:STDOUT: @MakeOuter.%return: ref Outer = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { diff --git a/toolchain/check/testdata/class/method.carbon b/toolchain/check/testdata/class/method.carbon index 9aa14ae9fcb9..b3195a6ced7a 100644 --- a/toolchain/check/testdata/class/method.carbon +++ b/toolchain/check/testdata/class/method.carbon @@ -68,22 +68,72 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .Call = %Call, .CallAlias = %CallAlias, .CallOnConstBoundMethod = %CallOnConstBoundMethod, .CallWithAddr = %CallWithAddr, .CallFThroughPointer = %CallFThroughPointer, .CallGThroughPointer = %CallGThroughPointer, .Make = %Make, .CallFOnInitializingExpr = %CallFOnInitializingExpr, .CallGOnInitializingExpr = %CallGOnInitializingExpr} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %Call: = fn_decl @Call [template] -// CHECK:STDOUT: %CallAlias: = fn_decl @CallAlias [template] -// CHECK:STDOUT: %CallOnConstBoundMethod: = fn_decl @CallOnConstBoundMethod [template] -// CHECK:STDOUT: %CallWithAddr: = fn_decl @CallWithAddr [template] -// CHECK:STDOUT: %CallFThroughPointer: = fn_decl @CallFThroughPointer [template] -// CHECK:STDOUT: %CallGThroughPointer: = fn_decl @CallGThroughPointer [template] -// CHECK:STDOUT: %Make: = fn_decl @Make [template] -// CHECK:STDOUT: %CallFOnInitializingExpr: = fn_decl @CallFOnInitializingExpr [template] -// CHECK:STDOUT: %CallGOnInitializingExpr: = fn_decl @CallGOnInitializingExpr [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc16_12.1: Class = param self +// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc16_12.1 +// CHECK:STDOUT: %return.var.loc16: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Call: = fn_decl @Call { +// CHECK:STDOUT: %Class.ref.loc20: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %c.loc20_9.1: Class = param c +// CHECK:STDOUT: @Call.%c: Class = bind_name c, %c.loc20_9.1 +// CHECK:STDOUT: %return.var.loc20: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %CallAlias: = fn_decl @CallAlias { +// CHECK:STDOUT: %Class.ref.loc26: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %c.loc26_14.1: Class = param c +// CHECK:STDOUT: @CallAlias.%c: Class = bind_name c, %c.loc26_14.1 +// CHECK:STDOUT: %return.var.loc26: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %CallOnConstBoundMethod: = fn_decl @CallOnConstBoundMethod { +// CHECK:STDOUT: %return.var.loc30: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %CallWithAddr: = fn_decl @CallWithAddr { +// CHECK:STDOUT: %return.var.loc34: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %CallFThroughPointer: = fn_decl @CallFThroughPointer { +// CHECK:STDOUT: %Class.ref.loc39: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc39: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %p.loc39_24.1: Class* = param p +// CHECK:STDOUT: @CallFThroughPointer.%p: Class* = bind_name p, %p.loc39_24.1 +// CHECK:STDOUT: %return.var.loc39: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %CallGThroughPointer: = fn_decl @CallGThroughPointer { +// CHECK:STDOUT: %Class.ref.loc43: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc43: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %p.loc43_24.1: Class* = param p +// CHECK:STDOUT: @CallGThroughPointer.%p: Class* = bind_name p, %p.loc43_24.1 +// CHECK:STDOUT: %return.var.loc43: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Make: = fn_decl @Make { +// CHECK:STDOUT: %Class.ref.loc47: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: @Make.%return: ref Class = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %CallFOnInitializingExpr: = fn_decl @CallFOnInitializingExpr { +// CHECK:STDOUT: %return.var.loc49: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %CallGOnInitializingExpr: = fn_decl @CallGOnInitializingExpr { +// CHECK:STDOUT: %return.var.loc53: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Class.ref.loc8: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc8_8.1: Class = param self +// CHECK:STDOUT: %self.loc8_8.2: Class = bind_name self, %self.loc8_8.1 +// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Class.ref.loc9: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc9_24: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %self.loc9_13.1: Class* = param self +// CHECK:STDOUT: %self.loc9_13.3: Class* = bind_name self, %self.loc9_13.1 +// CHECK:STDOUT: %.loc9_8: Class* = addr_pattern %self.loc9_13.3 +// CHECK:STDOUT: %return.var.loc9: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %F.ref: = name_ref F, %F [template = %F] // CHECK:STDOUT: %A: = bind_alias A, %F [template = %F] // CHECK:STDOUT: %.loc13: = field_decl k, element0 [template] @@ -103,7 +153,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: return %.loc17_14.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G[addr %self: Class*]() -> i32; +// CHECK:STDOUT: fn @G[addr @Class.%self.loc9_13.3: Class*]() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @Call(%c: Class) -> i32 { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/class/nested.carbon b/toolchain/check/testdata/class/nested.carbon index 754e35a582b9..57d049198d8c 100644 --- a/toolchain/check/testdata/class/nested.carbon +++ b/toolchain/check/testdata/class/nested.carbon @@ -47,12 +47,17 @@ fn F(a: Outer*) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Outer = %Outer.decl, .F = %F} [template] -// CHECK:STDOUT: %Outer.decl = class_decl @Outer, () [template = constants.%Outer] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %Outer.decl = class_decl @Outer {} [template = constants.%Outer] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, %Outer.decl [template = constants.%Outer] +// CHECK:STDOUT: %.loc19: type = ptr_type Outer [template = constants.%.3] +// CHECK:STDOUT: %a.loc19_6.1: Outer* = param a +// CHECK:STDOUT: @F.%a: Outer* = bind_name a, %a.loc19_6.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Outer { -// CHECK:STDOUT: %Inner.decl = class_decl @Inner, () [template = constants.%Inner] +// CHECK:STDOUT: %Inner.decl = class_decl @Inner {} [template = constants.%Inner] // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Outer [template = constants.%Outer] // CHECK:STDOUT: %.loc14_15: type = ptr_type Outer [template = constants.%.3] // CHECK:STDOUT: %.loc14_9: = field_decl po, element0 [template] diff --git a/toolchain/check/testdata/class/nested_name.carbon b/toolchain/check/testdata/class/nested_name.carbon index dd428f4d4923..0eb428d1e24e 100644 --- a/toolchain/check/testdata/class/nested_name.carbon +++ b/toolchain/check/testdata/class/nested_name.carbon @@ -33,13 +33,23 @@ fn G(o: Outer) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Outer = %Outer.decl, .F = %F, .G = %G} [template] -// CHECK:STDOUT: %Outer.decl = class_decl @Outer, () [template = constants.%Outer] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %Outer.decl = class_decl @Outer {} [template = constants.%Outer] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Outer.ref.loc13: type = name_ref Outer, %Outer.decl [template = constants.%Outer] +// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [template = constants.%Inner] +// CHECK:STDOUT: %oi.loc13_6.1: Inner = param oi +// CHECK:STDOUT: @F.%oi: Inner = bind_name oi, %oi.loc13_6.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Outer.ref.loc17: type = name_ref Outer, %Outer.decl [template = constants.%Outer] +// CHECK:STDOUT: %o.loc17_6.1: Outer = param o +// CHECK:STDOUT: @G.%o: Outer = bind_name o, %o.loc17_6.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Outer { -// CHECK:STDOUT: %Inner.decl = class_decl @Inner, () [template = constants.%Inner] +// CHECK:STDOUT: %Inner.decl = class_decl @Inner {} [template = constants.%Inner] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Inner = %Inner.decl diff --git a/toolchain/check/testdata/class/raw_self.carbon b/toolchain/check/testdata/class/raw_self.carbon index 0a694ffd9fc4..0b2569752848 100644 --- a/toolchain/check/testdata/class/raw_self.carbon +++ b/toolchain/check/testdata/class/raw_self.carbon @@ -33,14 +33,48 @@ fn Class.G[self: Class](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Class.ref.loc13: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc13_28: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %self.loc13_17.1: Class* = param self +// CHECK:STDOUT: @F.%self.loc13_17: Class* = bind_name self, %self.loc13_17.1 +// CHECK:STDOUT: @F.%.loc13: Class* = addr_pattern @F.%self.loc13_17 +// CHECK:STDOUT: %self.loc13_31.1: i32 = param r#self +// CHECK:STDOUT: @F.%self.loc13_31: i32 = bind_name r#self, %self.loc13_31.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Class.ref.loc17: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc17_12.1: Class = param self +// CHECK:STDOUT: @G.%self.loc17_12: Class = bind_name self, %self.loc17_12.1 +// CHECK:STDOUT: %self.loc17_25.1: i32 = param r#self +// CHECK:STDOUT: @G.%self.loc17_25: i32 = bind_name r#self, %self.loc17_25.1 +// CHECK:STDOUT: %.loc17_50.1: (type, type) = tuple_literal (i32, i32) +// CHECK:STDOUT: %.loc17_50.2: type = converted %.loc17_50.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: @G.%return: ref (i32, i32) = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Class.ref.loc8: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc8_24: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %self.loc8_13.1: Class* = param self +// CHECK:STDOUT: %self.loc8_13.3: Class* = bind_name self, %self.loc8_13.1 +// CHECK:STDOUT: %.loc8_8: Class* = addr_pattern %self.loc8_13.3 +// CHECK:STDOUT: %self.loc8_27.1: i32 = param r#self +// CHECK:STDOUT: %self.loc8_27.2: i32 = bind_name r#self, %self.loc8_27.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Class.ref.loc9: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc9_8.1: Class = param self +// CHECK:STDOUT: %self.loc9_8.2: Class = bind_name self, %self.loc9_8.1 +// CHECK:STDOUT: %self.loc9_21.1: i32 = param r#self +// CHECK:STDOUT: %self.loc9_21.2: i32 = bind_name r#self, %self.loc9_21.1 +// CHECK:STDOUT: %.loc9_46.1: (type, type) = tuple_literal (i32, i32) +// CHECK:STDOUT: %.loc9_46.2: type = converted %.loc9_46.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %return.var: ref (i32, i32) = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %.loc10: = field_decl n, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/raw_self_type.carbon b/toolchain/check/testdata/class/raw_self_type.carbon index 0fd3227534f9..e13c14930487 100644 --- a/toolchain/check/testdata/class/raw_self_type.carbon +++ b/toolchain/check/testdata/class/raw_self_type.carbon @@ -21,11 +21,11 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/redeclaration.carbon b/toolchain/check/testdata/class/redeclaration.carbon index 6c78305f6414..f8bb7700b29f 100644 --- a/toolchain/check/testdata/class/redeclaration.carbon +++ b/toolchain/check/testdata/class/redeclaration.carbon @@ -21,13 +21,13 @@ fn Class.F() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl.loc7} [template] -// CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %Class.decl.loc9 = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %Class.decl.loc9 = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/redeclaration_introducer.carbon b/toolchain/check/testdata/class/redeclaration_introducer.carbon index 5a8d75035db4..20d245e8019f 100644 --- a/toolchain/check/testdata/class/redeclaration_introducer.carbon +++ b/toolchain/check/testdata/class/redeclaration_introducer.carbon @@ -23,12 +23,12 @@ abstract class C {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl.loc7, .B = %B.decl.loc8, .C = %C.decl.loc9} [template] -// CHECK:STDOUT: %A.decl.loc7 = class_decl @A, () [template = constants.%A] -// CHECK:STDOUT: %B.decl.loc8 = class_decl @B, () [template = constants.%B] -// CHECK:STDOUT: %C.decl.loc9 = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %A.decl.loc11 = class_decl @A, () [template = constants.%A] -// CHECK:STDOUT: %B.decl.loc12 = class_decl @B, () [template = constants.%B] -// CHECK:STDOUT: %C.decl.loc13 = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %A.decl.loc7 = class_decl @A {} [template = constants.%A] +// CHECK:STDOUT: %B.decl.loc8 = class_decl @B {} [template = constants.%B] +// CHECK:STDOUT: %C.decl.loc9 = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %A.decl.loc11 = class_decl @A {} [template = constants.%A] +// CHECK:STDOUT: %B.decl.loc12 = class_decl @B {} [template = constants.%B] +// CHECK:STDOUT: %C.decl.loc13 = class_decl @C {} [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { diff --git a/toolchain/check/testdata/class/reenter_scope.carbon b/toolchain/check/testdata/class/reenter_scope.carbon index d38e108b18cc..3b5d5d33f866 100644 --- a/toolchain/check/testdata/class/reenter_scope.carbon +++ b/toolchain/check/testdata/class/reenter_scope.carbon @@ -22,13 +22,19 @@ fn Class.F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %return.var.loc9: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/scope.carbon b/toolchain/check/testdata/class/scope.carbon index be0327a79155..d27425fa38b1 100644 --- a/toolchain/check/testdata/class/scope.carbon +++ b/toolchain/check/testdata/class/scope.carbon @@ -34,14 +34,20 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .F = %F, .Run = %Run} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F.2 { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Run: = fn_decl @Run {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F.1 { +// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %return.var.loc12: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/self.carbon b/toolchain/check/testdata/class/self.carbon index d49aed2b34ad..f7b33b4dddd9 100644 --- a/toolchain/check/testdata/class/self.carbon +++ b/toolchain/check/testdata/class/self.carbon @@ -31,14 +31,38 @@ fn Class.G[addr self: Class*]() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Class.ref.loc14: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc14_12.1: Class = param self +// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc14_12.1 +// CHECK:STDOUT: %return.var.loc14: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Class.ref.loc18: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc18_28: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %self.loc18_17.1: Class* = param self +// CHECK:STDOUT: @G.%self: Class* = bind_name self, %self.loc18_17.1 +// CHECK:STDOUT: @G.%.loc18: Class* = addr_pattern @G.%self +// CHECK:STDOUT: %return.var.loc18: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Class.ref.loc8: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc8_8.1: Class = param self +// CHECK:STDOUT: %self.loc8_8.2: Class = bind_name self, %self.loc8_8.1 +// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %Class.ref.loc9: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc9_24: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %self.loc9_13.1: Class* = param self +// CHECK:STDOUT: %self.loc9_13.3: Class* = bind_name self, %self.loc9_13.1 +// CHECK:STDOUT: %.loc9_8: Class* = addr_pattern %self.loc9_13.3 +// CHECK:STDOUT: %return.var.loc9: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %.loc11: = field_decl n, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/self_conversion.carbon b/toolchain/check/testdata/class/self_conversion.carbon index 96afaa8add9f..5e69c2c7200c 100644 --- a/toolchain/check/testdata/class/self_conversion.carbon +++ b/toolchain/check/testdata/class/self_conversion.carbon @@ -48,11 +48,28 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Derived = %Derived.decl, .Call = %Call} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] -// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () [template = constants.%Derived] -// CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase [template] -// CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase [template] -// CHECK:STDOUT: %Call: = fn_decl @Call [template] +// CHECK:STDOUT: %Base.decl = class_decl @Base {} [template = constants.%Base] +// CHECK:STDOUT: %Derived.decl = class_decl @Derived {} [template = constants.%Derived] +// CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase { +// CHECK:STDOUT: %Base.ref.loc18: type = name_ref Base, %Base.decl [template = constants.%Base] +// CHECK:STDOUT: %self.loc18_21.1: Base = param self +// CHECK:STDOUT: @SelfBase.%self: Base = bind_name self, %self.loc18_21.1 +// CHECK:STDOUT: %return.var.loc18: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase { +// CHECK:STDOUT: %Base.ref.loc22: type = name_ref Base, %Base.decl [template = constants.%Base] +// CHECK:STDOUT: %.loc22_40: type = ptr_type Base [template = constants.%.5] +// CHECK:STDOUT: %self.loc22_30.1: Base* = param self +// CHECK:STDOUT: @AddrSelfBase.%self: Base* = bind_name self, %self.loc22_30.1 +// CHECK:STDOUT: @AddrSelfBase.%.loc22: Base* = addr_pattern @AddrSelfBase.%self +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Call: = fn_decl @Call { +// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %.loc26: type = ptr_type Derived [template = constants.%.8] +// CHECK:STDOUT: %p.loc26_9.1: Derived* = param p +// CHECK:STDOUT: @Call.%p: Derived* = bind_name p, %p.loc26_9.1 +// CHECK:STDOUT: %return.var.loc26: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { @@ -63,10 +80,21 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] +// CHECK:STDOUT: %Base.ref.loc12: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc12: = base_decl Base, element0 [template] -// CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase [template] -// CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase [template] +// CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase { +// CHECK:STDOUT: %Base.ref.loc14: type = name_ref Base, file.%Base.decl [template = constants.%Base] +// CHECK:STDOUT: %self.loc14_15.1: Base = param self +// CHECK:STDOUT: %self.loc14_15.2: Base = bind_name self, %self.loc14_15.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase { +// CHECK:STDOUT: %Base.ref.loc15: type = name_ref Base, file.%Base.decl [template = constants.%Base] +// CHECK:STDOUT: %.loc15_34: type = ptr_type Base [template = constants.%.5] +// CHECK:STDOUT: %self.loc15_24.1: Base* = param self +// CHECK:STDOUT: %self.loc15_24.3: Base* = bind_name self, %self.loc15_24.1 +// CHECK:STDOUT: %.loc15_19: Base* = addr_pattern %self.loc15_24.3 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc12 diff --git a/toolchain/check/testdata/class/self_type.carbon b/toolchain/check/testdata/class/self_type.carbon index e29f17a7a66a..c4222d2cf3e0 100644 --- a/toolchain/check/testdata/class/self_type.carbon +++ b/toolchain/check/testdata/class/self_type.carbon @@ -28,13 +28,23 @@ fn Class.F[self: Class]() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc15_12.1: Class = param self +// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc15_12.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Self.ref.loc8: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %self.loc8_8.1: Class = param self +// CHECK:STDOUT: %self.loc8_8.2: Class = bind_name self, %self.loc8_8.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %.loc9_14: type = ptr_type Class [template = constants.%.1] // CHECK:STDOUT: %.loc9_8: = field_decl p, element0 [template] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/static_method.carbon b/toolchain/check/testdata/class/static_method.carbon index fbe86a9a9c57..1a7296e40c8c 100644 --- a/toolchain/check/testdata/class/static_method.carbon +++ b/toolchain/check/testdata/class/static_method.carbon @@ -24,12 +24,16 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .Run = %Run} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %Run: = fn_decl @Run { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/const/basic.carbon b/toolchain/check/testdata/const/basic.carbon index 99a325fdd6a0..2bffc4e8f273 100644 --- a/toolchain/check/testdata/const/basic.carbon +++ b/toolchain/check/testdata/const/basic.carbon @@ -24,8 +24,26 @@ fn B(p: const (i32*)) -> const (i32*) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A, .B = %B} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] +// CHECK:STDOUT: %A: = fn_decl @A { +// CHECK:STDOUT: %.loc7_9: type = const_type i32 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_18: type = ptr_type const i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_19: type = ptr_type const i32* [template = constants.%.3] +// CHECK:STDOUT: %p.loc7_6.1: const i32** = param p +// CHECK:STDOUT: @A.%p: const i32** = bind_name p, %p.loc7_6.1 +// CHECK:STDOUT: %.loc7_25: type = const_type i32 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_34: type = ptr_type const i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_35: type = ptr_type const i32* [template = constants.%.3] +// CHECK:STDOUT: %return.var.loc7: ref const i32** = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %B: = fn_decl @B { +// CHECK:STDOUT: %.loc11_19: type = ptr_type i32 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_9: type = const_type i32* [template = constants.%.5] +// CHECK:STDOUT: %p.loc11_6.1: const (i32*) = param p +// CHECK:STDOUT: @B.%p: const (i32*) = bind_name p, %p.loc11_6.1 +// CHECK:STDOUT: %.loc11_36: type = ptr_type i32 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_26: type = const_type i32* [template = constants.%.5] +// CHECK:STDOUT: %return.var.loc11: ref const (i32*) = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(%p: const i32**) -> const i32** { diff --git a/toolchain/check/testdata/const/collapse.carbon b/toolchain/check/testdata/const/collapse.carbon index b18d77089aa9..27362e4d237c 100644 --- a/toolchain/check/testdata/const/collapse.carbon +++ b/toolchain/check/testdata/const/collapse.carbon @@ -22,7 +22,18 @@ fn F(p: const i32**) -> const (const i32)** { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc11_9: type = const_type i32 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_18: type = ptr_type const i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_19: type = ptr_type const i32* [template = constants.%.3] +// CHECK:STDOUT: %p.loc11_6.1: const i32** = param p +// CHECK:STDOUT: @F.%p: const i32** = bind_name p, %p.loc11_6.1 +// CHECK:STDOUT: %.loc11_32: type = const_type i32 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_25: type = const_type const i32 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_42: type = ptr_type const i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_43: type = ptr_type const i32* [template = constants.%.3] +// CHECK:STDOUT: %return.var: ref const i32** = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%p: const i32**) -> const i32** { diff --git a/toolchain/check/testdata/const/fail_collapse.carbon b/toolchain/check/testdata/const/fail_collapse.carbon index 88f99d46e22e..ce4db2237d78 100644 --- a/toolchain/check/testdata/const/fail_collapse.carbon +++ b/toolchain/check/testdata/const/fail_collapse.carbon @@ -26,7 +26,17 @@ fn G(p: const (const i32)**) -> i32** { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.G = %G} [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %.loc10_16: type = const_type i32 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_9: type = const_type const i32 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_26: type = ptr_type const i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_27: type = ptr_type const i32* [template = constants.%.3] +// CHECK:STDOUT: %p.loc10_6.1: const i32** = param p +// CHECK:STDOUT: @G.%p: const i32** = bind_name p, %p.loc10_6.1 +// CHECK:STDOUT: %.loc10_36: type = ptr_type i32 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_37: type = ptr_type i32* [template = constants.%.5] +// CHECK:STDOUT: %return.var: ref i32** = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%p: const i32**) -> i32** { diff --git a/toolchain/check/testdata/const/import.carbon b/toolchain/check/testdata/const/import.carbon index 522a080de684..72bfc0bae087 100644 --- a/toolchain/check/testdata/const/import.carbon +++ b/toolchain/check/testdata/const/import.carbon @@ -31,7 +31,10 @@ var a_ptr: const i32* = a_ptr_ref; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .a_ref = %a_ref, .a_ptr_ref = %a_ptr_ref} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc4: type = const_type i32 [template = constants.%.1] +// CHECK:STDOUT: %return.var: ref const i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %.loc6: type = const_type i32 [template = constants.%.1] // CHECK:STDOUT: %a_ref.var: ref const i32 = var a_ref // CHECK:STDOUT: %a_ref: ref const i32 = bind_name a_ref, %a_ref.var diff --git a/toolchain/check/testdata/eval/fail_symbolic.carbon b/toolchain/check/testdata/eval/fail_symbolic.carbon index 3b7b2813756b..3c726ec8d99f 100644 --- a/toolchain/check/testdata/eval/fail_symbolic.carbon +++ b/toolchain/check/testdata/eval/fail_symbolic.carbon @@ -16,7 +16,10 @@ fn G(N:! i32) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.G = %G} [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %N.loc8_6.1: i32 = param N +// CHECK:STDOUT: @G.%N: i32 = bind_symbolic_name N, %N.loc8_6.1 [symbolic] +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%N: i32) { diff --git a/toolchain/check/testdata/eval/symbolic.carbon b/toolchain/check/testdata/eval/symbolic.carbon index 4f11fccf3123..4164bbe8e9f7 100644 --- a/toolchain/check/testdata/eval/symbolic.carbon +++ b/toolchain/check/testdata/eval/symbolic.carbon @@ -28,7 +28,10 @@ fn F(T:! type) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %T.loc8_6.1: type = param T +// CHECK:STDOUT: @F.%T: type = bind_symbolic_name T, %T.loc8_6.1 [symbolic] +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%T: type) { diff --git a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon index 882520eee776..42eee30691d1 100644 --- a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon +++ b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon @@ -27,9 +27,19 @@ fn H() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G, .H = %H} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %H: = fn_decl @H [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc7_20.1: (type, type) = tuple_literal (i32, i32) +// CHECK:STDOUT: %.loc7_20.2: type = converted %.loc7_20.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: @F.%return: ref (i32, i32) = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %.loc9_20.1: (type, type) = tuple_literal (i32, i32) +// CHECK:STDOUT: %.loc9_20.2: type = converted %.loc9_20.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: @G.%return: ref (i32, i32) = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %H: = fn_decl @H { +// CHECK:STDOUT: %return.var.loc15: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: (i32, i32); diff --git a/toolchain/check/testdata/function/call/alias.carbon b/toolchain/check/testdata/function/call/alias.carbon index 065f5b0d113d..8647c5282274 100644 --- a/toolchain/check/testdata/function/call/alias.carbon +++ b/toolchain/check/testdata/function/call/alias.carbon @@ -20,10 +20,12 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A, .B = %B, .Main = %Main} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] +// CHECK:STDOUT: %A: = fn_decl @A { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %A.ref: = name_ref A, %A [template = %A] // CHECK:STDOUT: %B: = bind_alias B, %A [template = %A] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { diff --git a/toolchain/check/testdata/function/call/empty_struct.carbon b/toolchain/check/testdata/function/call/empty_struct.carbon index c299802ec13d..8f9877b89fc3 100644 --- a/toolchain/check/testdata/function/call/empty_struct.carbon +++ b/toolchain/check/testdata/function/call/empty_struct.carbon @@ -22,8 +22,16 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Echo = %Echo, .Main = %Main} [template] -// CHECK:STDOUT: %Echo: = fn_decl @Echo [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Echo: = fn_decl @Echo { +// CHECK:STDOUT: %.loc7_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc7_13.2: type = converted %.loc7_13.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %a.loc7_9.1: {} = param a +// CHECK:STDOUT: @Echo.%a: {} = bind_name a, %a.loc7_9.1 +// CHECK:STDOUT: %.loc7_20.1: {} = struct_literal () +// CHECK:STDOUT: %.loc7_20.2: type = converted %.loc7_20.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %return.var: ref {} = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Echo(%a: {}) -> {} { diff --git a/toolchain/check/testdata/function/call/empty_tuple.carbon b/toolchain/check/testdata/function/call/empty_tuple.carbon index 02d1b6017cf2..ce9859b72312 100644 --- a/toolchain/check/testdata/function/call/empty_tuple.carbon +++ b/toolchain/check/testdata/function/call/empty_tuple.carbon @@ -21,8 +21,16 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Echo = %Echo, .Main = %Main} [template] -// CHECK:STDOUT: %Echo: = fn_decl @Echo [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Echo: = fn_decl @Echo { +// CHECK:STDOUT: %.loc7_13.1: () = tuple_literal () +// CHECK:STDOUT: %.loc7_13.2: type = converted %.loc7_13.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %a.loc7_9.1: () = param a +// CHECK:STDOUT: @Echo.%a: () = bind_name a, %a.loc7_9.1 +// CHECK:STDOUT: %.loc7_20.1: () = tuple_literal () +// CHECK:STDOUT: %.loc7_20.2: type = converted %.loc7_20.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %return.var: ref () = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Echo(%a: ()) -> () { diff --git a/toolchain/check/testdata/function/call/fail_not_callable.carbon b/toolchain/check/testdata/function/call/fail_not_callable.carbon index 7dd0ac5cefff..be031e0d09d4 100644 --- a/toolchain/check/testdata/function/call/fail_not_callable.carbon +++ b/toolchain/check/testdata/function/call/fail_not_callable.carbon @@ -20,7 +20,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Run = %Run} [template] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Run: = fn_decl @Run {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { diff --git a/toolchain/check/testdata/function/call/fail_param_count.carbon b/toolchain/check/testdata/function/call/fail_param_count.carbon index 5ec03ae49fa2..88a05d521f5a 100644 --- a/toolchain/check/testdata/function/call/fail_param_count.carbon +++ b/toolchain/check/testdata/function/call/fail_param_count.carbon @@ -65,10 +65,18 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Run0 = %Run0, .Run1 = %Run1, .Run2 = %Run2, .Main = %Main} [template] -// CHECK:STDOUT: %Run0: = fn_decl @Run0 [template] -// CHECK:STDOUT: %Run1: = fn_decl @Run1 [template] -// CHECK:STDOUT: %Run2: = fn_decl @Run2 [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Run0: = fn_decl @Run0 {} [template] +// CHECK:STDOUT: %Run1: = fn_decl @Run1 { +// CHECK:STDOUT: %a.loc8_9.1: i32 = param a +// CHECK:STDOUT: @Run1.%a: i32 = bind_name a, %a.loc8_9.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Run2: = fn_decl @Run2 { +// CHECK:STDOUT: %a.loc9_9.1: i32 = param a +// CHECK:STDOUT: @Run2.%a: i32 = bind_name a, %a.loc9_9.1 +// CHECK:STDOUT: %b.loc9_17.1: i32 = param b +// CHECK:STDOUT: @Run2.%b: i32 = bind_name b, %b.loc9_17.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run0() { diff --git a/toolchain/check/testdata/function/call/fail_param_type.carbon b/toolchain/check/testdata/function/call/fail_param_type.carbon index 94065890ba09..479d3e221116 100644 --- a/toolchain/check/testdata/function/call/fail_param_type.carbon +++ b/toolchain/check/testdata/function/call/fail_param_type.carbon @@ -25,8 +25,11 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.G = %G, .F = %F} [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %a.loc7_6.1: i32 = param a +// CHECK:STDOUT: @G.%a: i32 = bind_name a, %a.loc7_6.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%a: i32) { diff --git a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon index 359e7e7cb72b..2a86763cd9a2 100644 --- a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon @@ -21,8 +21,10 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo, .Run = %Run} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo { +// CHECK:STDOUT: %return.var: ref f64 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Run: = fn_decl @Run {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() -> f64 { diff --git a/toolchain/check/testdata/function/call/i32.carbon b/toolchain/check/testdata/function/call/i32.carbon index 55dfb439586e..fb1ac9bb416d 100644 --- a/toolchain/check/testdata/function/call/i32.carbon +++ b/toolchain/check/testdata/function/call/i32.carbon @@ -20,8 +20,12 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Echo = %Echo, .Main = %Main} [template] -// CHECK:STDOUT: %Echo: = fn_decl @Echo [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Echo: = fn_decl @Echo { +// CHECK:STDOUT: %a.loc7_9.1: i32 = param a +// CHECK:STDOUT: @Echo.%a: i32 = bind_name a, %a.loc7_9.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Echo(%a: i32) -> i32 { diff --git a/toolchain/check/testdata/function/call/more_param_ir.carbon b/toolchain/check/testdata/function/call/more_param_ir.carbon index 76b3b0275457..a33d7b95931d 100644 --- a/toolchain/check/testdata/function/call/more_param_ir.carbon +++ b/toolchain/check/testdata/function/call/more_param_ir.carbon @@ -26,8 +26,13 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo, .Main = %Main} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo { +// CHECK:STDOUT: %a.loc7_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: %b.loc7_16.1: i32 = param b +// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { diff --git a/toolchain/check/testdata/function/call/params_one.carbon b/toolchain/check/testdata/function/call/params_one.carbon index 7b7f8ed4c71c..2c51f30939fb 100644 --- a/toolchain/check/testdata/function/call/params_one.carbon +++ b/toolchain/check/testdata/function/call/params_one.carbon @@ -19,8 +19,11 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo, .Main = %Main} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo { +// CHECK:STDOUT: %a.loc7_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { diff --git a/toolchain/check/testdata/function/call/params_one_comma.carbon b/toolchain/check/testdata/function/call/params_one_comma.carbon index c31039879e8d..ff8e3f1dbc3a 100644 --- a/toolchain/check/testdata/function/call/params_one_comma.carbon +++ b/toolchain/check/testdata/function/call/params_one_comma.carbon @@ -20,8 +20,11 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo, .Main = %Main} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo { +// CHECK:STDOUT: %a.loc7_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { diff --git a/toolchain/check/testdata/function/call/params_two.carbon b/toolchain/check/testdata/function/call/params_two.carbon index e1ab67b39779..1e3d57c007aa 100644 --- a/toolchain/check/testdata/function/call/params_two.carbon +++ b/toolchain/check/testdata/function/call/params_two.carbon @@ -20,8 +20,13 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo, .Main = %Main} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo { +// CHECK:STDOUT: %a.loc7_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: %b.loc7_16.1: i32 = param b +// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { diff --git a/toolchain/check/testdata/function/call/params_two_comma.carbon b/toolchain/check/testdata/function/call/params_two_comma.carbon index e955aaebbf84..d7df181c653f 100644 --- a/toolchain/check/testdata/function/call/params_two_comma.carbon +++ b/toolchain/check/testdata/function/call/params_two_comma.carbon @@ -21,8 +21,13 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo, .Main = %Main} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo { +// CHECK:STDOUT: %a.loc7_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: %b.loc7_16.1: i32 = param b +// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { diff --git a/toolchain/check/testdata/function/call/params_zero.carbon b/toolchain/check/testdata/function/call/params_zero.carbon index af52c15f199c..8c77ea979dfe 100644 --- a/toolchain/check/testdata/function/call/params_zero.carbon +++ b/toolchain/check/testdata/function/call/params_zero.carbon @@ -18,8 +18,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo, .Main = %Main} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo {} [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { diff --git a/toolchain/check/testdata/function/call/return_implicit.carbon b/toolchain/check/testdata/function/call/return_implicit.carbon index cbb70d3a30a6..a7ef9ac2eb77 100644 --- a/toolchain/check/testdata/function/call/return_implicit.carbon +++ b/toolchain/check/testdata/function/call/return_implicit.carbon @@ -19,8 +19,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.MakeImplicitEmptyTuple = %MakeImplicitEmptyTuple, .Main = %Main} [template] -// CHECK:STDOUT: %MakeImplicitEmptyTuple: = fn_decl @MakeImplicitEmptyTuple [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %MakeImplicitEmptyTuple: = fn_decl @MakeImplicitEmptyTuple {} [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeImplicitEmptyTuple() { diff --git a/toolchain/check/testdata/function/declaration/fail_modifiers.carbon b/toolchain/check/testdata/function/declaration/fail_modifiers.carbon index 0bce4e39555f..5bafdecba52f 100644 --- a/toolchain/check/testdata/function/declaration/fail_modifiers.carbon +++ b/toolchain/check/testdata/function/declaration/fail_modifiers.carbon @@ -74,12 +74,12 @@ default final virtual fn ModifiersConflict2() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.WrongOrder = %WrongOrder, .DuplicateVirtual = %DuplicateVirtual, .TwoAccess = %TwoAccess, .ModifiersConflict = %ModifiersConflict, .InvalidModifier = %InvalidModifier, .ModifiersConflict2 = %ModifiersConflict2} [template] -// CHECK:STDOUT: %WrongOrder: = fn_decl @WrongOrder [template] -// CHECK:STDOUT: %DuplicateVirtual: = fn_decl @DuplicateVirtual [template] -// CHECK:STDOUT: %TwoAccess: = fn_decl @TwoAccess [template] -// CHECK:STDOUT: %ModifiersConflict: = fn_decl @ModifiersConflict [template] -// CHECK:STDOUT: %InvalidModifier: = fn_decl @InvalidModifier [template] -// CHECK:STDOUT: %ModifiersConflict2: = fn_decl @ModifiersConflict2 [template] +// CHECK:STDOUT: %WrongOrder: = fn_decl @WrongOrder {} [template] +// CHECK:STDOUT: %DuplicateVirtual: = fn_decl @DuplicateVirtual {} [template] +// CHECK:STDOUT: %TwoAccess: = fn_decl @TwoAccess {} [template] +// CHECK:STDOUT: %ModifiersConflict: = fn_decl @ModifiersConflict {} [template] +// CHECK:STDOUT: %InvalidModifier: = fn_decl @InvalidModifier {} [template] +// CHECK:STDOUT: %ModifiersConflict2: = fn_decl @ModifiersConflict2 {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @WrongOrder(); diff --git a/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon b/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon index 926bd51cb346..83cf07c96d09 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon @@ -13,7 +13,14 @@ fn F(n: i32, a: [i32; n]*); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %n.loc10_6.1: i32 = param n +// CHECK:STDOUT: @F.%n: i32 = bind_name n, %n.loc10_6.1 +// CHECK:STDOUT: %n.ref: i32 = name_ref n, @F.%n +// CHECK:STDOUT: %.loc10: type = ptr_type [template = ] +// CHECK:STDOUT: %a.loc10_14.1: = param a +// CHECK:STDOUT: @F.%a: = bind_name a, %a.loc10_14.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%n: i32, %a: ); diff --git a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon index 8590e041d858..843c6ed1db19 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon @@ -16,7 +16,12 @@ fn F(n: i32, n: i32); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %n.loc13_6.1: i32 = param n +// CHECK:STDOUT: @F.%n.loc13_6: i32 = bind_name n, %n.loc13_6.1 +// CHECK:STDOUT: %n.loc13_14.1: i32 = param n +// CHECK:STDOUT: @F.%n.loc13_14: i32 = bind_name n, %n.loc13_14.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%n.loc13_6: i32, %n.loc13_14: i32); diff --git a/toolchain/check/testdata/function/declaration/fail_todo_modifiers.carbon b/toolchain/check/testdata/function/declaration/fail_todo_modifiers.carbon index e059a76065ab..ba37aa01753e 100644 --- a/toolchain/check/testdata/function/declaration/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/function/declaration/fail_todo_modifiers.carbon @@ -13,7 +13,7 @@ private fn F(); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); diff --git a/toolchain/check/testdata/function/declaration/import.carbon b/toolchain/check/testdata/function/declaration/import.carbon index 12b5d0a2fb0e..5ecf96858068 100644 --- a/toolchain/check/testdata/function/declaration/import.carbon +++ b/toolchain/check/testdata/function/declaration/import.carbon @@ -32,9 +32,20 @@ var c: {.c: i32} = C((1,)); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A, .B = %B, .C = %C} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] -// CHECK:STDOUT: %C: = fn_decl @C [template] +// CHECK:STDOUT: %A: = fn_decl @A {} [template] +// CHECK:STDOUT: %B: = fn_decl @B { +// CHECK:STDOUT: %b.loc5_6.1: i32 = param b +// CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_6.1 +// CHECK:STDOUT: %return.var.loc5: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %C: = fn_decl @C { +// CHECK:STDOUT: %.loc6_14.1: (type,) = tuple_literal (i32) +// CHECK:STDOUT: %.loc6_14.2: type = converted %.loc6_14.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %c.loc6_6.1: (i32,) = param c +// CHECK:STDOUT: @C.%c: (i32,) = bind_name c, %c.loc6_6.1 +// CHECK:STDOUT: %.loc6_28: type = struct_type {.c: i32} [template = constants.%.3] +// CHECK:STDOUT: %return.var.loc6: ref {.c: i32} = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); diff --git a/toolchain/check/testdata/function/declaration/param_same_name.carbon b/toolchain/check/testdata/function/declaration/param_same_name.carbon index e5d78d73d850..4d921113c362 100644 --- a/toolchain/check/testdata/function/declaration/param_same_name.carbon +++ b/toolchain/check/testdata/function/declaration/param_same_name.carbon @@ -12,8 +12,14 @@ fn G(a: i32); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %a.loc7_6.1: i32 = param a +// CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc7_6.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %a.loc9_6.1: i32 = param a +// CHECK:STDOUT: @G.%a: i32 = bind_name a, %a.loc9_6.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a: i32); diff --git a/toolchain/check/testdata/function/declaration/simple.carbon b/toolchain/check/testdata/function/declaration/simple.carbon index f38034c96d4f..3e793654faea 100644 --- a/toolchain/check/testdata/function/declaration/simple.carbon +++ b/toolchain/check/testdata/function/declaration/simple.carbon @@ -16,8 +16,8 @@ fn G() { F(); } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); diff --git a/toolchain/check/testdata/function/definition/fail_todo_import_forward_decl.carbon b/toolchain/check/testdata/function/definition/fail_todo_import_forward_decl.carbon index 6f75230ee9e2..f31b380a288d 100644 --- a/toolchain/check/testdata/function/definition/fail_todo_import_forward_decl.carbon +++ b/toolchain/check/testdata/function/definition/fail_todo_import_forward_decl.carbon @@ -30,7 +30,7 @@ fn Foo() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(); @@ -40,7 +40,7 @@ fn Foo() {} // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %import_ref} [template] // CHECK:STDOUT: %import_ref: = import_ref ir1, inst+1, used [template = imports.%Foo] -// CHECK:STDOUT: %.loc14: = fn_decl @.1 [template] +// CHECK:STDOUT: %.loc14: = fn_decl @.1 {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(); diff --git a/toolchain/check/testdata/function/definition/forward_decl.carbon b/toolchain/check/testdata/function/definition/forward_decl.carbon index 0b4773947e28..0422d7e11740 100644 --- a/toolchain/check/testdata/function/definition/forward_decl.carbon +++ b/toolchain/check/testdata/function/definition/forward_decl.carbon @@ -12,8 +12,8 @@ fn Foo() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo.loc7} [template] -// CHECK:STDOUT: %Foo.loc7: = fn_decl @Foo [template] -// CHECK:STDOUT: %Foo.loc9: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo.loc7: = fn_decl @Foo {} [template] +// CHECK:STDOUT: %Foo.loc9: = fn_decl @Foo {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { diff --git a/toolchain/check/testdata/function/definition/import.carbon b/toolchain/check/testdata/function/definition/import.carbon index 5b6abe87bd5d..b9acba1ba439 100644 --- a/toolchain/check/testdata/function/definition/import.carbon +++ b/toolchain/check/testdata/function/definition/import.carbon @@ -33,9 +33,20 @@ var c: {.c: i32} = C((1,)); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A, .B = %B, .C = %C} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] -// CHECK:STDOUT: %C: = fn_decl @C [template] +// CHECK:STDOUT: %A: = fn_decl @A {} [template] +// CHECK:STDOUT: %B: = fn_decl @B { +// CHECK:STDOUT: %b.loc5_6.1: i32 = param b +// CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_6.1 +// CHECK:STDOUT: %return.var.loc5: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %C: = fn_decl @C { +// CHECK:STDOUT: %.loc6_14.1: (type,) = tuple_literal (i32) +// CHECK:STDOUT: %.loc6_14.2: type = converted %.loc6_14.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %c.loc6_6.1: (i32,) = param c +// CHECK:STDOUT: @C.%c: (i32,) = bind_name c, %c.loc6_6.1 +// CHECK:STDOUT: %.loc6_28: type = struct_type {.c: i32} [template = constants.%.3] +// CHECK:STDOUT: %return.var.loc6: ref {.c: i32} = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { diff --git a/toolchain/check/testdata/function/definition/order.carbon b/toolchain/check/testdata/function/definition/order.carbon index 3ac587d6c280..2179ee6a1be0 100644 --- a/toolchain/check/testdata/function/definition/order.carbon +++ b/toolchain/check/testdata/function/definition/order.carbon @@ -12,9 +12,9 @@ fn Baz() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo, .Bar = %Bar, .Baz = %Baz} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] -// CHECK:STDOUT: %Bar: = fn_decl @Bar [template] -// CHECK:STDOUT: %Baz: = fn_decl @Baz [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo {} [template] +// CHECK:STDOUT: %Bar: = fn_decl @Bar {} [template] +// CHECK:STDOUT: %Baz: = fn_decl @Baz {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { diff --git a/toolchain/check/testdata/function/definition/params_one.carbon b/toolchain/check/testdata/function/definition/params_one.carbon index 6b3f7c0aac57..e8ff231aa98a 100644 --- a/toolchain/check/testdata/function/definition/params_one.carbon +++ b/toolchain/check/testdata/function/definition/params_one.carbon @@ -10,7 +10,10 @@ fn Foo(a: i32) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo { +// CHECK:STDOUT: %a.loc7_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { diff --git a/toolchain/check/testdata/function/definition/params_one_comma.carbon b/toolchain/check/testdata/function/definition/params_one_comma.carbon index 6cfa090d070d..d56e1d15a10c 100644 --- a/toolchain/check/testdata/function/definition/params_one_comma.carbon +++ b/toolchain/check/testdata/function/definition/params_one_comma.carbon @@ -10,7 +10,10 @@ fn Foo(a: i32,) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo { +// CHECK:STDOUT: %a.loc7_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { diff --git a/toolchain/check/testdata/function/definition/params_two.carbon b/toolchain/check/testdata/function/definition/params_two.carbon index b1ebb8d07e57..3c7ee79506fe 100644 --- a/toolchain/check/testdata/function/definition/params_two.carbon +++ b/toolchain/check/testdata/function/definition/params_two.carbon @@ -10,7 +10,12 @@ fn Foo(a: i32, b: i32) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo { +// CHECK:STDOUT: %a.loc7_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: %b.loc7_16.1: i32 = param b +// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { diff --git a/toolchain/check/testdata/function/definition/params_two_comma.carbon b/toolchain/check/testdata/function/definition/params_two_comma.carbon index b476f1a48e23..ade4c4fa42dc 100644 --- a/toolchain/check/testdata/function/definition/params_two_comma.carbon +++ b/toolchain/check/testdata/function/definition/params_two_comma.carbon @@ -10,7 +10,12 @@ fn Foo(a: i32, b: i32,) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo { +// CHECK:STDOUT: %a.loc7_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: %b.loc7_16.1: i32 = param b +// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { diff --git a/toolchain/check/testdata/function/definition/params_zero.carbon b/toolchain/check/testdata/function/definition/params_zero.carbon index 7c321a8cbfab..66e0045d487b 100644 --- a/toolchain/check/testdata/function/definition/params_zero.carbon +++ b/toolchain/check/testdata/function/definition/params_zero.carbon @@ -10,7 +10,7 @@ fn Foo() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { diff --git a/toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon b/toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon index 1dc6468ab17e..1cc87d5b1805 100644 --- a/toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon +++ b/toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon @@ -13,7 +13,15 @@ fn F(N:! i32, a: [i32; N]*); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %N.loc10_6.1: i32 = param N +// CHECK:STDOUT: @F.%N: i32 = bind_symbolic_name N, %N.loc10_6.1 [symbolic] +// CHECK:STDOUT: %N.ref: i32 = name_ref N, @F.%N [symbolic = @F.%N] +// CHECK:STDOUT: %.loc10_25: type = array_type %N.ref, i32 [template = ] +// CHECK:STDOUT: %.loc10_26: type = ptr_type [template = ] +// CHECK:STDOUT: %a.loc10_15.1: = param a +// CHECK:STDOUT: @F.%a: = bind_name a, %a.loc10_15.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%N: i32, %a: ); diff --git a/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon b/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon index 3885955db86e..7bec7771988b 100644 --- a/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon +++ b/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon @@ -20,7 +20,12 @@ fn F(T:! type, U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %T.loc7_6.1: type = param T +// CHECK:STDOUT: @F.%T: type = bind_symbolic_name T, %T.loc7_6.1 [symbolic] +// CHECK:STDOUT: %U.loc7_16.1: type = param U +// CHECK:STDOUT: @F.%U: type = bind_symbolic_name U, %U.loc7_16.1 [symbolic] +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%T: type, %U: type) { diff --git a/toolchain/check/testdata/function/generic/type_param.carbon b/toolchain/check/testdata/function/generic/type_param.carbon index dfffd64f70d3..9208c6a2d05c 100644 --- a/toolchain/check/testdata/function/generic/type_param.carbon +++ b/toolchain/check/testdata/function/generic/type_param.carbon @@ -17,7 +17,10 @@ fn F(T:! type) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %T.loc7_6.1: type = param T +// CHECK:STDOUT: @F.%T: type = bind_symbolic_name T, %T.loc7_6.1 [symbolic] +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%T: type) { diff --git a/toolchain/check/testdata/function/generic/type_param_scope.carbon b/toolchain/check/testdata/function/generic/type_param_scope.carbon index d4fcb68786b7..f2ebae6559ae 100644 --- a/toolchain/check/testdata/function/generic/type_param_scope.carbon +++ b/toolchain/check/testdata/function/generic/type_param_scope.carbon @@ -13,7 +13,15 @@ fn F(T:! type, n: T) -> T { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %T.loc7_6.1: type = param T +// CHECK:STDOUT: @F.%T: type = bind_symbolic_name T, %T.loc7_6.1 [symbolic] +// CHECK:STDOUT: %T.ref.loc7_19: type = name_ref T, @F.%T [symbolic = @F.%T] +// CHECK:STDOUT: %n.loc7_16.1: T = param n +// CHECK:STDOUT: @F.%n: T = bind_name n, %n.loc7_16.1 +// CHECK:STDOUT: %T.ref.loc7_25: type = name_ref T, @F.%T [symbolic = @F.%T] +// CHECK:STDOUT: %return.var: ref T = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%T: type, %n: T) -> T { diff --git a/toolchain/check/testdata/global/class_obj.carbon b/toolchain/check/testdata/global/class_obj.carbon index 6ff504ac4c39..2cfd180edd05 100644 --- a/toolchain/check/testdata/global/class_obj.carbon +++ b/toolchain/check/testdata/global/class_obj.carbon @@ -19,7 +19,7 @@ var a: A = {}; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl, .a = %a} [template] -// CHECK:STDOUT: %A.decl = class_decl @A, () [template = constants.%A] +// CHECK:STDOUT: %A.decl = class_decl @A {} [template = constants.%A] // CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %a.var: ref A = var a // CHECK:STDOUT: %a: ref A = bind_name a, %a.var diff --git a/toolchain/check/testdata/global/class_with_fun.carbon b/toolchain/check/testdata/global/class_with_fun.carbon index 6dd0fea9a56b..f007e20ee6b0 100644 --- a/toolchain/check/testdata/global/class_with_fun.carbon +++ b/toolchain/check/testdata/global/class_with_fun.carbon @@ -23,9 +23,12 @@ var a: A = {}; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl, .ret_a = %ret_a, .a = %a} [template] -// CHECK:STDOUT: %A.decl = class_decl @A, () [template = constants.%A] -// CHECK:STDOUT: %ret_a: = fn_decl @ret_a [template] -// CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] +// CHECK:STDOUT: %A.decl = class_decl @A {} [template = constants.%A] +// CHECK:STDOUT: %ret_a: = fn_decl @ret_a { +// CHECK:STDOUT: %A.ref.loc8: type = name_ref A, %A.decl [template = constants.%A] +// CHECK:STDOUT: @ret_a.%return: ref A = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %A.ref.loc12: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %a.var: ref A = var a // CHECK:STDOUT: %a: ref A = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/global/simple_with_fun.carbon b/toolchain/check/testdata/global/simple_with_fun.carbon index c8abc823eb6b..f706b662ee71 100644 --- a/toolchain/check/testdata/global/simple_with_fun.carbon +++ b/toolchain/check/testdata/global/simple_with_fun.carbon @@ -18,7 +18,9 @@ var a: i32 = test_a(); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.test_a = %test_a, .a = %a} [template] -// CHECK:STDOUT: %test_a: = fn_decl @test_a [template] +// CHECK:STDOUT: %test_a: = fn_decl @test_a { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if/else.carbon b/toolchain/check/testdata/if/else.carbon index 1eca654c7583..788776577c5e 100644 --- a/toolchain/check/testdata/if/else.carbon +++ b/toolchain/check/testdata/if/else.carbon @@ -25,10 +25,13 @@ fn If(b: bool) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G, .H = %H, .If = %If} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %H: = fn_decl @H [template] -// CHECK:STDOUT: %If: = fn_decl @If [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] +// CHECK:STDOUT: %H: = fn_decl @H {} [template] +// CHECK:STDOUT: %If: = fn_decl @If { +// CHECK:STDOUT: %b.loc11_7.1: bool = param b +// CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc11_7.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon index 0e8cc0c1bad2..44fc7772925d 100644 --- a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon @@ -42,9 +42,21 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.If1 = %If1, .If2 = %If2, .If3 = %If3} [template] -// CHECK:STDOUT: %If1: = fn_decl @If1 [template] -// CHECK:STDOUT: %If2: = fn_decl @If2 [template] -// CHECK:STDOUT: %If3: = fn_decl @If3 [template] +// CHECK:STDOUT: %If1: = fn_decl @If1 { +// CHECK:STDOUT: %b.loc7_8.1: bool = param b +// CHECK:STDOUT: @If1.%b: bool = bind_name b, %b.loc7_8.1 +// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %If2: = fn_decl @If2 { +// CHECK:STDOUT: %b.loc17_8.1: bool = param b +// CHECK:STDOUT: @If2.%b: bool = bind_name b, %b.loc17_8.1 +// CHECK:STDOUT: %return.var.loc17: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %If3: = fn_decl @If3 { +// CHECK:STDOUT: %b.loc27_8.1: bool = param b +// CHECK:STDOUT: @If3.%b: bool = bind_name b, %b.loc27_8.1 +// CHECK:STDOUT: %return.var.loc27: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @If1(%b: bool) -> i32 { diff --git a/toolchain/check/testdata/if/fail_scope.carbon b/toolchain/check/testdata/if/fail_scope.carbon index 0d27489e835f..aaec56f8449b 100644 --- a/toolchain/check/testdata/if/fail_scope.carbon +++ b/toolchain/check/testdata/if/fail_scope.carbon @@ -23,7 +23,11 @@ fn VarScope(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.VarScope = %VarScope} [template] -// CHECK:STDOUT: %VarScope: = fn_decl @VarScope [template] +// CHECK:STDOUT: %VarScope: = fn_decl @VarScope { +// CHECK:STDOUT: %b.loc7_13.1: bool = param b +// CHECK:STDOUT: @VarScope.%b: bool = bind_name b, %b.loc7_13.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @VarScope(%b: bool) -> i32 { diff --git a/toolchain/check/testdata/if/no_else.carbon b/toolchain/check/testdata/if/no_else.carbon index ab9176abc6cf..4a569da9e474 100644 --- a/toolchain/check/testdata/if/no_else.carbon +++ b/toolchain/check/testdata/if/no_else.carbon @@ -22,9 +22,12 @@ fn If(b: bool) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G, .If = %If} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %If: = fn_decl @If [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] +// CHECK:STDOUT: %If: = fn_decl @If { +// CHECK:STDOUT: %b.loc10_7.1: bool = param b +// CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc10_7.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/if/unreachable_fallthrough.carbon b/toolchain/check/testdata/if/unreachable_fallthrough.carbon index 4b3f022d6645..fcdcce7b5ace 100644 --- a/toolchain/check/testdata/if/unreachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/unreachable_fallthrough.carbon @@ -22,7 +22,11 @@ fn If(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.If = %If} [template] -// CHECK:STDOUT: %If: = fn_decl @If [template] +// CHECK:STDOUT: %If: = fn_decl @If { +// CHECK:STDOUT: %b.loc7_7.1: bool = param b +// CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc7_7.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @If(%b: bool) -> i32 { diff --git a/toolchain/check/testdata/if_expr/basic.carbon b/toolchain/check/testdata/if_expr/basic.carbon index d01c4d881558..add19bbf2f50 100644 --- a/toolchain/check/testdata/if_expr/basic.carbon +++ b/toolchain/check/testdata/if_expr/basic.carbon @@ -23,7 +23,15 @@ fn F(b: bool, n: i32, m: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %b.loc7_6.1: bool = param b +// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc7_6.1 +// CHECK:STDOUT: %n.loc7_15.1: i32 = param n +// CHECK:STDOUT: @F.%n: i32 = bind_name n, %n.loc7_15.1 +// CHECK:STDOUT: %m.loc7_23.1: i32 = param m +// CHECK:STDOUT: @F.%m: i32 = bind_name m, %m.loc7_23.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b: bool, %n: i32, %m: i32) -> i32 { diff --git a/toolchain/check/testdata/if_expr/constant_condition.carbon b/toolchain/check/testdata/if_expr/constant_condition.carbon index e95dade0a25d..819f3573b39c 100644 --- a/toolchain/check/testdata/if_expr/constant_condition.carbon +++ b/toolchain/check/testdata/if_expr/constant_condition.carbon @@ -26,10 +26,18 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A, .B = %B, .F = %F, .G = %G} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %A: = fn_decl @A { +// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %B: = fn_decl @B { +// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var.loc10: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %return.var.loc14: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { diff --git a/toolchain/check/testdata/if_expr/control_flow.carbon b/toolchain/check/testdata/if_expr/control_flow.carbon index 050da38c2bde..2bb1792c6f0a 100644 --- a/toolchain/check/testdata/if_expr/control_flow.carbon +++ b/toolchain/check/testdata/if_expr/control_flow.carbon @@ -20,9 +20,17 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A, .B = %B, .F = %F} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %A: = fn_decl @A { +// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %B: = fn_decl @B { +// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %b.loc10_6.1: bool = param b +// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc10_6.1 +// CHECK:STDOUT: %return.var.loc10: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { diff --git a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon index b1e0c28be703..eeda022c3851 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -45,7 +45,7 @@ class C { // CHECK:STDOUT: file { // CHECK:STDOUT: %.loc17: i32 = block_arg // CHECK:STDOUT: %x: i32 = bind_name x, %.loc17 -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { diff --git a/toolchain/check/testdata/if_expr/nested.carbon b/toolchain/check/testdata/if_expr/nested.carbon index e3a8eec317ee..7f297a64f362 100644 --- a/toolchain/check/testdata/if_expr/nested.carbon +++ b/toolchain/check/testdata/if_expr/nested.carbon @@ -19,7 +19,15 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %a.loc7_6.1: bool = param a +// CHECK:STDOUT: @F.%a: bool = bind_name a, %a.loc7_6.1 +// CHECK:STDOUT: %b.loc7_15.1: bool = param b +// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc7_15.1 +// CHECK:STDOUT: %c.loc7_24.1: bool = param c +// CHECK:STDOUT: @F.%c: bool = bind_name c, %c.loc7_24.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a: bool, %b: bool, %c: bool) -> i32 { diff --git a/toolchain/check/testdata/if_expr/struct.carbon b/toolchain/check/testdata/if_expr/struct.carbon index 4047ea1435d6..76b42eb19d65 100644 --- a/toolchain/check/testdata/if_expr/struct.carbon +++ b/toolchain/check/testdata/if_expr/struct.carbon @@ -24,8 +24,15 @@ fn F(cond: bool) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.G = %G, .F = %F} [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %.loc7: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] +// CHECK:STDOUT: %s.loc7_6.1: {.a: i32, .b: i32} = param s +// CHECK:STDOUT: @G.%s: {.a: i32, .b: i32} = bind_name s, %s.loc7_6.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %cond.loc9_6.1: bool = param cond +// CHECK:STDOUT: @F.%cond: bool = bind_name cond, %cond.loc9_6.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%s: {.a: i32, .b: i32}); diff --git a/toolchain/check/testdata/impl/basic.carbon b/toolchain/check/testdata/impl/basic.carbon index e7458d9429df..7e20d0edad41 100644 --- a/toolchain/check/testdata/impl/basic.carbon +++ b/toolchain/check/testdata/impl/basic.carbon @@ -22,12 +22,14 @@ impl i32 as Simple { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Simple = %Simple.decl} [template] -// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, () [template = constants.%.1] -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: %Simple.decl = interface_decl @Simple {} [template = constants.%.1] +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %Simple.ref: type = name_ref Simple, %Simple.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] +// CHECK:STDOUT: %F: = fn_decl @F.1 {} [template] // CHECK:STDOUT: %.loc8: in Simple> = assoc_entity element0, %F [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -36,7 +38,7 @@ impl i32 as Simple { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as Simple { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %F: = fn_decl @F.2 {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/impl/declaration.carbon b/toolchain/check/testdata/impl/declaration.carbon index ba72a4234234..b903efea4548 100644 --- a/toolchain/check/testdata/impl/declaration.carbon +++ b/toolchain/check/testdata/impl/declaration.carbon @@ -16,8 +16,10 @@ impl i32 as I; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: %I.decl = interface_decl @I {} [template = constants.%.1] +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/empty.carbon b/toolchain/check/testdata/impl/empty.carbon index f0f588c13482..99151b9da754 100644 --- a/toolchain/check/testdata/impl/empty.carbon +++ b/toolchain/check/testdata/impl/empty.carbon @@ -18,8 +18,10 @@ impl i32 as Empty { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl} [template] -// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () [template = constants.%.1] -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: %Empty.decl = interface_decl @Empty {} [template = constants.%.1] +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %Empty.ref: type = name_ref Empty, %Empty.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Empty { diff --git a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon index 050c5e784992..db9b791a3465 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon @@ -35,12 +35,19 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.GenericInterface = %GenericInterface.decl, .C = %C.decl} [template] -// CHECK:STDOUT: %GenericInterface.decl = interface_decl @GenericInterface, (, ) [template = constants.%.1] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %GenericInterface.decl = interface_decl @GenericInterface { +// CHECK:STDOUT: %T.loc10_28.1: type = param T +// CHECK:STDOUT: %T.loc10_28.2: type = bind_symbolic_name T, %T.loc10_28.1 [symbolic] +// CHECK:STDOUT: } [template = constants.%.1] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @GenericInterface { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] +// CHECK:STDOUT: %F: = fn_decl @F.1 { +// CHECK:STDOUT: %T.ref: type = name_ref T, file.%T.loc10_28.2 [symbolic = file.%T.loc10_28.2] +// CHECK:STDOUT: %x.loc11_8.1: T = param x +// CHECK:STDOUT: %x.loc11_8.2: T = bind_name x, %x.loc11_8.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %.loc11: in GenericInterface> = assoc_entity element0, %F [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -49,22 +56,31 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %F: = fn_decl @F.2 { +// CHECK:STDOUT: %T.ref: type = name_ref T, @C.%T.loc21_23.2 [symbolic = @C.%T.loc21_23.2] +// CHECK:STDOUT: %x.loc22_10.1: T = param x +// CHECK:STDOUT: %x.loc22_10.2: T = bind_name x, %x.loc22_10.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: impl_decl @impl, (, , , ) +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %T.loc21_23.1: type = param T +// CHECK:STDOUT: %T.loc21_23.2: type = bind_symbolic_name T, %T.loc21_23.1 [symbolic] +// CHECK:STDOUT: %GenericInterface.ref: type = name_ref GenericInterface, file.%GenericInterface.decl [template = constants.%.1] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc21_23.2 [symbolic = %T.loc21_23.2] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: has_error // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.1(%x: T); +// CHECK:STDOUT: fn @F.1(@GenericInterface.%x.loc11_8.2: T); // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2(%x: T) { +// CHECK:STDOUT: fn @F.2(@impl.%x.loc22_10.2: T) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon index fa3ece87cd93..1da8745b106e 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon @@ -19,8 +19,10 @@ extend impl i32 as I {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: %I.decl = interface_decl @I {} [template = constants.%.1] +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon index f5b93a86b9c7..27bd775de760 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon @@ -45,10 +45,10 @@ class E { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl, .C = %C.decl, .D = %D.decl, .E = %E.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %D.decl = class_decl @D, () [template = constants.%D] -// CHECK:STDOUT: %E.decl = class_decl @E, () [template = constants.%E] +// CHECK:STDOUT: %I.decl = interface_decl @I {} [template = constants.%.1] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %D.decl = class_decl @D {} [template = constants.%D] +// CHECK:STDOUT: %E.decl = class_decl @E {} [template = constants.%E] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -70,21 +70,29 @@ class E { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: impl_decl @impl.1, () +// CHECK:STDOUT: impl_decl @impl.1 { +// CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: has_error // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { -// CHECK:STDOUT: impl_decl @impl.2, (, ) +// CHECK:STDOUT: impl_decl @impl.2 { +// CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] +// CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: extend name_scope1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @E { -// CHECK:STDOUT: impl_decl @impl.3, (, ) +// CHECK:STDOUT: impl_decl @impl.3 { +// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%E [template = constants.%E] +// CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: extend name_scope1 diff --git a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon index fb78e90d409a..8d16421b4485 100644 --- a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon @@ -20,13 +20,13 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.C = %C.decl} [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as i32; // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: impl_decl @impl {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: has_error diff --git a/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon b/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon index aeb451e5ccdd..4ca0b480a772 100644 --- a/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon @@ -26,11 +26,11 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] +// CHECK:STDOUT: %I.decl = interface_decl @I {} [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .C = %C.decl @@ -40,7 +40,9 @@ interface I { // CHECK:STDOUT: impl @impl: C as I; // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: has_error diff --git a/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon b/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon index 37b1450c374e..9705d69daa47 100644 --- a/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon @@ -26,8 +26,8 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl, .C = %C.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %I.decl = interface_decl @I {} [template = constants.%.1] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I; @@ -35,7 +35,9 @@ class C { // CHECK:STDOUT: impl @impl: C as I; // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: has_error diff --git a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon index ec62923d1e51..fedabb5e7b8c 100644 --- a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon +++ b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon @@ -25,12 +25,14 @@ impl as Simple { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Simple = %Simple.decl} [template] -// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, () [template = constants.%.1] -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: %Simple.decl = interface_decl @Simple {} [template = constants.%.1] +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %Simple.ref: type = name_ref Simple, %Simple.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] +// CHECK:STDOUT: %F: = fn_decl @F.1 {} [template] // CHECK:STDOUT: %.loc8: in Simple> = assoc_entity element0, %F [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -39,7 +41,7 @@ impl as Simple { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: as Simple { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %F: = fn_decl @F.2 {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon index 1dcefa2e9cf0..589b38e42a41 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon @@ -17,7 +17,9 @@ impl i32 as false {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {} [template] -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %.loc10: bool = bool_literal false [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as { diff --git a/toolchain/check/testdata/impl/fail_impl_bad_type.carbon b/toolchain/check/testdata/impl/fail_impl_bad_type.carbon index 5d3456d53f73..d37ad7f481fc 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_type.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_type.carbon @@ -20,8 +20,11 @@ impl true as I {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] -// CHECK:STDOUT: impl_decl @impl, (, ) +// CHECK:STDOUT: %I.decl = interface_decl @I {} [template = constants.%.1] +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %.loc12: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/fail_redefinition.carbon b/toolchain/check/testdata/impl/fail_redefinition.carbon index b44c8ef20ff1..97c9f844e65d 100644 --- a/toolchain/check/testdata/impl/fail_redefinition.carbon +++ b/toolchain/check/testdata/impl/fail_redefinition.carbon @@ -24,9 +24,13 @@ impl i32 as I {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] -// CHECK:STDOUT: impl_decl @impl, () -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: %I.decl = interface_decl @I {} [template = constants.%.1] +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %I.ref.loc9: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %I.ref.loc17: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/fail_todo_extend_impl.carbon b/toolchain/check/testdata/impl/fail_todo_extend_impl.carbon index dfc22bc3fe13..75fffe61a909 100644 --- a/toolchain/check/testdata/impl/fail_todo_extend_impl.carbon +++ b/toolchain/check/testdata/impl/fail_todo_extend_impl.carbon @@ -41,13 +41,17 @@ fn G(c: C) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.HasF = %HasF.decl, .C = %C.decl, .G = %G} [template] -// CHECK:STDOUT: %HasF.decl = interface_decl @HasF, () [template = constants.%.1] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %HasF.decl = interface_decl @HasF {} [template = constants.%.1] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %c.loc17_6.1: C = param c +// CHECK:STDOUT: @G.%c: C = bind_name c, %c.loc17_6.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @HasF { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] +// CHECK:STDOUT: %F: = fn_decl @F.1 {} [template] // CHECK:STDOUT: %.loc8: in HasF> = assoc_entity element0, %F [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -56,14 +60,16 @@ fn G(c: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as HasF { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %F: = fn_decl @F.2 {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %HasF.ref: type = name_ref HasF, file.%HasF.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: extend name_scope1 diff --git a/toolchain/check/testdata/impl/impl_as.carbon b/toolchain/check/testdata/impl/impl_as.carbon index bedee6e304cf..399f68d5dab3 100644 --- a/toolchain/check/testdata/impl/impl_as.carbon +++ b/toolchain/check/testdata/impl/impl_as.carbon @@ -26,12 +26,12 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Simple = %Simple.decl, .C = %C.decl} [template] -// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, () [template = constants.%.1] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %Simple.decl = interface_decl @Simple {} [template = constants.%.1] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] +// CHECK:STDOUT: %F: = fn_decl @F.1 {} [template] // CHECK:STDOUT: %.loc8: in Simple> = assoc_entity element0, %F [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -40,14 +40,16 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Simple { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %F: = fn_decl @F.2 {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/impl_forall.carbon b/toolchain/check/testdata/impl/impl_forall.carbon index 6746bb33cdbf..c1f9d04c8fd0 100644 --- a/toolchain/check/testdata/impl/impl_forall.carbon +++ b/toolchain/check/testdata/impl/impl_forall.carbon @@ -22,12 +22,17 @@ impl forall [T:! type] T as Simple { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Simple = %Simple.decl} [template] -// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, () [template = constants.%.1] -// CHECK:STDOUT: impl_decl @impl, (, , , ) +// CHECK:STDOUT: %Simple.decl = interface_decl @Simple {} [template = constants.%.1] +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %T.loc11_14.1: type = param T +// CHECK:STDOUT: %T.loc11_14.2: type = bind_symbolic_name T, %T.loc11_14.1 [symbolic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_14.2 [symbolic = %T.loc11_14.2] +// CHECK:STDOUT: %Simple.ref: type = name_ref Simple, %Simple.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] +// CHECK:STDOUT: %F: = fn_decl @F.1 {} [template] // CHECK:STDOUT: %.loc8: in Simple> = assoc_entity element0, %F [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -36,7 +41,7 @@ impl forall [T:! type] T as Simple { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: T as Simple { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %F: = fn_decl @F.2 {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/impl/redeclaration.carbon b/toolchain/check/testdata/impl/redeclaration.carbon index 58e0949b7120..c65483613b8b 100644 --- a/toolchain/check/testdata/impl/redeclaration.carbon +++ b/toolchain/check/testdata/impl/redeclaration.carbon @@ -24,10 +24,14 @@ impl i32 as I {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl, .X = %X.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] -// CHECK:STDOUT: impl_decl @impl, () -// CHECK:STDOUT: %X.decl = class_decl @X, () [template = constants.%X] -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: %I.decl = interface_decl @I {} [template = constants.%.1] +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %I.ref.loc9: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: } +// CHECK:STDOUT: %X.decl = class_decl @X {} [template = constants.%X] +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %I.ref.loc15: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -42,7 +46,9 @@ impl i32 as I {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @X { -// CHECK:STDOUT: impl_decl @impl, () +// CHECK:STDOUT: impl_decl @impl { +// CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/expr_category.carbon b/toolchain/check/testdata/index/expr_category.carbon index bf170c163c1b..6e0e474fc7ad 100644 --- a/toolchain/check/testdata/index/expr_category.carbon +++ b/toolchain/check/testdata/index/expr_category.carbon @@ -44,9 +44,23 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G, .ValueBinding = %ValueBinding} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %ValueBinding: = fn_decl @ValueBinding [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc7_17: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_18: type = array_type %.loc7_17, i32 [template = constants.%.2] +// CHECK:STDOUT: @F.%return: ref [i32; 3] = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %.loc9_15: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_16: type = array_type %.loc9_15, i32 [template = constants.%.2] +// CHECK:STDOUT: %b.loc9_6.1: [i32; 3] = param b +// CHECK:STDOUT: @G.%b: [i32; 3] = bind_name b, %b.loc9_6.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %ValueBinding: = fn_decl @ValueBinding { +// CHECK:STDOUT: %.loc17_26: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc17_27: type = array_type %.loc17_26, i32 [template = constants.%.2] +// CHECK:STDOUT: %b.loc17_17.1: [i32; 3] = param b +// CHECK:STDOUT: @ValueBinding.%b: [i32; 3] = bind_name b, %b.loc17_17.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: [i32; 3]; diff --git a/toolchain/check/testdata/index/fail_empty_tuple_access.carbon b/toolchain/check/testdata/index/fail_empty_tuple_access.carbon index 82ed03d462a9..c4a3de1f1ca9 100644 --- a/toolchain/check/testdata/index/fail_empty_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_empty_tuple_access.carbon @@ -22,8 +22,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .Run = %Run} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] +// CHECK:STDOUT: %Run: = fn_decl @Run {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/index/fail_expr_category.carbon b/toolchain/check/testdata/index/fail_expr_category.carbon index c2ffbab486e4..a473e976ee73 100644 --- a/toolchain/check/testdata/index/fail_expr_category.carbon +++ b/toolchain/check/testdata/index/fail_expr_category.carbon @@ -42,8 +42,17 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc7_17: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_18: type = array_type %.loc7_17, i32 [template = constants.%.2] +// CHECK:STDOUT: @F.%return: ref [i32; 3] = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %.loc9_15: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_16: type = array_type %.loc9_15, i32 [template = constants.%.2] +// CHECK:STDOUT: %b.loc9_6.1: [i32; 3] = param b +// CHECK:STDOUT: @G.%b: [i32; 3] = bind_name b, %b.loc9_6.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: [i32; 3]; diff --git a/toolchain/check/testdata/index/fail_invalid_base.carbon b/toolchain/check/testdata/index/fail_invalid_base.carbon index 2048aed4d1c0..e91a51745dad 100644 --- a/toolchain/check/testdata/index/fail_invalid_base.carbon +++ b/toolchain/check/testdata/index/fail_invalid_base.carbon @@ -46,7 +46,7 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: %.loc11: = namespace {} [template] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %c.var: ref i32 = var c diff --git a/toolchain/check/testdata/index/fail_name_not_found.carbon b/toolchain/check/testdata/index/fail_name_not_found.carbon index e2d50565f915..c4eba13e4a27 100644 --- a/toolchain/check/testdata/index/fail_name_not_found.carbon +++ b/toolchain/check/testdata/index/fail_name_not_found.carbon @@ -19,7 +19,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/index/fail_non_tuple_access.carbon b/toolchain/check/testdata/index/fail_non_tuple_access.carbon index 05029e9c164b..89c83cfafd00 100644 --- a/toolchain/check/testdata/index/fail_non_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_non_tuple_access.carbon @@ -20,7 +20,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/index/tuple_return_value_access.carbon b/toolchain/check/testdata/index/tuple_return_value_access.carbon index 721dd904b1ed..a8122c72ef6d 100644 --- a/toolchain/check/testdata/index/tuple_return_value_access.carbon +++ b/toolchain/check/testdata/index/tuple_return_value_access.carbon @@ -21,8 +21,14 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .Run = %Run} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc7_16.1: (type,) = tuple_literal (i32) +// CHECK:STDOUT: %.loc7_16.2: type = converted %.loc7_16.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %return.var.loc7: ref (i32,) = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Run: = fn_decl @Run { +// CHECK:STDOUT: %return.var.loc9: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> (i32,) { diff --git a/toolchain/check/testdata/interface/as_type.carbon b/toolchain/check/testdata/interface/as_type.carbon index 9c8c6e07f0e3..be0963ecb45a 100644 --- a/toolchain/check/testdata/interface/as_type.carbon +++ b/toolchain/check/testdata/interface/as_type.carbon @@ -17,8 +17,12 @@ fn F(e: Empty) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl, .F = %F} [template] -// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () [template = constants.%.1] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %Empty.decl = interface_decl @Empty {} [template = constants.%.1] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Empty.ref: type = name_ref Empty, %Empty.decl [template = constants.%.1] +// CHECK:STDOUT: %e.loc9_6.1: Empty = param e +// CHECK:STDOUT: @F.%e: Empty = bind_name e, %e.loc9_6.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Empty { diff --git a/toolchain/check/testdata/interface/basic.carbon b/toolchain/check/testdata/interface/basic.carbon index f9397cc3116d..0fb31db40904 100644 --- a/toolchain/check/testdata/interface/basic.carbon +++ b/toolchain/check/testdata/interface/basic.carbon @@ -24,9 +24,9 @@ interface ForwardDeclared { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl, .ForwardDeclared = %ForwardDeclared.decl.loc10} [template] -// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () [template = constants.%.1] -// CHECK:STDOUT: %ForwardDeclared.decl.loc10 = interface_decl @ForwardDeclared, () [template = constants.%.2] -// CHECK:STDOUT: %ForwardDeclared.decl.loc12 = interface_decl @ForwardDeclared, () [template = constants.%.2] +// CHECK:STDOUT: %Empty.decl = interface_decl @Empty {} [template = constants.%.1] +// CHECK:STDOUT: %ForwardDeclared.decl.loc10 = interface_decl @ForwardDeclared {} [template = constants.%.2] +// CHECK:STDOUT: %ForwardDeclared.decl.loc12 = interface_decl @ForwardDeclared {} [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Empty { @@ -36,7 +36,7 @@ interface ForwardDeclared { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @ForwardDeclared { -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: %.loc13: in ForwardDeclared> = assoc_entity element0, %F [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/interface/fail_add_member_outside_definition.carbon b/toolchain/check/testdata/interface/fail_add_member_outside_definition.carbon index 6e25f79615b7..ab121978541d 100644 --- a/toolchain/check/testdata/interface/fail_add_member_outside_definition.carbon +++ b/toolchain/check/testdata/interface/fail_add_member_outside_definition.carbon @@ -35,9 +35,9 @@ interface Outer { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Interface = %Interface.decl, .Outer = %Outer.decl} [template] -// CHECK:STDOUT: %Interface.decl = interface_decl @Interface, () [template = constants.%.1] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] -// CHECK:STDOUT: %Outer.decl = interface_decl @Outer, () [template = constants.%.2] +// CHECK:STDOUT: %Interface.decl = interface_decl @Interface {} [template = constants.%.1] +// CHECK:STDOUT: %F: = fn_decl @F.1 {} [template] +// CHECK:STDOUT: %Outer.decl = interface_decl @Outer {} [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { @@ -48,8 +48,8 @@ interface Outer { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Outer { -// CHECK:STDOUT: %Inner.decl = interface_decl @Inner, () [template = constants.%.3] -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %Inner.decl = interface_decl @Inner {} [template = constants.%.3] +// CHECK:STDOUT: %F: = fn_decl @F.2 {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Inner = %Inner.decl @@ -57,7 +57,7 @@ interface Outer { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Inner { -// CHECK:STDOUT: %.loc20: = fn_decl @.1 [template] +// CHECK:STDOUT: %.loc20: = fn_decl @.1 {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = @Outer.%F diff --git a/toolchain/check/testdata/interface/fail_as_type_of_type.carbon b/toolchain/check/testdata/interface/fail_as_type_of_type.carbon index 71b1baa86acc..75b49daffbe2 100644 --- a/toolchain/check/testdata/interface/fail_as_type_of_type.carbon +++ b/toolchain/check/testdata/interface/fail_as_type_of_type.carbon @@ -23,8 +23,12 @@ fn F(T:! Empty) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl, .F = %F} [template] -// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () [template = constants.%.1] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %Empty.decl = interface_decl @Empty {} [template = constants.%.1] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %Empty.ref: type = name_ref Empty, %Empty.decl [template = constants.%.1] +// CHECK:STDOUT: %T.loc9_6.1: Empty = param T +// CHECK:STDOUT: @F.%T: Empty = bind_symbolic_name T, %T.loc9_6.1 [symbolic] +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Empty { diff --git a/toolchain/check/testdata/interface/fail_duplicate.carbon b/toolchain/check/testdata/interface/fail_duplicate.carbon index 874ee6a98376..20d2936efbf8 100644 --- a/toolchain/check/testdata/interface/fail_duplicate.carbon +++ b/toolchain/check/testdata/interface/fail_duplicate.carbon @@ -47,16 +47,16 @@ interface Class { } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Interface = %Interface.decl.loc7, .Function = %Function, .Class = %Class.decl} [template] -// CHECK:STDOUT: %Interface.decl.loc7 = interface_decl @Interface, () [template = constants.%.1] -// CHECK:STDOUT: %Interface.decl.loc15 = interface_decl @Interface, () [template = constants.%.1] -// CHECK:STDOUT: %Function: = fn_decl @Function [template] -// CHECK:STDOUT: %.decl.loc27 = interface_decl @.1, () [template = constants.%.2] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] -// CHECK:STDOUT: %.decl.loc37 = interface_decl @.2, () [template = constants.%.3] +// CHECK:STDOUT: %Interface.decl.loc7 = interface_decl @Interface {} [template = constants.%.1] +// CHECK:STDOUT: %Interface.decl.loc15 = interface_decl @Interface {} [template = constants.%.1] +// CHECK:STDOUT: %Function: = fn_decl @Function {} [template] +// CHECK:STDOUT: %.decl.loc27 = interface_decl @.1 {} [template = constants.%.2] +// CHECK:STDOUT: %Class.decl = class_decl @Class {} [template = constants.%Class] +// CHECK:STDOUT: %.decl.loc37 = interface_decl @.2 {} [template = constants.%.3] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = diff --git a/toolchain/check/testdata/interface/fail_lookup_undefined.carbon b/toolchain/check/testdata/interface/fail_lookup_undefined.carbon index 725464e9b2a5..43612b90d176 100644 --- a/toolchain/check/testdata/interface/fail_lookup_undefined.carbon +++ b/toolchain/check/testdata/interface/fail_lookup_undefined.carbon @@ -52,18 +52,22 @@ interface BeingDefined { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Undefined = %Undefined.decl, .Test = %Test, .BeingDefined = %BeingDefined.decl} [template] -// CHECK:STDOUT: %Undefined.decl = interface_decl @Undefined, () [template = constants.%.1] -// CHECK:STDOUT: %.loc15: = fn_decl @.1 [template] -// CHECK:STDOUT: %Test: = fn_decl @Test [template] -// CHECK:STDOUT: %BeingDefined.decl = interface_decl @BeingDefined, () [template = constants.%.2] +// CHECK:STDOUT: %Undefined.decl = interface_decl @Undefined {} [template = constants.%.1] +// CHECK:STDOUT: %.loc15: = fn_decl @.1 {} [template] +// CHECK:STDOUT: %Test: = fn_decl @Test {} [template] +// CHECK:STDOUT: %BeingDefined.decl = interface_decl @BeingDefined {} [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Undefined; // CHECK:STDOUT: // CHECK:STDOUT: interface @BeingDefined { -// CHECK:STDOUT: %H: = fn_decl @H [template] +// CHECK:STDOUT: %H: = fn_decl @H { +// CHECK:STDOUT: %BeingDefined.ref: type = name_ref BeingDefined, file.%BeingDefined.decl [template = constants.%.2] +// CHECK:STDOUT: %T.ref: = name_ref T, [template = ] +// CHECK:STDOUT: %return.var: ref = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %.loc37: in BeingDefined> = assoc_entity element0, %H [template = constants.%.4] -// CHECK:STDOUT: %.loc41: = fn_decl @.2 [template] +// CHECK:STDOUT: %.loc41: = fn_decl @.2 {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .H = %.loc37 diff --git a/toolchain/check/testdata/interface/fail_member_lookup.carbon b/toolchain/check/testdata/interface/fail_member_lookup.carbon index 42db38287a87..84412a1f6bcf 100644 --- a/toolchain/check/testdata/interface/fail_member_lookup.carbon +++ b/toolchain/check/testdata/interface/fail_member_lookup.carbon @@ -23,12 +23,12 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Interface = %Interface.decl, .F = %F} [template] -// CHECK:STDOUT: %Interface.decl = interface_decl @Interface, () [template = constants.%.1] -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] +// CHECK:STDOUT: %Interface.decl = interface_decl @Interface {} [template = constants.%.1] +// CHECK:STDOUT: %F: = fn_decl @F.2 {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] +// CHECK:STDOUT: %F: = fn_decl @F.1 {} [template] // CHECK:STDOUT: %.loc7: in Interface> = assoc_entity element0, %F [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/interface/fail_modifiers.carbon b/toolchain/check/testdata/interface/fail_modifiers.carbon index 5828c73284c8..cd1b82e1ee58 100644 --- a/toolchain/check/testdata/interface/fail_modifiers.carbon +++ b/toolchain/check/testdata/interface/fail_modifiers.carbon @@ -37,10 +37,10 @@ protected interface Protected; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Abstract = %Abstract.decl, .Default = %Default.decl, .Virtual = %Virtual.decl, .Protected = %Protected.decl} [template] -// CHECK:STDOUT: %Abstract.decl = interface_decl @Abstract, () [template = constants.%.1] -// CHECK:STDOUT: %Default.decl = interface_decl @Default, () [template = constants.%.2] -// CHECK:STDOUT: %Virtual.decl = interface_decl @Virtual, () [template = constants.%.3] -// CHECK:STDOUT: %Protected.decl = interface_decl @Protected, () [template = constants.%.4] +// CHECK:STDOUT: %Abstract.decl = interface_decl @Abstract {} [template = constants.%.1] +// CHECK:STDOUT: %Default.decl = interface_decl @Default {} [template = constants.%.2] +// CHECK:STDOUT: %Virtual.decl = interface_decl @Virtual {} [template = constants.%.3] +// CHECK:STDOUT: %Protected.decl = interface_decl @Protected {} [template = constants.%.4] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Abstract { diff --git a/toolchain/check/testdata/interface/fail_redeclare_member.carbon b/toolchain/check/testdata/interface/fail_redeclare_member.carbon index 3aa22a0dd6ce..c86c16d0abb8 100644 --- a/toolchain/check/testdata/interface/fail_redeclare_member.carbon +++ b/toolchain/check/testdata/interface/fail_redeclare_member.carbon @@ -25,13 +25,13 @@ interface Interface { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Interface = %Interface.decl} [template] -// CHECK:STDOUT: %Interface.decl = interface_decl @Interface, () [template = constants.%.1] +// CHECK:STDOUT: %Interface.decl = interface_decl @Interface {} [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: %.loc8: in Interface> = assoc_entity element0, %F [template = constants.%.3] -// CHECK:STDOUT: %.loc15: = fn_decl @.1 [template] +// CHECK:STDOUT: %.loc15: = fn_decl @.1 {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %.loc8 diff --git a/toolchain/check/testdata/interface/fail_todo_define_out_of_line.carbon b/toolchain/check/testdata/interface/fail_todo_define_out_of_line.carbon index 05b4fbc39449..50c0dc1b3341 100644 --- a/toolchain/check/testdata/interface/fail_todo_define_out_of_line.carbon +++ b/toolchain/check/testdata/interface/fail_todo_define_out_of_line.carbon @@ -29,12 +29,12 @@ fn Interface.F() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Interface = %Interface.decl} [template] -// CHECK:STDOUT: %Interface.decl = interface_decl @Interface, () [template = constants.%.1] -// CHECK:STDOUT: %.loc20: = fn_decl @.1 [template] +// CHECK:STDOUT: %Interface.decl = interface_decl @Interface {} [template = constants.%.1] +// CHECK:STDOUT: %.loc20: = fn_decl @.1 {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: %.loc11: in Interface> = assoc_entity element0, %F [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/interface/fail_todo_facet_lookup.carbon b/toolchain/check/testdata/interface/fail_todo_facet_lookup.carbon index a06cede5b98a..007897ec0101 100644 --- a/toolchain/check/testdata/interface/fail_todo_facet_lookup.carbon +++ b/toolchain/check/testdata/interface/fail_todo_facet_lookup.carbon @@ -24,12 +24,16 @@ fn CallStatic(T:! Interface) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Interface = %Interface.decl, .CallStatic = %CallStatic} [template] -// CHECK:STDOUT: %Interface.decl = interface_decl @Interface, () [template = constants.%.1] -// CHECK:STDOUT: %CallStatic: = fn_decl @CallStatic [template] +// CHECK:STDOUT: %Interface.decl = interface_decl @Interface {} [template = constants.%.1] +// CHECK:STDOUT: %CallStatic: = fn_decl @CallStatic { +// CHECK:STDOUT: %Interface.ref: type = name_ref Interface, %Interface.decl [template = constants.%.1] +// CHECK:STDOUT: %T.loc9_15.1: Interface = param T +// CHECK:STDOUT: @CallStatic.%T: Interface = bind_symbolic_name T, %T.loc9_15.1 [symbolic] +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: %.loc7: in Interface> = assoc_entity element0, %F [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/interface/fail_todo_generic.carbon b/toolchain/check/testdata/interface/fail_todo_generic.carbon index 21369d23376a..35662323f074 100644 --- a/toolchain/check/testdata/interface/fail_todo_generic.carbon +++ b/toolchain/check/testdata/interface/fail_todo_generic.carbon @@ -20,7 +20,7 @@ interface I[](); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] +// CHECK:STDOUT: %I.decl = interface_decl @I {} [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I; diff --git a/toolchain/check/testdata/interface/fail_todo_modifiers.carbon b/toolchain/check/testdata/interface/fail_todo_modifiers.carbon index d518a1ce6a10..88a47525c682 100644 --- a/toolchain/check/testdata/interface/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/interface/fail_todo_modifiers.carbon @@ -33,14 +33,14 @@ private interface Private { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Modifiers = %Modifiers.decl, .Private = %Private.decl} [template] -// CHECK:STDOUT: %Modifiers.decl = interface_decl @Modifiers, () [template = constants.%.1] -// CHECK:STDOUT: %Private.decl = interface_decl @Private, () [template = constants.%.5] +// CHECK:STDOUT: %Modifiers.decl = interface_decl @Modifiers {} [template = constants.%.1] +// CHECK:STDOUT: %Private.decl = interface_decl @Private {} [template = constants.%.5] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Modifiers { -// CHECK:STDOUT: %Final: = fn_decl @Final [template] +// CHECK:STDOUT: %Final: = fn_decl @Final {} [template] // CHECK:STDOUT: %.loc11: in Modifiers> = assoc_entity element0, %Final [template = constants.%.3] -// CHECK:STDOUT: %Default: = fn_decl @Default [template] +// CHECK:STDOUT: %Default: = fn_decl @Default {} [template] // CHECK:STDOUT: %.loc15: in Modifiers> = assoc_entity element1, %Default [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/interface/import.carbon b/toolchain/check/testdata/interface/import.carbon index db881cf961fe..5d6993acf482 100644 --- a/toolchain/check/testdata/interface/import.carbon +++ b/toolchain/check/testdata/interface/import.carbon @@ -44,9 +44,9 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl, .ForwardDeclared = %ForwardDeclared.decl.loc7, .f_ref = %f_ref} [template] -// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () [template = constants.%.1] -// CHECK:STDOUT: %ForwardDeclared.decl.loc7 = interface_decl @ForwardDeclared, () [template = constants.%.2] -// CHECK:STDOUT: %ForwardDeclared.decl.loc9 = interface_decl @ForwardDeclared, () [template = constants.%.2] +// CHECK:STDOUT: %Empty.decl = interface_decl @Empty {} [template = constants.%.1] +// CHECK:STDOUT: %ForwardDeclared.decl.loc7 = interface_decl @ForwardDeclared {} [template = constants.%.2] +// CHECK:STDOUT: %ForwardDeclared.decl.loc9 = interface_decl @ForwardDeclared {} [template = constants.%.2] // CHECK:STDOUT: %ForwardDeclared.ref: type = name_ref ForwardDeclared, %ForwardDeclared.decl.loc7 [template = constants.%.2] // CHECK:STDOUT: %.loc13: type = struct_type {.f: ForwardDeclared} [template = constants.%.5] // CHECK:STDOUT: %f_ref.var: ref {.f: ForwardDeclared} = var f_ref @@ -60,7 +60,7 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @ForwardDeclared { -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: %.loc10: in ForwardDeclared> = assoc_entity element0, %F [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -82,16 +82,26 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace {.Empty = %import_ref.1, .ForwardDeclared = %import_ref.2, .f_ref = %import_ref.3, .UseEmpty = %UseEmpty, .UseForwardDeclared = %UseForwardDeclared, .f = %f} [template] +// CHECK:STDOUT: package: = namespace {.Empty = %import_ref.1, .ForwardDeclared = %import_ref.2, .f_ref = %import_ref.3, .UseEmpty = %UseEmpty, .UseForwardDeclared = %UseForwardDeclared, .f = %f.loc9} [template] // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.1] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+3, used [template = constants.%.3] // CHECK:STDOUT: %import_ref.3: ref {.f: ForwardDeclared} = import_ref ir1, inst+19, used -// CHECK:STDOUT: %UseEmpty: = fn_decl @UseEmpty [template] -// CHECK:STDOUT: %UseForwardDeclared: = fn_decl @UseForwardDeclared [template] -// CHECK:STDOUT: %ForwardDeclared.ref: type = name_ref ForwardDeclared, %import_ref.2 [template = constants.%.3] +// CHECK:STDOUT: %UseEmpty: = fn_decl @UseEmpty { +// CHECK:STDOUT: %Empty.decl = interface_decl @Empty {} [template = constants.%.1] +// CHECK:STDOUT: %Empty.ref: type = name_ref Empty, %import_ref.1 [template = constants.%.1] +// CHECK:STDOUT: %e.loc6_13.1: Empty = param e +// CHECK:STDOUT: @UseEmpty.%e: Empty = bind_name e, %e.loc6_13.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %UseForwardDeclared: = fn_decl @UseForwardDeclared { +// CHECK:STDOUT: %ForwardDeclared.decl = interface_decl @ForwardDeclared {} [template = constants.%.3] +// CHECK:STDOUT: %ForwardDeclared.ref.loc7: type = name_ref ForwardDeclared, %import_ref.2 [template = constants.%.3] +// CHECK:STDOUT: %f.loc7_23.1: ForwardDeclared = param f +// CHECK:STDOUT: @UseForwardDeclared.%f: ForwardDeclared = bind_name f, %f.loc7_23.1 +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %ForwardDeclared.ref.loc9: type = name_ref ForwardDeclared, %import_ref.2 [template = constants.%.3] // CHECK:STDOUT: %.loc9: type = ptr_type ForwardDeclared [template = constants.%.4] // CHECK:STDOUT: %f.var: ref ForwardDeclared* = var f -// CHECK:STDOUT: %f: ref ForwardDeclared* = bind_name f, %f.var +// CHECK:STDOUT: %f.loc9: ref ForwardDeclared* = bind_name f, %f.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Empty { diff --git a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon index 31ccd3810c08..d10cad2fe92b 100644 --- a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon +++ b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon @@ -16,7 +16,7 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] +// CHECK:STDOUT: %A: = fn_decl @A {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { diff --git a/toolchain/check/testdata/let/convert.carbon b/toolchain/check/testdata/let/convert.carbon index b42facacb77e..afff4a0162eb 100644 --- a/toolchain/check/testdata/let/convert.carbon +++ b/toolchain/check/testdata/let/convert.carbon @@ -25,7 +25,9 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { diff --git a/toolchain/check/testdata/let/fail_duplicate_decl.carbon b/toolchain/check/testdata/let/fail_duplicate_decl.carbon index 751b08ff7d94..be83fc78e261 100644 --- a/toolchain/check/testdata/let/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/let/fail_duplicate_decl.carbon @@ -24,7 +24,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/let/fail_generic.carbon b/toolchain/check/testdata/let/fail_generic.carbon index 20b2b1e9adcb..2600683d13d8 100644 --- a/toolchain/check/testdata/let/fail_generic.carbon +++ b/toolchain/check/testdata/let/fail_generic.carbon @@ -25,7 +25,11 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %a.loc8_6.1: i32 = param a +// CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc8_6.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a: i32) -> i32 { diff --git a/toolchain/check/testdata/let/fail_use_in_init.carbon b/toolchain/check/testdata/let/fail_use_in_init.carbon index 284c5424292b..3baf1aa45336 100644 --- a/toolchain/check/testdata/let/fail_use_in_init.carbon +++ b/toolchain/check/testdata/let/fail_use_in_init.carbon @@ -15,7 +15,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/let/generic.carbon b/toolchain/check/testdata/let/generic.carbon index b5b9922fe78b..c44f1e2f6490 100644 --- a/toolchain/check/testdata/let/generic.carbon +++ b/toolchain/check/testdata/let/generic.carbon @@ -18,7 +18,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/let/global.carbon b/toolchain/check/testdata/let/global.carbon index ad838ab60c47..57da4cd89b7a 100644 --- a/toolchain/check/testdata/let/global.carbon +++ b/toolchain/check/testdata/let/global.carbon @@ -18,7 +18,9 @@ fn F() -> i32 { return n; } // CHECK:STDOUT: package: = namespace {.F = %F} [template] // CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %n: i32 = bind_name n, %.loc7 -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { diff --git a/toolchain/check/testdata/let/local.carbon b/toolchain/check/testdata/let/local.carbon index 1a7addd86a5e..c94ce7617bdd 100644 --- a/toolchain/check/testdata/let/local.carbon +++ b/toolchain/check/testdata/let/local.carbon @@ -13,7 +13,11 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %a.loc7_6.1: i32 = param a +// CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc7_6.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a: i32) -> i32 { diff --git a/toolchain/check/testdata/let/shadowed_decl.carbon b/toolchain/check/testdata/let/shadowed_decl.carbon index a9bc37f411ca..f540bde24e14 100644 --- a/toolchain/check/testdata/let/shadowed_decl.carbon +++ b/toolchain/check/testdata/let/shadowed_decl.carbon @@ -18,7 +18,11 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %a.loc7_6.1: i32 = param a +// CHECK:STDOUT: @F.%a.loc7: i32 = bind_name a, %a.loc7_6.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a.loc7: i32) -> i32 { diff --git a/toolchain/check/testdata/namespace/add_to_import.carbon b/toolchain/check/testdata/namespace/add_to_import.carbon index 98b26ae376a5..bd6ce65e89e7 100644 --- a/toolchain/check/testdata/namespace/add_to_import.carbon +++ b/toolchain/check/testdata/namespace/add_to_import.carbon @@ -35,7 +35,9 @@ var a: i32 = NS.A(); // CHECK:STDOUT: package: = namespace {.NS = %.2, .a = %a} [template] // CHECK:STDOUT: %import_ref: = import_ref ir1, inst+1, used // CHECK:STDOUT: %.2: = namespace {.A = %A}, %import_ref [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] +// CHECK:STDOUT: %A: = fn_decl @A { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/alias.carbon b/toolchain/check/testdata/namespace/alias.carbon index 4dcc43fdbd0d..83f989c69cf2 100644 --- a/toolchain/check/testdata/namespace/alias.carbon +++ b/toolchain/check/testdata/namespace/alias.carbon @@ -27,12 +27,18 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: %.loc7: = namespace {.A = %A} [template] // CHECK:STDOUT: %NS.ref.loc9: = name_ref NS, %.loc7 [template = %.loc7] // CHECK:STDOUT: %ns: = bind_alias ns, %.loc7 [template = %.loc7] -// CHECK:STDOUT: %A: = fn_decl @A [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] +// CHECK:STDOUT: %A: = fn_decl @A { +// CHECK:STDOUT: %return.var.loc11: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %B: = fn_decl @B { +// CHECK:STDOUT: %return.var.loc13: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %NS.ref.loc15: = name_ref NS, %.loc7 [template = %.loc7] // CHECK:STDOUT: %A.ref: = name_ref A, %A [template = %A] // CHECK:STDOUT: %C: = bind_alias C, %A [template = %A] -// CHECK:STDOUT: %D: = fn_decl @D [template] +// CHECK:STDOUT: %D: = fn_decl @D { +// CHECK:STDOUT: %return.var.loc17: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { diff --git a/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon b/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon index ece70aee5e18..8822c8c70d62 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon @@ -54,9 +54,9 @@ fn NS(); // CHECK:STDOUT: %import_ref: = import_ref ir1, inst+1, used // CHECK:STDOUT: %.loc8_13.1: = namespace {}, %import_ref [template] // CHECK:STDOUT: %.loc8_13.2: = namespace {} [template] -// CHECK:STDOUT: %.loc16: = fn_decl @.1 [template] +// CHECK:STDOUT: %.loc16: = fn_decl @.1 {} [template] // CHECK:STDOUT: %.loc20: = namespace {} [template] -// CHECK:STDOUT: %.loc28: = fn_decl @.2 [template] +// CHECK:STDOUT: %.loc28: = fn_decl @.2 {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @.1(); diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon index e9eece50164a..af725e33f092 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon @@ -39,8 +39,8 @@ fn NS.Foo(); // CHECK:STDOUT: package: = namespace {.NS = %.2} [template] // CHECK:STDOUT: %import_ref: = import_ref ir1, inst+1, used // CHECK:STDOUT: %.2: = namespace {.Foo = %Foo}, %import_ref [template] -// CHECK:STDOUT: %.loc12: = fn_decl @.1 [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %.loc12: = fn_decl @.1 {} [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @.1(); diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon index c110d5e555f2..e231013dd944 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon @@ -36,7 +36,7 @@ fn NS.Foo(); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.NS = %NS} [template] -// CHECK:STDOUT: %NS: = fn_decl @NS [template] +// CHECK:STDOUT: %NS: = fn_decl @NS {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @NS(); @@ -47,7 +47,7 @@ fn NS.Foo(); // CHECK:STDOUT: package: = namespace {.NS = %import_ref} [template] // CHECK:STDOUT: %import_ref: = import_ref ir1, inst+1, used [template = imports.%NS] // CHECK:STDOUT: %.loc12: = namespace {} [template] -// CHECK:STDOUT: %.loc20: = fn_decl @.1 [template] +// CHECK:STDOUT: %.loc20: = fn_decl @.1 {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @NS(); diff --git a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon index 705098a02c4c..18df61c2d09c 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon @@ -37,7 +37,7 @@ fn NS.Bar() {} // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.NS = %.loc4} [template] // CHECK:STDOUT: %.loc4: = namespace {.Foo = %Foo} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { @@ -49,7 +49,7 @@ fn NS.Bar() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.NS = %NS} [template] -// CHECK:STDOUT: %NS: = fn_decl @NS [template] +// CHECK:STDOUT: %NS: = fn_decl @NS {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @NS() { @@ -65,7 +65,7 @@ fn NS.Bar() {} // CHECK:STDOUT: %.2: = namespace {.Foo = %import_ref.2, .Bar = %Bar}, %import_ref.1 [template] // CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+2, unused // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+1, unused -// CHECK:STDOUT: %Bar: = fn_decl @Bar [template] +// CHECK:STDOUT: %Bar: = fn_decl @Bar {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Bar() { diff --git a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon index c068f40e382f..4efef291d0d4 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon @@ -36,7 +36,7 @@ fn NS.Bar() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.NS = %NS} [template] -// CHECK:STDOUT: %NS: = fn_decl @NS [template] +// CHECK:STDOUT: %NS: = fn_decl @NS {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @NS() { @@ -49,7 +49,7 @@ fn NS.Bar() {} // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.NS = %.loc10} [template] // CHECK:STDOUT: %.loc10: = namespace {.Foo = %Foo} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { @@ -65,7 +65,7 @@ fn NS.Bar() {} // CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+1, used // CHECK:STDOUT: %.2: = namespace {.Foo = %import_ref.3, .Bar = %Bar}, %import_ref.2 [template] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+2, unused -// CHECK:STDOUT: %Bar: = fn_decl @Bar [template] +// CHECK:STDOUT: %Bar: = fn_decl @Bar {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Bar() { diff --git a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon index 9adbf6b52208..2a4a5240c071 100644 --- a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon +++ b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon @@ -28,7 +28,9 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: %.loc7: = namespace {} [template] // CHECK:STDOUT: %NS.ref: = name_ref NS, %.loc7 [template = %.loc7] // CHECK:STDOUT: %ns: = bind_alias ns, %.loc7 [template = %.loc7] -// CHECK:STDOUT: %.loc18: = fn_decl @.1 [template] +// CHECK:STDOUT: %.loc18: = fn_decl @.1 { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @.1() -> i32 { diff --git a/toolchain/check/testdata/namespace/fail_duplicate.carbon b/toolchain/check/testdata/namespace/fail_duplicate.carbon index 974e12c023ac..0733a3aac9b7 100644 --- a/toolchain/check/testdata/namespace/fail_duplicate.carbon +++ b/toolchain/check/testdata/namespace/fail_duplicate.carbon @@ -23,8 +23,8 @@ fn Foo.Baz() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %.loc7} [template] // CHECK:STDOUT: %.loc7: = namespace {.Baz = %Baz.loc9} [template] -// CHECK:STDOUT: %Baz.loc9: = fn_decl @Baz [template] -// CHECK:STDOUT: %Baz.loc18: = fn_decl @Baz [template] +// CHECK:STDOUT: %Baz.loc9: = fn_decl @Baz {} [template] +// CHECK:STDOUT: %Baz.loc18: = fn_decl @Baz {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Baz() { diff --git a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon index 62356a398af9..d16605fe02e3 100644 --- a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon +++ b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon @@ -14,7 +14,7 @@ fn Foo.Baz() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {} [template] -// CHECK:STDOUT: %.loc10: = fn_decl @.1 [template] +// CHECK:STDOUT: %.loc10: = fn_decl @.1 {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @.1() { diff --git a/toolchain/check/testdata/namespace/function.carbon b/toolchain/check/testdata/namespace/function.carbon index df2f3e36a49f..9c7b89559965 100644 --- a/toolchain/check/testdata/namespace/function.carbon +++ b/toolchain/check/testdata/namespace/function.carbon @@ -26,9 +26,9 @@ fn Bar() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %.loc7, .Baz = %Baz.loc10, .Bar = %Bar} [template] // CHECK:STDOUT: %.loc7: = namespace {.Baz = %Baz.loc13} [template] -// CHECK:STDOUT: %Baz.loc10: = fn_decl @Baz.1 [template] -// CHECK:STDOUT: %Baz.loc13: = fn_decl @Baz.2 [template] -// CHECK:STDOUT: %Bar: = fn_decl @Bar [template] +// CHECK:STDOUT: %Baz.loc10: = fn_decl @Baz.1 {} [template] +// CHECK:STDOUT: %Baz.loc13: = fn_decl @Baz.2 {} [template] +// CHECK:STDOUT: %Bar: = fn_decl @Bar {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Baz.1() { diff --git a/toolchain/check/testdata/namespace/imported.carbon b/toolchain/check/testdata/namespace/imported.carbon index f85f603822cd..cec2216b3914 100644 --- a/toolchain/check/testdata/namespace/imported.carbon +++ b/toolchain/check/testdata/namespace/imported.carbon @@ -30,8 +30,8 @@ var package_b: () = package.NS.ChildNS.B(); // CHECK:STDOUT: package: = namespace {.NS = %.loc4} [template] // CHECK:STDOUT: %.loc4: = namespace {.ChildNS = %.loc5, .A = %A} [template] // CHECK:STDOUT: %.loc5: = namespace {.B = %B} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] +// CHECK:STDOUT: %A: = fn_decl @A {} [template] +// CHECK:STDOUT: %B: = fn_decl @B {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); diff --git a/toolchain/check/testdata/namespace/imported_indirect.carbon b/toolchain/check/testdata/namespace/imported_indirect.carbon index 0e432aee56e6..594461c2566d 100644 --- a/toolchain/check/testdata/namespace/imported_indirect.carbon +++ b/toolchain/check/testdata/namespace/imported_indirect.carbon @@ -75,7 +75,7 @@ var e: () = A.B.C.D(); // CHECK:STDOUT: %.3: = namespace {.C = %.4}, %import_ref.2 [template] // CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+5, used // CHECK:STDOUT: %.4: = namespace {.D = %D}, %import_ref.3 [template] -// CHECK:STDOUT: %D: = fn_decl @D [template] +// CHECK:STDOUT: %D: = fn_decl @D {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @D() { diff --git a/toolchain/check/testdata/namespace/merging.carbon b/toolchain/check/testdata/namespace/merging.carbon index 556aafe4fd44..a9f697005419 100644 --- a/toolchain/check/testdata/namespace/merging.carbon +++ b/toolchain/check/testdata/namespace/merging.carbon @@ -47,7 +47,7 @@ fn Run() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.NS = %.loc4} [template] // CHECK:STDOUT: %.loc4: = namespace {.A = %A} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] +// CHECK:STDOUT: %A: = fn_decl @A {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -60,9 +60,9 @@ fn Run() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.NS = %.loc4} [template] // CHECK:STDOUT: %.loc4: = namespace {.B1 = %B1, .B2 = %B2} [template] -// CHECK:STDOUT: %B1: = fn_decl @B1 [template] +// CHECK:STDOUT: %B1: = fn_decl @B1 {} [template] // CHECK:STDOUT: %.loc8: = namespace {} [template] -// CHECK:STDOUT: %B2: = fn_decl @B2 [template] +// CHECK:STDOUT: %B2: = fn_decl @B2 {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B1() { @@ -89,8 +89,8 @@ fn Run() { // CHECK:STDOUT: %import_ref.3: = import_ref ir2, inst+2, used [template = imports.%B1] // CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+5, used [template = imports.%B2] // CHECK:STDOUT: %.loc7_13.2: = namespace {} [template] -// CHECK:STDOUT: %C: = fn_decl @C [template] -// CHECK:STDOUT: %Run: = fn_decl @Run [template] +// CHECK:STDOUT: %C: = fn_decl @C {} [template] +// CHECK:STDOUT: %Run: = fn_decl @Run {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @C() { diff --git a/toolchain/check/testdata/namespace/nested.carbon b/toolchain/check/testdata/namespace/nested.carbon index 870ce44ff539..e0b3448a80ce 100644 --- a/toolchain/check/testdata/namespace/nested.carbon +++ b/toolchain/check/testdata/namespace/nested.carbon @@ -24,8 +24,8 @@ fn Foo.Bar.Baz() { // CHECK:STDOUT: package: = namespace {.Foo = %.loc7} [template] // CHECK:STDOUT: %.loc7: = namespace {.Bar = %.loc8} [template] // CHECK:STDOUT: %.loc8: = namespace {.Wiz = %Wiz, .Baz = %Baz} [template] -// CHECK:STDOUT: %Wiz: = fn_decl @Wiz [template] -// CHECK:STDOUT: %Baz: = fn_decl @Baz [template] +// CHECK:STDOUT: %Wiz: = fn_decl @Wiz {} [template] +// CHECK:STDOUT: %Baz: = fn_decl @Baz {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Wiz() { diff --git a/toolchain/check/testdata/namespace/shadow.carbon b/toolchain/check/testdata/namespace/shadow.carbon index e0d2e4bf5d12..e02dbaf8c4d9 100644 --- a/toolchain/check/testdata/namespace/shadow.carbon +++ b/toolchain/check/testdata/namespace/shadow.carbon @@ -33,11 +33,13 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.loc7, .N = %.loc9} [template] -// CHECK:STDOUT: %A.loc7: = fn_decl @A.1 [template] +// CHECK:STDOUT: %A.loc7: = fn_decl @A.1 {} [template] // CHECK:STDOUT: %.loc9: = namespace {.A = %A.loc10, .M = %.loc12} [template] -// CHECK:STDOUT: %A.loc10: = fn_decl @A.2 [template] +// CHECK:STDOUT: %A.loc10: = fn_decl @A.2 {} [template] // CHECK:STDOUT: %.loc12: = namespace {.B = %B} [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] +// CHECK:STDOUT: %B: = fn_decl @B { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A.1(); diff --git a/toolchain/check/testdata/namespace/unqualified_lookup.carbon b/toolchain/check/testdata/namespace/unqualified_lookup.carbon index 140a8a2f83c3..4cdad6aa02ff 100644 --- a/toolchain/check/testdata/namespace/unqualified_lookup.carbon +++ b/toolchain/check/testdata/namespace/unqualified_lookup.carbon @@ -36,12 +36,12 @@ fn OuterN.InnerN.CallABC() { // CHECK:STDOUT: package: = namespace {.OuterN = %.loc7, .A = %A, .CallA = %CallA} [template] // CHECK:STDOUT: %.loc7: = namespace {.InnerN = %.loc8, .B = %B, .CallAB = %CallAB} [template] // CHECK:STDOUT: %.loc8: = namespace {.C = %C, .CallABC = %CallABC} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] -// CHECK:STDOUT: %C: = fn_decl @C [template] -// CHECK:STDOUT: %CallA: = fn_decl @CallA [template] -// CHECK:STDOUT: %CallAB: = fn_decl @CallAB [template] -// CHECK:STDOUT: %CallABC: = fn_decl @CallABC [template] +// CHECK:STDOUT: %A: = fn_decl @A {} [template] +// CHECK:STDOUT: %B: = fn_decl @B {} [template] +// CHECK:STDOUT: %C: = fn_decl @C {} [template] +// CHECK:STDOUT: %CallA: = fn_decl @CallA {} [template] +// CHECK:STDOUT: %CallAB: = fn_decl @CallAB {} [template] +// CHECK:STDOUT: %CallABC: = fn_decl @CallABC {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); diff --git a/toolchain/check/testdata/operators/and.carbon b/toolchain/check/testdata/operators/and.carbon index 4dede8756074..ef6195fdcadd 100644 --- a/toolchain/check/testdata/operators/and.carbon +++ b/toolchain/check/testdata/operators/and.carbon @@ -20,9 +20,15 @@ fn And() -> bool { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G, .And = %And} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %And: = fn_decl @And [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var.loc7: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %return.var.loc8: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %And: = fn_decl @And { +// CHECK:STDOUT: %return.var.loc10: ref bool = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { diff --git a/toolchain/check/testdata/operators/assignment.carbon b/toolchain/check/testdata/operators/assignment.carbon index 90d2d689f44a..730860f602b6 100644 --- a/toolchain/check/testdata/operators/assignment.carbon +++ b/toolchain/check/testdata/operators/assignment.carbon @@ -47,7 +47,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/operators/fail_assignment_to_error.carbon b/toolchain/check/testdata/operators/fail_assignment_to_error.carbon index 07aa8256d036..14771db1dd33 100644 --- a/toolchain/check/testdata/operators/fail_assignment_to_error.carbon +++ b/toolchain/check/testdata/operators/fail_assignment_to_error.carbon @@ -23,7 +23,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon b/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon index a7b32ab2bf9a..3d949227e2cf 100644 --- a/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon +++ b/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon @@ -68,8 +68,10 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .Main = %Main} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32; diff --git a/toolchain/check/testdata/operators/fail_type_mismatch.carbon b/toolchain/check/testdata/operators/fail_type_mismatch.carbon index 904040c9b771..10053b1022f3 100644 --- a/toolchain/check/testdata/operators/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/operators/fail_type_mismatch.carbon @@ -19,7 +19,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/operators/fail_type_mismatch_assignment.carbon b/toolchain/check/testdata/operators/fail_type_mismatch_assignment.carbon index a47a12e66af6..65497443c2dc 100644 --- a/toolchain/check/testdata/operators/fail_type_mismatch_assignment.carbon +++ b/toolchain/check/testdata/operators/fail_type_mismatch_assignment.carbon @@ -21,7 +21,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/operators/or.carbon b/toolchain/check/testdata/operators/or.carbon index 891fc51521d3..bb8de9ab5a78 100644 --- a/toolchain/check/testdata/operators/or.carbon +++ b/toolchain/check/testdata/operators/or.carbon @@ -19,9 +19,15 @@ fn Or() -> bool { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G, .Or = %Or} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %Or: = fn_decl @Or [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var.loc7: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %return.var.loc8: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Or: = fn_decl @Or { +// CHECK:STDOUT: %return.var.loc10: ref bool = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { diff --git a/toolchain/check/testdata/operators/unary_op.carbon b/toolchain/check/testdata/operators/unary_op.carbon index 2433e0c0edb6..4f5b67f6ca47 100644 --- a/toolchain/check/testdata/operators/unary_op.carbon +++ b/toolchain/check/testdata/operators/unary_op.carbon @@ -20,7 +20,11 @@ let not_false: bool = not false; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Not = %Not} [template] -// CHECK:STDOUT: %Not: = fn_decl @Not [template] +// CHECK:STDOUT: %Not: = fn_decl @Not { +// CHECK:STDOUT: %b.loc7_8.1: bool = param b +// CHECK:STDOUT: @Not.%b: bool = bind_name b, %b.loc7_8.1 +// CHECK:STDOUT: %return.var: ref bool = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %.loc11_26: bool = bool_literal true [template = constants.%.1] // CHECK:STDOUT: %.loc11_22: bool = not %.loc11_26 [template = constants.%.2] // CHECK:STDOUT: %not_true: bool = bind_name not_true, %.loc11_22 diff --git a/toolchain/check/testdata/package_expr/fail_not_found.carbon b/toolchain/check/testdata/package_expr/fail_not_found.carbon index da60d53d3f8b..f790b2761315 100644 --- a/toolchain/check/testdata/package_expr/fail_not_found.carbon +++ b/toolchain/check/testdata/package_expr/fail_not_found.carbon @@ -15,7 +15,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/package_expr/syntax.carbon b/toolchain/check/testdata/package_expr/syntax.carbon index f2e503c6ecaf..98a2236b3a62 100644 --- a/toolchain/check/testdata/package_expr/syntax.carbon +++ b/toolchain/check/testdata/package_expr/syntax.carbon @@ -53,7 +53,7 @@ fn Main() { // CHECK:STDOUT: package: = namespace {.x = %x, .Main = %Main} [template] // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { @@ -89,7 +89,7 @@ fn Main() { // CHECK:STDOUT: package: = namespace {.x = %x, .Main = %Main} [template] // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { @@ -125,12 +125,12 @@ fn Main() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.NS = %.loc4, .Main = %Main} [template] // CHECK:STDOUT: %.loc4: = namespace {.C = %C.decl} [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo {} [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Foo = %Foo diff --git a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon index 9e43c9dbdd0d..ec8b00ee5341 100644 --- a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon +++ b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon @@ -33,7 +33,7 @@ import library "var"; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Foo = %Foo} [template] -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] +// CHECK:STDOUT: %Foo: = fn_decl @Foo {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(); diff --git a/toolchain/check/testdata/packages/loaded_global.carbon b/toolchain/check/testdata/packages/loaded_global.carbon index 9c31499db71b..4998acb87dd4 100644 --- a/toolchain/check/testdata/packages/loaded_global.carbon +++ b/toolchain/check/testdata/packages/loaded_global.carbon @@ -38,7 +38,7 @@ var package_b: () = package.B(); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] +// CHECK:STDOUT: %A: = fn_decl @A {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); @@ -80,7 +80,7 @@ var package_b: () = package.B(); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B = %B} [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] +// CHECK:STDOUT: %B: = fn_decl @B {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B(); diff --git a/toolchain/check/testdata/packages/unused_lazy_import.carbon b/toolchain/check/testdata/packages/unused_lazy_import.carbon index d7f83808edfe..7e96717c3cac 100644 --- a/toolchain/check/testdata/packages/unused_lazy_import.carbon +++ b/toolchain/check/testdata/packages/unused_lazy_import.carbon @@ -18,7 +18,7 @@ package Implicit impl; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] +// CHECK:STDOUT: %A: = fn_decl @A {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); diff --git a/toolchain/check/testdata/pointer/address_of_deref.carbon b/toolchain/check/testdata/pointer/address_of_deref.carbon index 574ee89c3f24..4b5a70b576dd 100644 --- a/toolchain/check/testdata/pointer/address_of_deref.carbon +++ b/toolchain/check/testdata/pointer/address_of_deref.carbon @@ -18,7 +18,9 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { diff --git a/toolchain/check/testdata/pointer/address_of_lvalue.carbon b/toolchain/check/testdata/pointer/address_of_lvalue.carbon index 5579fbe1a59d..f632396737e5 100644 --- a/toolchain/check/testdata/pointer/address_of_lvalue.carbon +++ b/toolchain/check/testdata/pointer/address_of_lvalue.carbon @@ -34,7 +34,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/pointer/basic.carbon b/toolchain/check/testdata/pointer/basic.carbon index bb1ce99c0904..3e6b0680dca5 100644 --- a/toolchain/check/testdata/pointer/basic.carbon +++ b/toolchain/check/testdata/pointer/basic.carbon @@ -20,7 +20,9 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { diff --git a/toolchain/check/testdata/pointer/fail_address_of_error.carbon b/toolchain/check/testdata/pointer/fail_address_of_error.carbon index 275b6c481b1f..ba2157a1e270 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_error.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_error.carbon @@ -22,7 +22,7 @@ fn Test() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Test = %Test} [template] -// CHECK:STDOUT: %Test: = fn_decl @Test [template] +// CHECK:STDOUT: %Test: = fn_decl @Test {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Test() { diff --git a/toolchain/check/testdata/pointer/fail_address_of_value.carbon b/toolchain/check/testdata/pointer/fail_address_of_value.carbon index cc3d94734398..4eb4d8a4a793 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_value.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_value.carbon @@ -109,14 +109,22 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.G = %G, .H = %H, .AddressOfLiteral = %AddressOfLiteral, .AddressOfOperator = %AddressOfOperator, .AddressOfCall = %AddressOfCall, .AddressOfType = %AddressOfType, .AddressOfTupleElementValue = %AddressOfTupleElementValue, .AddressOfParam = %AddressOfParam} [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %H: = fn_decl @H [template] -// CHECK:STDOUT: %AddressOfLiteral: = fn_decl @AddressOfLiteral [template] -// CHECK:STDOUT: %AddressOfOperator: = fn_decl @AddressOfOperator [template] -// CHECK:STDOUT: %AddressOfCall: = fn_decl @AddressOfCall [template] -// CHECK:STDOUT: %AddressOfType: = fn_decl @AddressOfType [template] -// CHECK:STDOUT: %AddressOfTupleElementValue: = fn_decl @AddressOfTupleElementValue [template] -// CHECK:STDOUT: %AddressOfParam: = fn_decl @AddressOfParam [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %H: = fn_decl @H { +// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32} [template = constants.%.1] +// CHECK:STDOUT: %return.var.loc9: ref {.a: i32} = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %AddressOfLiteral: = fn_decl @AddressOfLiteral {} [template] +// CHECK:STDOUT: %AddressOfOperator: = fn_decl @AddressOfOperator {} [template] +// CHECK:STDOUT: %AddressOfCall: = fn_decl @AddressOfCall {} [template] +// CHECK:STDOUT: %AddressOfType: = fn_decl @AddressOfType {} [template] +// CHECK:STDOUT: %AddressOfTupleElementValue: = fn_decl @AddressOfTupleElementValue {} [template] +// CHECK:STDOUT: %AddressOfParam: = fn_decl @AddressOfParam { +// CHECK:STDOUT: %param.loc78_19.1: i32 = param param +// CHECK:STDOUT: @AddressOfParam.%param: i32 = bind_name param, %param.loc78_19.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32; diff --git a/toolchain/check/testdata/pointer/fail_deref_function.carbon b/toolchain/check/testdata/pointer/fail_deref_function.carbon index e40745e14ae4..c23d013ecfed 100644 --- a/toolchain/check/testdata/pointer/fail_deref_function.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_function.carbon @@ -15,7 +15,7 @@ fn A() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] +// CHECK:STDOUT: %A: = fn_decl @A {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { diff --git a/toolchain/check/testdata/pointer/fail_deref_namespace.carbon b/toolchain/check/testdata/pointer/fail_deref_namespace.carbon index ab7006e3183e..1aa61ba146b8 100644 --- a/toolchain/check/testdata/pointer/fail_deref_namespace.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_namespace.carbon @@ -18,7 +18,7 @@ fn F() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %.loc7, .F = %F} [template] // CHECK:STDOUT: %.loc7: = namespace {} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon index a8ce201f479d..04da39709b7f 100644 --- a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon @@ -30,7 +30,10 @@ fn Deref(n: i32) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Deref = %Deref} [template] -// CHECK:STDOUT: %Deref: = fn_decl @Deref [template] +// CHECK:STDOUT: %Deref: = fn_decl @Deref { +// CHECK:STDOUT: %n.loc7_10.1: i32 = param n +// CHECK:STDOUT: @Deref.%n: i32 = bind_name n, %n.loc7_10.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Deref(%n: i32) { diff --git a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon index 282bc42a66bd..7251ee00f65d 100644 --- a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon @@ -23,7 +23,19 @@ fn ConstMismatch(p: const {}*) -> const ({}*) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.ConstMismatch = %ConstMismatch} [template] -// CHECK:STDOUT: %ConstMismatch: = fn_decl @ConstMismatch [template] +// CHECK:STDOUT: %ConstMismatch: = fn_decl @ConstMismatch { +// CHECK:STDOUT: %.loc7_28.1: {} = struct_literal () +// CHECK:STDOUT: %.loc7_28.2: type = converted %.loc7_28.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_21: type = const_type {} [template = constants.%.2] +// CHECK:STDOUT: %.loc7_29: type = ptr_type const {} [template = constants.%.3] +// CHECK:STDOUT: %p.loc7_18.1: const {}* = param p +// CHECK:STDOUT: @ConstMismatch.%p: const {}* = bind_name p, %p.loc7_18.1 +// CHECK:STDOUT: %.loc7_43.1: {} = struct_literal () +// CHECK:STDOUT: %.loc7_43.2: type = converted %.loc7_43.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_44: type = ptr_type {} [template = constants.%.4] +// CHECK:STDOUT: %.loc7_35: type = const_type {}* [template = constants.%.5] +// CHECK:STDOUT: %return.var: ref const ({}*) = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ConstMismatch(%p: const {}*) -> const ({}*) { diff --git a/toolchain/check/testdata/pointer/nested_const.carbon b/toolchain/check/testdata/pointer/nested_const.carbon index d5c1deb7fde4..fc299cc9e5fb 100644 --- a/toolchain/check/testdata/pointer/nested_const.carbon +++ b/toolchain/check/testdata/pointer/nested_const.carbon @@ -21,7 +21,17 @@ fn F(p: const (const (const i32*)*)) -> const i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc8_23: type = const_type i32 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_32: type = ptr_type const i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_16: type = const_type const i32* [template = constants.%.3] +// CHECK:STDOUT: %.loc8_34: type = ptr_type const (const i32*) [template = constants.%.4] +// CHECK:STDOUT: %.loc8_9: type = const_type const (const i32*)* [template = constants.%.5] +// CHECK:STDOUT: %p.loc8_6.1: const (const (const i32*)*) = param p +// CHECK:STDOUT: @F.%p: const (const (const i32*)*) = bind_name p, %p.loc8_6.1 +// CHECK:STDOUT: %.loc8_41: type = const_type i32 [template = constants.%.1] +// CHECK:STDOUT: %return.var: ref const i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%p: const (const (const i32*)*)) -> const i32 { diff --git a/toolchain/check/testdata/pointer/types.carbon b/toolchain/check/testdata/pointer/types.carbon index cc8893355f52..68a1d90736aa 100644 --- a/toolchain/check/testdata/pointer/types.carbon +++ b/toolchain/check/testdata/pointer/types.carbon @@ -22,8 +22,22 @@ fn ConstPtr(p: const i32*) -> (const i32)* { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Ptr = %Ptr, .ConstPtr = %ConstPtr} [template] -// CHECK:STDOUT: %Ptr: = fn_decl @Ptr [template] -// CHECK:STDOUT: %ConstPtr: = fn_decl @ConstPtr [template] +// CHECK:STDOUT: %Ptr: = fn_decl @Ptr { +// CHECK:STDOUT: %.loc7_14: type = ptr_type i32 [template = constants.%.1] +// CHECK:STDOUT: %p.loc7_8.1: i32* = param p +// CHECK:STDOUT: @Ptr.%p: i32* = bind_name p, %p.loc7_8.1 +// CHECK:STDOUT: %.loc7_23: type = ptr_type i32 [template = constants.%.1] +// CHECK:STDOUT: %return.var.loc7: ref i32* = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %ConstPtr: = fn_decl @ConstPtr { +// CHECK:STDOUT: %.loc11_16: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_25: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %p.loc11_13.1: const i32* = param p +// CHECK:STDOUT: @ConstPtr.%p: const i32* = bind_name p, %p.loc11_13.1 +// CHECK:STDOUT: %.loc11_32: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_42: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %return.var.loc11: ref const i32* = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Ptr(%p: i32*) -> i32* { diff --git a/toolchain/check/testdata/return/code_after_return.carbon b/toolchain/check/testdata/return/code_after_return.carbon index 4e9255c3566d..a98ece7e03c2 100644 --- a/toolchain/check/testdata/return/code_after_return.carbon +++ b/toolchain/check/testdata/return/code_after_return.carbon @@ -17,7 +17,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/return/code_after_return_value.carbon b/toolchain/check/testdata/return/code_after_return_value.carbon index a8917e9636af..ed01be3dcfa0 100644 --- a/toolchain/check/testdata/return/code_after_return_value.carbon +++ b/toolchain/check/testdata/return/code_after_return_value.carbon @@ -28,7 +28,11 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %b.loc7_6.1: bool = param b +// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc7_6.1 +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b: bool) -> i32 { diff --git a/toolchain/check/testdata/return/fail_call_in_type.carbon b/toolchain/check/testdata/return/fail_call_in_type.carbon index 0aaa155c86ac..f47d7f31abaa 100644 --- a/toolchain/check/testdata/return/fail_call_in_type.carbon +++ b/toolchain/check/testdata/return/fail_call_in_type.carbon @@ -20,8 +20,16 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.ReturnType = %ReturnType, .Six = %Six} [template] -// CHECK:STDOUT: %ReturnType: = fn_decl @ReturnType [template] -// CHECK:STDOUT: %Six: = fn_decl @Six [template] +// CHECK:STDOUT: %ReturnType: = fn_decl @ReturnType { +// CHECK:STDOUT: %return.var.loc9: ref type = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %Six: = fn_decl @Six { +// CHECK:STDOUT: %ReturnType.ref: = name_ref ReturnType, %ReturnType [template = %ReturnType] +// CHECK:STDOUT: %.loc13_23.1: init type = call %ReturnType.ref() +// CHECK:STDOUT: %.loc13_24: type = value_of_initializer %.loc13_23.1 +// CHECK:STDOUT: %.loc13_23.2: type = converted %.loc13_23.1, %.loc13_24 +// CHECK:STDOUT: %return.var.loc13: ref = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ReturnType() -> type { diff --git a/toolchain/check/testdata/return/fail_error_in_type.carbon b/toolchain/check/testdata/return/fail_error_in_type.carbon index baa65ec1732d..c836b9128033 100644 --- a/toolchain/check/testdata/return/fail_error_in_type.carbon +++ b/toolchain/check/testdata/return/fail_error_in_type.carbon @@ -13,7 +13,10 @@ fn Six() -> x; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Six = %Six} [template] -// CHECK:STDOUT: %Six: = fn_decl @Six [template] +// CHECK:STDOUT: %Six: = fn_decl @Six { +// CHECK:STDOUT: %x.ref: = name_ref x, [template = ] +// CHECK:STDOUT: %return.var: ref = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> ; diff --git a/toolchain/check/testdata/return/fail_missing_return.carbon b/toolchain/check/testdata/return/fail_missing_return.carbon index c6c37c6518f4..bb3331e35b11 100644 --- a/toolchain/check/testdata/return/fail_missing_return.carbon +++ b/toolchain/check/testdata/return/fail_missing_return.carbon @@ -14,7 +14,9 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { diff --git a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon index 1c5e9d8ca972..85ed9f2c5a69 100644 --- a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon +++ b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon @@ -18,7 +18,11 @@ fn F() -> () { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc7_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %return.var: ref () = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> () { diff --git a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon index 51f8a12ff842..6a28846516a0 100644 --- a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon @@ -15,7 +15,9 @@ fn Procedure() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Procedure = %Procedure} [template] -// CHECK:STDOUT: %Procedure: = fn_decl @Procedure [template] +// CHECK:STDOUT: %Procedure: = fn_decl @Procedure { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Procedure() -> i32 { diff --git a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon index b5078398f88a..a15c2471bb67 100644 --- a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon @@ -42,9 +42,14 @@ fn G() -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .C = %C.decl, .G = %G} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: @G.%return: ref C = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { diff --git a/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon b/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon index c5f95071d6b8..3016bd4d05e5 100644 --- a/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon @@ -23,7 +23,7 @@ fn Procedure() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Procedure = %Procedure} [template] -// CHECK:STDOUT: %Procedure: = fn_decl @Procedure [template] +// CHECK:STDOUT: %Procedure: = fn_decl @Procedure {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Procedure() { diff --git a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon index 3b8012cddeae..23c8721c9f22 100644 --- a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon @@ -44,8 +44,12 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.SameScope = %SameScope, .DifferentScopes = %DifferentScopes} [template] -// CHECK:STDOUT: %SameScope: = fn_decl @SameScope [template] -// CHECK:STDOUT: %DifferentScopes: = fn_decl @DifferentScopes [template] +// CHECK:STDOUT: %SameScope: = fn_decl @SameScope { +// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %DifferentScopes: = fn_decl @DifferentScopes { +// CHECK:STDOUT: %return.var.loc21: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @SameScope() -> i32 { diff --git a/toolchain/check/testdata/return/fail_returned_var_type.carbon b/toolchain/check/testdata/return/fail_returned_var_type.carbon index 3d2a6c3cfde4..a9512f0edc6b 100644 --- a/toolchain/check/testdata/return/fail_returned_var_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_type.carbon @@ -23,7 +23,9 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Mismatch = %Mismatch} [template] -// CHECK:STDOUT: %Mismatch: = fn_decl @Mismatch [template] +// CHECK:STDOUT: %Mismatch: = fn_decl @Mismatch { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Mismatch() -> i32 { diff --git a/toolchain/check/testdata/return/fail_type_mismatch.carbon b/toolchain/check/testdata/return/fail_type_mismatch.carbon index cd85edfd5764..958227962186 100644 --- a/toolchain/check/testdata/return/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/return/fail_type_mismatch.carbon @@ -19,7 +19,9 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { diff --git a/toolchain/check/testdata/return/fail_value_disallowed.carbon b/toolchain/check/testdata/return/fail_value_disallowed.carbon index 819c91b668d7..cbf46da1e39f 100644 --- a/toolchain/check/testdata/return/fail_value_disallowed.carbon +++ b/toolchain/check/testdata/return/fail_value_disallowed.carbon @@ -22,7 +22,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/return/fail_value_missing.carbon b/toolchain/check/testdata/return/fail_value_missing.carbon index 741a9696348b..20f199f2cdb0 100644 --- a/toolchain/check/testdata/return/fail_value_missing.carbon +++ b/toolchain/check/testdata/return/fail_value_missing.carbon @@ -18,7 +18,9 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { diff --git a/toolchain/check/testdata/return/fail_var_in_type.carbon b/toolchain/check/testdata/return/fail_var_in_type.carbon index 8025f7c9b13d..b8300f962478 100644 --- a/toolchain/check/testdata/return/fail_var_in_type.carbon +++ b/toolchain/check/testdata/return/fail_var_in_type.carbon @@ -20,7 +20,11 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: package: = namespace {.x = %x, .Six = %Six} [template] // CHECK:STDOUT: %x.var: ref type = var x // CHECK:STDOUT: %x: ref type = bind_name x, %x.var -// CHECK:STDOUT: %Six: = fn_decl @Six [template] +// CHECK:STDOUT: %Six: = fn_decl @Six { +// CHECK:STDOUT: %x.ref: ref type = name_ref x, %x +// CHECK:STDOUT: %.loc11: type = bind_value %x.ref +// CHECK:STDOUT: %return.var: ref = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { diff --git a/toolchain/check/testdata/return/missing_return_no_return_type.carbon b/toolchain/check/testdata/return/missing_return_no_return_type.carbon index c9b88193bc22..3ddc9ee7b021 100644 --- a/toolchain/check/testdata/return/missing_return_no_return_type.carbon +++ b/toolchain/check/testdata/return/missing_return_no_return_type.carbon @@ -11,7 +11,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/return/no_value.carbon b/toolchain/check/testdata/return/no_value.carbon index 2b7e5e6746e5..620cbfcaf7fd 100644 --- a/toolchain/check/testdata/return/no_value.carbon +++ b/toolchain/check/testdata/return/no_value.carbon @@ -12,7 +12,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/return/returned_var.carbon b/toolchain/check/testdata/return/returned_var.carbon index c84e07d4dc44..188a161b121c 100644 --- a/toolchain/check/testdata/return/returned_var.carbon +++ b/toolchain/check/testdata/return/returned_var.carbon @@ -34,9 +34,14 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.C = %C.decl, .F = %F, .G = %G} [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %C.decl = class_decl @C {} [template = constants.%C] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: @F.%return: ref C = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %return.var.loc17: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { diff --git a/toolchain/check/testdata/return/returned_var_scope.carbon b/toolchain/check/testdata/return/returned_var_scope.carbon index 844bcc1d0daa..0f78d623af12 100644 --- a/toolchain/check/testdata/return/returned_var_scope.carbon +++ b/toolchain/check/testdata/return/returned_var_scope.carbon @@ -33,8 +33,14 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.UnrelatedScopes = %UnrelatedScopes, .EnclosingButAfter = %EnclosingButAfter} [template] -// CHECK:STDOUT: %UnrelatedScopes: = fn_decl @UnrelatedScopes [template] -// CHECK:STDOUT: %EnclosingButAfter: = fn_decl @EnclosingButAfter [template] +// CHECK:STDOUT: %UnrelatedScopes: = fn_decl @UnrelatedScopes { +// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %EnclosingButAfter: = fn_decl @EnclosingButAfter { +// CHECK:STDOUT: %b.loc17_22.1: bool = param b +// CHECK:STDOUT: @EnclosingButAfter.%b: bool = bind_name b, %b.loc17_22.1 +// CHECK:STDOUT: %return.var.loc17: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @UnrelatedScopes() -> i32 { diff --git a/toolchain/check/testdata/return/struct.carbon b/toolchain/check/testdata/return/struct.carbon index 1ecc4d7e9801..a7f728ee6f3c 100644 --- a/toolchain/check/testdata/return/struct.carbon +++ b/toolchain/check/testdata/return/struct.carbon @@ -18,7 +18,10 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main { +// CHECK:STDOUT: %.loc7: type = struct_type {.a: i32} [template = constants.%.1] +// CHECK:STDOUT: %return.var: ref {.a: i32} = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> {.a: i32} { diff --git a/toolchain/check/testdata/return/tuple.carbon b/toolchain/check/testdata/return/tuple.carbon index 42c199c162f4..9fbbc3589fbe 100644 --- a/toolchain/check/testdata/return/tuple.carbon +++ b/toolchain/check/testdata/return/tuple.carbon @@ -22,7 +22,11 @@ fn Main() -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main { +// CHECK:STDOUT: %.loc8_23.1: (type, type) = tuple_literal (i32, i32) +// CHECK:STDOUT: %.loc8_23.2: type = converted %.loc8_23.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: @Main.%return: ref (i32, i32) = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> %return: (i32, i32) { diff --git a/toolchain/check/testdata/return/value.carbon b/toolchain/check/testdata/return/value.carbon index 19155062d46a..a5de37fb2082 100644 --- a/toolchain/check/testdata/return/value.carbon +++ b/toolchain/check/testdata/return/value.carbon @@ -16,7 +16,9 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main { +// CHECK:STDOUT: %return.var: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { diff --git a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon index 262341d15ec9..c2b4f75468f1 100644 --- a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon +++ b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon @@ -14,7 +14,7 @@ fn F() { a.b; } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/struct/fail_duplicate_name.carbon b/toolchain/check/testdata/struct/fail_duplicate_name.carbon index ccb2a075fce7..23925f176467 100644 --- a/toolchain/check/testdata/struct/fail_duplicate_name.carbon +++ b/toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -58,7 +58,9 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .x = %x, .y = %y} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var: ref = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: %.loc21_35: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc21_36: {.a: i32} = struct_literal (%.loc21_35) // CHECK:STDOUT: %v: = bind_name v, diff --git a/toolchain/check/testdata/struct/fail_member_of_function.carbon b/toolchain/check/testdata/struct/fail_member_of_function.carbon index a26067a980b3..b2392fca130f 100644 --- a/toolchain/check/testdata/struct/fail_member_of_function.carbon +++ b/toolchain/check/testdata/struct/fail_member_of_function.carbon @@ -15,7 +15,7 @@ fn A() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] +// CHECK:STDOUT: %A: = fn_decl @A {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { diff --git a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon index 8c98c4835d5a..efc5069154bd 100644 --- a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon @@ -26,7 +26,7 @@ var p: Incomplete* = &s.a; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Incomplete = %Incomplete.decl, .s = %s, .p = %p} [template] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete {} [template = constants.%Incomplete] // CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] // CHECK:STDOUT: %.loc15: type = struct_type {.a: Incomplete} [template = constants.%.1] // CHECK:STDOUT: %s.var: ref = var s diff --git a/toolchain/check/testdata/struct/literal_member_access.carbon b/toolchain/check/testdata/struct/literal_member_access.carbon index c1ae525e7947..e2782aedec9d 100644 --- a/toolchain/check/testdata/struct/literal_member_access.carbon +++ b/toolchain/check/testdata/struct/literal_member_access.carbon @@ -24,8 +24,13 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.G = %G, .F = %F} [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %.loc7: type = struct_type {.x: i32, .y: i32, .z: i32} [template = constants.%.1] +// CHECK:STDOUT: @G.%return: ref {.x: i32, .y: i32, .z: i32} = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var.loc9: ref i32 = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> %return: {.x: i32, .y: i32, .z: i32}; diff --git a/toolchain/check/testdata/struct/nested_struct_in_place.carbon b/toolchain/check/testdata/struct/nested_struct_in_place.carbon index 88ec7ca56819..4012e8da8b1e 100644 --- a/toolchain/check/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/check/testdata/struct/nested_struct_in_place.carbon @@ -23,8 +23,12 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc7_25.1: (type, type, type) = tuple_literal (i32, i32, i32) +// CHECK:STDOUT: %.loc7_25.2: type = converted %.loc7_25.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: @F.%return: ref (i32, i32, i32) = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: (i32, i32, i32); diff --git a/toolchain/check/testdata/struct/reorder_fields.carbon b/toolchain/check/testdata/struct/reorder_fields.carbon index cdc8057e5eb1..aabd10d911ea 100644 --- a/toolchain/check/testdata/struct/reorder_fields.carbon +++ b/toolchain/check/testdata/struct/reorder_fields.carbon @@ -24,9 +24,16 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.MakeI32 = %MakeI32, .MakeF64 = %MakeF64, .F = %F} [template] -// CHECK:STDOUT: %MakeI32: = fn_decl @MakeI32 [template] -// CHECK:STDOUT: %MakeF64: = fn_decl @MakeF64 [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %MakeI32: = fn_decl @MakeI32 { +// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %MakeF64: = fn_decl @MakeF64 { +// CHECK:STDOUT: %return.var.loc8: ref f64 = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32, .b: f64} [template = constants.%.1] +// CHECK:STDOUT: @F.%return: ref {.a: i32, .b: f64} = var +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeI32() -> i32; diff --git a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon index 46413efc2015..bb8c608af10e 100644 --- a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon @@ -28,7 +28,7 @@ var p: Incomplete* = &t[1]; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Incomplete = %Incomplete.decl, .t = %t, .p = %p} [template] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete {} [template = constants.%Incomplete] // CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] // CHECK:STDOUT: %.loc15_24.1: (type, type) = tuple_literal (i32, %Incomplete.ref.loc15) // CHECK:STDOUT: %.loc15_24.2: type = converted %.loc15_24.1, constants.%.2 [template = constants.%.2] diff --git a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon index bf63724b711d..cfc03004944f 100644 --- a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon +++ b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon @@ -34,9 +34,13 @@ fn H() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .G = %G, .H = %H} [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %H: = fn_decl @H [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %.loc7_25.1: (type, type, type) = tuple_literal (i32, i32, i32) +// CHECK:STDOUT: %.loc7_25.2: type = converted %.loc7_25.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: @F.%return: ref (i32, i32, i32) = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] +// CHECK:STDOUT: %H: = fn_decl @H {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: (i32, i32, i32); diff --git a/toolchain/check/testdata/var/decl.carbon b/toolchain/check/testdata/var/decl.carbon index 27ba0c24dc02..d06183da7ca0 100644 --- a/toolchain/check/testdata/var/decl.carbon +++ b/toolchain/check/testdata/var/decl.carbon @@ -12,7 +12,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/decl_with_init.carbon b/toolchain/check/testdata/var/decl_with_init.carbon index 85a897b94064..b8213445965d 100644 --- a/toolchain/check/testdata/var/decl_with_init.carbon +++ b/toolchain/check/testdata/var/decl_with_init.carbon @@ -16,7 +16,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/fail_duplicate_decl.carbon b/toolchain/check/testdata/var/fail_duplicate_decl.carbon index 6e5916fc9c95..6a68af32d14d 100644 --- a/toolchain/check/testdata/var/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/var/fail_duplicate_decl.carbon @@ -24,7 +24,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/fail_generic.carbon b/toolchain/check/testdata/var/fail_generic.carbon index 48d17363959c..c4cce06fb36e 100644 --- a/toolchain/check/testdata/var/fail_generic.carbon +++ b/toolchain/check/testdata/var/fail_generic.carbon @@ -19,7 +19,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/fail_init_type_mismatch.carbon b/toolchain/check/testdata/var/fail_init_type_mismatch.carbon index 94ebfccaa0f4..ede540b97f07 100644 --- a/toolchain/check/testdata/var/fail_init_type_mismatch.carbon +++ b/toolchain/check/testdata/var/fail_init_type_mismatch.carbon @@ -19,7 +19,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/fail_init_with_self.carbon b/toolchain/check/testdata/var/fail_init_with_self.carbon index 8fc7970bee8b..853d3e98b337 100644 --- a/toolchain/check/testdata/var/fail_init_with_self.carbon +++ b/toolchain/check/testdata/var/fail_init_with_self.carbon @@ -15,7 +15,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon b/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon index 2e84a945e1e8..e48499beff84 100644 --- a/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon +++ b/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon @@ -17,7 +17,7 @@ var y: i32 = x; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main, .y = %y} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/fail_not_copyable.carbon b/toolchain/check/testdata/var/fail_not_copyable.carbon index 870629578207..d635ae7c0c97 100644 --- a/toolchain/check/testdata/var/fail_not_copyable.carbon +++ b/toolchain/check/testdata/var/fail_not_copyable.carbon @@ -35,8 +35,12 @@ fn F(x: X) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.X = %X.decl, .F = %F} [template] -// CHECK:STDOUT: %X.decl = class_decl @X, () [template = constants.%X] -// CHECK:STDOUT: %F: = fn_decl @F [template] +// CHECK:STDOUT: %X.decl = class_decl @X {} [template = constants.%X] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %X.ref: type = name_ref X, %X.decl [template = constants.%X] +// CHECK:STDOUT: %x.loc10_6.1: X = param x +// CHECK:STDOUT: @F.%x: X = bind_name x, %x.loc10_6.1 +// CHECK:STDOUT: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @X { diff --git a/toolchain/check/testdata/var/fail_storage_is_literal.carbon b/toolchain/check/testdata/var/fail_storage_is_literal.carbon index bc136487f917..55468b42463d 100644 --- a/toolchain/check/testdata/var/fail_storage_is_literal.carbon +++ b/toolchain/check/testdata/var/fail_storage_is_literal.carbon @@ -19,7 +19,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/global_lookup_in_scope.carbon b/toolchain/check/testdata/var/global_lookup_in_scope.carbon index 4ef62dccf083..68ad784592a7 100644 --- a/toolchain/check/testdata/var/global_lookup_in_scope.carbon +++ b/toolchain/check/testdata/var/global_lookup_in_scope.carbon @@ -20,7 +20,7 @@ fn Main() { // CHECK:STDOUT: package: = namespace {.x = %x, .Main = %Main} [template] // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/lookup.carbon b/toolchain/check/testdata/var/lookup.carbon index 3d1e2dde777a..6df3b2ed510c 100644 --- a/toolchain/check/testdata/var/lookup.carbon +++ b/toolchain/check/testdata/var/lookup.carbon @@ -17,7 +17,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Main = %Main} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/shadowing.carbon b/toolchain/check/testdata/var/shadowing.carbon index 6802a017af5c..2253163fa88d 100644 --- a/toolchain/check/testdata/var/shadowing.carbon +++ b/toolchain/check/testdata/var/shadowing.carbon @@ -30,7 +30,7 @@ fn Main() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.NS = %.loc7, .Main = %Main} [template] // CHECK:STDOUT: %.loc7: = namespace {} [template] -// CHECK:STDOUT: %Main: = fn_decl @Main [template] +// CHECK:STDOUT: %Main: = fn_decl @Main {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/while/break_continue.carbon b/toolchain/check/testdata/while/break_continue.carbon index b4c69703582b..e2303fc698c9 100644 --- a/toolchain/check/testdata/while/break_continue.carbon +++ b/toolchain/check/testdata/while/break_continue.carbon @@ -30,15 +30,31 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A, .B = %B, .C = %C, .D = %D, .E = %E, .F = %F, .G = %G, .H = %H, .While = %While} [template] -// CHECK:STDOUT: %A: = fn_decl @A [template] -// CHECK:STDOUT: %B: = fn_decl @B [template] -// CHECK:STDOUT: %C: = fn_decl @C [template] -// CHECK:STDOUT: %D: = fn_decl @D [template] -// CHECK:STDOUT: %E: = fn_decl @E [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %H: = fn_decl @H [template] -// CHECK:STDOUT: %While: = fn_decl @While [template] +// CHECK:STDOUT: %A: = fn_decl @A { +// CHECK:STDOUT: %return.var.loc7: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %B: = fn_decl @B { +// CHECK:STDOUT: %return.var.loc8: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %C: = fn_decl @C { +// CHECK:STDOUT: %return.var.loc9: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %D: = fn_decl @D { +// CHECK:STDOUT: %return.var.loc10: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %E: = fn_decl @E { +// CHECK:STDOUT: %return.var.loc11: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %F: = fn_decl @F { +// CHECK:STDOUT: %return.var.loc12: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %G: = fn_decl @G { +// CHECK:STDOUT: %return.var.loc13: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %H: = fn_decl @H { +// CHECK:STDOUT: %return.var.loc14: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %While: = fn_decl @While {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> bool; diff --git a/toolchain/check/testdata/while/fail_bad_condition.carbon b/toolchain/check/testdata/while/fail_bad_condition.carbon index 0edd38036334..049cf67c321c 100644 --- a/toolchain/check/testdata/while/fail_bad_condition.carbon +++ b/toolchain/check/testdata/while/fail_bad_condition.carbon @@ -20,7 +20,7 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.While = %While} [template] -// CHECK:STDOUT: %While: = fn_decl @While [template] +// CHECK:STDOUT: %While: = fn_decl @While {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @While() { diff --git a/toolchain/check/testdata/while/fail_break_continue.carbon b/toolchain/check/testdata/while/fail_break_continue.carbon index 8f806d689696..63569aaeaccf 100644 --- a/toolchain/check/testdata/while/fail_break_continue.carbon +++ b/toolchain/check/testdata/while/fail_break_continue.carbon @@ -35,7 +35,7 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.While = %While} [template] -// CHECK:STDOUT: %While: = fn_decl @While [template] +// CHECK:STDOUT: %While: = fn_decl @While {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @While() { diff --git a/toolchain/check/testdata/while/unreachable_end.carbon b/toolchain/check/testdata/while/unreachable_end.carbon index 35478715edf8..434935958cda 100644 --- a/toolchain/check/testdata/while/unreachable_end.carbon +++ b/toolchain/check/testdata/while/unreachable_end.carbon @@ -27,11 +27,13 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Cond = %Cond, .F = %F, .G = %G, .H = %H, .While = %While} [template] -// CHECK:STDOUT: %Cond: = fn_decl @Cond [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %H: = fn_decl @H [template] -// CHECK:STDOUT: %While: = fn_decl @While [template] +// CHECK:STDOUT: %Cond: = fn_decl @Cond { +// CHECK:STDOUT: %return.var: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] +// CHECK:STDOUT: %H: = fn_decl @H {} [template] +// CHECK:STDOUT: %While: = fn_decl @While {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Cond() -> bool; diff --git a/toolchain/check/testdata/while/while.carbon b/toolchain/check/testdata/while/while.carbon index 47fc7ff2a716..d5c37c1d2c6d 100644 --- a/toolchain/check/testdata/while/while.carbon +++ b/toolchain/check/testdata/while/while.carbon @@ -26,11 +26,13 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Cond = %Cond, .F = %F, .G = %G, .H = %H, .While = %While} [template] -// CHECK:STDOUT: %Cond: = fn_decl @Cond [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %H: = fn_decl @H [template] -// CHECK:STDOUT: %While: = fn_decl @While [template] +// CHECK:STDOUT: %Cond: = fn_decl @Cond { +// CHECK:STDOUT: %return.var: ref bool = var +// CHECK:STDOUT: } [template] +// CHECK:STDOUT: %F: = fn_decl @F {} [template] +// CHECK:STDOUT: %G: = fn_decl @G {} [template] +// CHECK:STDOUT: %H: = fn_decl @H {} [template] +// CHECK:STDOUT: %While: = fn_decl @While {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Cond() -> bool; diff --git a/toolchain/sem_ir/formatter.cpp b/toolchain/sem_ir/formatter.cpp index 825da1f71dd9..a62eab0b9a6f 100644 --- a/toolchain/sem_ir/formatter.cpp +++ b/toolchain/sem_ir/formatter.cpp @@ -481,16 +481,11 @@ class InstNamer { .name_id); continue; } - case FunctionDecl::Kind: { - add_inst_name_id(sem_ir_.functions() - .Get(inst.As().function_id) - .name_id); - continue; - } case ClassDecl::Kind: { add_inst_name_id( sem_ir_.classes().Get(inst.As().class_id).name_id, ".decl"); + CollectNamesInBlock(scope_id, inst.As().decl_block_id); continue; } case ClassType::Kind: { @@ -498,6 +493,17 @@ class InstNamer { sem_ir_.classes().Get(inst.As().class_id).name_id); continue; } + case FunctionDecl::Kind: { + add_inst_name_id(sem_ir_.functions() + .Get(inst.As().function_id) + .name_id); + CollectNamesInBlock(scope_id, inst.As().decl_block_id); + continue; + } + case ImplDecl::Kind: { + CollectNamesInBlock(scope_id, inst.As().decl_block_id); + break; + } case Import::Kind: { add_inst_name("import"); continue; @@ -519,6 +525,7 @@ class InstNamer { .Get(inst.As().interface_id) .name_id, ".decl"); + CollectNamesInBlock(scope_id, inst.As().decl_block_id); continue; } case NameRef::Kind: { @@ -756,6 +763,18 @@ class Formatter { } } + auto FormatTrailingBlock(InstBlockId block_id) -> void { + out_ << " {"; + if (!sem_ir_.inst_blocks().Get(block_id).empty()) { + out_ << "\n"; + indent_ += 2; + FormatCodeBlock(block_id); + indent_ -= 2; + Indent(); + } + out_ << "}"; + } + auto FormatNameScope(NameScopeId id, llvm::StringRef separator, llvm::StringRef prefix) -> void { const auto& scope = sem_ir_.name_scopes().Get(id); @@ -999,6 +1018,26 @@ class Formatter { FormatReturnSlot(init.dest_id); } + auto FormatInstructionRHS(FunctionDecl inst) -> void { + FormatArgs(inst.function_id); + FormatTrailingBlock(inst.decl_block_id); + } + + auto FormatInstructionRHS(ClassDecl inst) -> void { + FormatArgs(inst.class_id); + FormatTrailingBlock(inst.decl_block_id); + } + + auto FormatInstructionRHS(ImplDecl inst) -> void { + FormatArgs(inst.impl_id); + FormatTrailingBlock(inst.decl_block_id); + } + + auto FormatInstructionRHS(InterfaceDecl inst) -> void { + FormatArgs(inst.interface_id); + FormatTrailingBlock(inst.decl_block_id); + } + auto FormatInstructionRHS(ImportRefUnused inst) -> void { // Don't format the inst_id because it refers to a different IR. // TODO: Consider a better way to format the InstID from other IRs. @@ -1013,15 +1052,7 @@ class Formatter { auto FormatInstructionRHS(SpliceBlock inst) -> void { FormatArgs(inst.result_id); - out_ << " {"; - if (!sem_ir_.inst_blocks().Get(inst.block_id).empty()) { - out_ << "\n"; - indent_ += 2; - FormatCodeBlock(inst.block_id); - indent_ -= 2; - Indent(); - } - out_ << "}"; + FormatTrailingBlock(inst.block_id); } // StructTypeFields are formatted as part of their StructType. diff --git a/toolchain/sem_ir/typed_insts.h b/toolchain/sem_ir/typed_insts.h index f6d189587485..16ed2d87e77a 100644 --- a/toolchain/sem_ir/typed_insts.h +++ b/toolchain/sem_ir/typed_insts.h @@ -422,6 +422,9 @@ struct FunctionDecl { TypeId type_id; FunctionId function_id; + // The declaration block, containing the function declaration's parameters and + // their types. + InstBlockId decl_block_id; }; struct ImplDecl {