diff --git a/toolchain/check/BUILD b/toolchain/check/BUILD index 7fa0bc3e85cf..fafcab22f1e4 100644 --- a/toolchain/check/BUILD +++ b/toolchain/check/BUILD @@ -177,6 +177,7 @@ cc_library( deps = [ ":context", "//common:check", + "//toolchain/base:kind_switch", "//toolchain/diagnostics:diagnostic_emitter", "//toolchain/sem_ir:file", "//toolchain/sem_ir:ids", @@ -222,6 +223,7 @@ cc_library( deps = [ ":context", "//common:check", + "//toolchain/base:kind_switch", "//toolchain/diagnostics:diagnostic_emitter", "//toolchain/sem_ir:file", "//toolchain/sem_ir:ids", diff --git a/toolchain/check/call.cpp b/toolchain/check/call.cpp index 841bb156e948..5d2dbfebe8e7 100644 --- a/toolchain/check/call.cpp +++ b/toolchain/check/call.cpp @@ -15,38 +15,18 @@ namespace Carbon::Check { auto PerformCall(Context& context, Parse::NodeId node_id, SemIR::InstId callee_id, llvm::ArrayRef arg_ids) -> SemIR::InstId { - auto diagnose_not_callable = [&] { - auto callee_type_id = context.insts().Get(callee_id).type_id(); - if (callee_type_id != SemIR::TypeId::Error) { + // Identify the function we're calling. + auto callee_function = GetCalleeFunction(context.sem_ir(), callee_id); + if (!callee_function.function_id.is_valid()) { + if (!callee_function.is_error) { CARBON_DIAGNOSTIC(CallToNonCallable, Error, "Value of type `{0}` is not callable.", SemIR::TypeId); - context.emitter().Emit(node_id, CallToNonCallable, callee_type_id); + context.emitter().Emit(node_id, CallToNonCallable, + context.insts().Get(callee_id).type_id()); } return SemIR::InstId::BuiltinError; - }; - - // For a method call, pick out the `self` value. - auto function_callee_id = callee_id; - SemIR::InstId self_id = SemIR::InstId::Invalid; - if (auto bound_method = - context.insts().Get(callee_id).TryAs()) { - self_id = bound_method->object_id; - function_callee_id = bound_method->function_id; } - - // Identify the function we're calling. - auto function_decl_id = context.constant_values().Get(function_callee_id); - if (!function_decl_id.is_constant()) { - return diagnose_not_callable(); - } - auto function_decl = context.insts() - .Get(function_decl_id.inst_id()) - .TryAs(); - if (!function_decl) { - return diagnose_not_callable(); - } - auto function_id = function_decl->function_id; - auto& callable = context.functions().Get(function_id); + auto& callable = context.functions().Get(callee_function.function_id); // For functions with an implicit return type, the return type is the empty // tuple type. @@ -85,8 +65,8 @@ auto PerformCall(Context& context, Parse::NodeId node_id, // Convert the arguments to match the parameters. auto converted_args_id = - ConvertCallArgs(context, node_id, self_id, arg_ids, return_storage_id, - function_decl_id.inst_id(), + ConvertCallArgs(context, node_id, callee_function.self_id, arg_ids, + return_storage_id, callable.decl_id, callable.implicit_param_refs_id, callable.param_refs_id); auto call_inst_id = context.AddInst( {node_id, SemIR::Call{type_id, callee_id, converted_args_id}}); diff --git a/toolchain/check/context.cpp b/toolchain/check/context.cpp index 1c80bec14e17..e5dd1c22111b 100644 --- a/toolchain/check/context.cpp +++ b/toolchain/check/context.cpp @@ -814,7 +814,6 @@ class TypeCompleter { case SemIR::BuiltinKind::IntType: case SemIR::BuiltinKind::FloatType: case SemIR::BuiltinKind::NamespaceType: - case SemIR::BuiltinKind::FunctionType: case SemIR::BuiltinKind::BoundMethodType: case SemIR::BuiltinKind::WitnessType: return MakeCopyValueRepr(type_id); @@ -956,6 +955,7 @@ class TypeCompleter { SemIR::ValueRepr::ObjectAggregate); } case SemIR::AssociatedEntityType::Kind: + case SemIR::FunctionType::Kind: case SemIR::InterfaceType::Kind: case SemIR::UnboundElementType::Kind: { // These types have no runtime operations, so we use an empty value @@ -1065,6 +1065,14 @@ auto Context::GetBuiltinType(SemIR::BuiltinKind kind) -> SemIR::TypeId { return type_id; } +auto Context::GetFunctionType(SemIR::FunctionId fn_id) -> SemIR::TypeId { + auto type_id = GetTypeImpl(*this, fn_id); + // To keep client code simpler, complete function types before returning them. + bool complete = TryToCompleteType(type_id); + CARBON_CHECK(complete) << "Failed to complete function type"; + return type_id; +} + auto Context::GetPointerType(SemIR::TypeId pointee_type_id) -> SemIR::TypeId { return GetTypeImpl(*this, pointee_type_id); } diff --git a/toolchain/check/context.h b/toolchain/check/context.h index 9e99ebd0511b..f566037500db 100644 --- a/toolchain/check/context.h +++ b/toolchain/check/context.h @@ -240,6 +240,9 @@ class Context { // Gets a builtin type. The returned type will be complete. auto GetBuiltinType(SemIR::BuiltinKind kind) -> SemIR::TypeId; + // Gets a function type. The returned type will be complete. + auto GetFunctionType(SemIR::FunctionId fn_id) -> SemIR::TypeId; + // Returns a pointer type whose pointee type is `pointee_type_id`. auto GetPointerType(SemIR::TypeId pointee_type_id) -> SemIR::TypeId; diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index c58aa6e9dea5..2ce566b0cf9b 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -8,6 +8,7 @@ #include "toolchain/check/diagnostic_helpers.h" #include "toolchain/diagnostics/diagnostic_emitter.h" #include "toolchain/sem_ir/builtin_function_kind.h" +#include "toolchain/sem_ir/function.h" #include "toolchain/sem_ir/ids.h" #include "toolchain/sem_ir/typed_insts.h" @@ -687,10 +688,12 @@ static auto PerformBuiltinFloatComparison( return MakeBoolResult(context, bool_type_id, result); } -static auto PerformBuiltinCall(Context& context, SemIRLoc loc, SemIR::Call call, - SemIR::BuiltinFunctionKind builtin_kind, - llvm::ArrayRef arg_ids, - Phase phase) -> SemIR::ConstantId { +// Returns a constant for a call to a builtin function. +static auto MakeConstantForBuiltinCall(Context& context, SemIRLoc loc, + SemIR::Call call, + SemIR::BuiltinFunctionKind builtin_kind, + llvm::ArrayRef arg_ids, + Phase phase) -> SemIR::ConstantId { switch (builtin_kind) { case SemIR::BuiltinFunctionKind::None: CARBON_FATAL() << "Not a builtin function."; @@ -810,8 +813,9 @@ static auto PerformBuiltinCall(Context& context, SemIRLoc loc, SemIR::Call call, return SemIR::ConstantId::NotConstant; } -static auto PerformCall(Context& context, SemIRLoc loc, SemIR::Call call) - -> SemIR::ConstantId { +// Makes a constant for a call instruction. +static auto MakeConstantForCall(Context& context, SemIRLoc loc, + SemIR::Call call) -> SemIR::ConstantId { Phase phase = Phase::Template; // A call with an invalid argument list is used to represent an erroneous @@ -828,10 +832,15 @@ static auto PerformCall(Context& context, SemIRLoc loc, SemIR::Call call) return SemIR::ConstantId::NotConstant; } + auto callee_function = + SemIR::GetCalleeFunction(context.sem_ir(), call.callee_id); + if (!callee_function.function_id.is_valid()) { + return SemIR::ConstantId::Error; + } + const auto& function = context.functions().Get(callee_function.function_id); + // Handle calls to builtins. - if (auto builtin_function_kind = SemIR::BuiltinFunctionKind::ForCallee( - context.sem_ir(), call.callee_id); - builtin_function_kind != SemIR::BuiltinFunctionKind::None) { + if (function.builtin_kind != SemIR::BuiltinFunctionKind::None) { if (!ReplaceFieldWithConstantValue(context, &call, &SemIR::Call::args_id, &phase)) { return SemIR::ConstantId::NotConstant; @@ -839,8 +848,9 @@ static auto PerformCall(Context& context, SemIRLoc loc, SemIR::Call call) if (phase == Phase::UnknownDueToError) { return SemIR::ConstantId::Error; } - return PerformBuiltinCall(context, loc, call, builtin_function_kind, - context.inst_blocks().Get(call.args_id), phase); + return MakeConstantForBuiltinCall(context, loc, call, function.builtin_kind, + context.inst_blocks().Get(call.args_id), + phase); } return SemIR::ConstantId::NotConstant; } @@ -955,9 +965,17 @@ auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst) case SemIR::AssociatedEntity::Kind: case SemIR::Builtin::Kind: + case SemIR::FunctionType::Kind: // Builtins are always template constants. return MakeConstantResult(context, inst, Phase::Template); + case CARBON_KIND(SemIR::FunctionDecl fn_decl): { + return MakeConstantResult( + context, + SemIR::StructValue{fn_decl.type_id, SemIR::InstBlockId::Empty}, + Phase::Template); + } + case CARBON_KIND(SemIR::ClassDecl class_decl): { // TODO: Once classes have generic arguments, handle them. return MakeConstantResult( @@ -986,7 +1004,6 @@ auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst) case SemIR::AssociatedConstantDecl::Kind: case SemIR::BaseDecl::Kind: case SemIR::FieldDecl::Kind: - case SemIR::FunctionDecl::Kind: case SemIR::Namespace::Kind: return SemIR::ConstantId::ForTemplateConstant(inst_id); @@ -1012,7 +1029,7 @@ auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst) return PerformAggregateIndex(context, inst); case CARBON_KIND(SemIR::Call call): { - return PerformCall(context, inst_id, call); + return MakeConstantForCall(context, inst_id, call); } // TODO: These need special handling. diff --git a/toolchain/check/handle_function.cpp b/toolchain/check/handle_function.cpp index 0fdf5f233df8..b0d694076861 100644 --- a/toolchain/check/handle_function.cpp +++ b/toolchain/check/handle_function.cpp @@ -2,6 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include "toolchain/base/kind_switch.h" #include "toolchain/check/context.h" #include "toolchain/check/convert.h" #include "toolchain/check/decl_name_stack.h" @@ -60,6 +61,55 @@ static auto DiagnoseModifiers(Context& context, bool is_definition, return context.decl_state_stack().innermost().modifier_set; } +// Returns the function ID for the instruction, or invalid. +static auto GetRedeclFunctionId(Context& context, SemIR::Inst prev_inst) + -> SemIR::FunctionId { + CARBON_KIND_SWITCH(prev_inst) { + case CARBON_KIND(SemIR::StructValue struct_value): { + if (auto fn_type = context.types().TryGetAs( + struct_value.type_id)) { + return fn_type->function_id; + } + return SemIR::FunctionId::Invalid; + } + case CARBON_KIND(SemIR::FunctionDecl fn_decl): { + return fn_decl.function_id; + } + default: + // This is a redeclaration of something other than a function. This + // includes the case where an associated function redeclares another + // associated function. + return SemIR::FunctionId::Invalid; + } +} + +// Check whether this is a redeclaration, merging if needed. +static auto TryMergeRedecl(Context& context, Parse::AnyFunctionDeclId node_id, + SemIR::InstId prev_id, + SemIR::FunctionDecl& function_decl, + SemIR::Function& function_info, bool is_definition) + -> void { + if (!prev_id.is_valid()) { + return; + } + + auto prev_inst_for_merge = ResolvePrevInstForMerge(context, node_id, prev_id); + auto prev_function_id = + GetRedeclFunctionId(context, prev_inst_for_merge.inst); + if (!prev_function_id.is_valid()) { + context.DiagnoseDuplicateName(function_info.decl_id, prev_id); + return; + } + + if (MergeFunctionRedecl(context, node_id, function_info, + /*new_is_import=*/false, is_definition, + prev_function_id, + prev_inst_for_merge.import_ir_inst_id)) { + // When merging, use the existing function rather than adding a new one. + function_decl.function_id = prev_function_id; + } +} + // Build a FunctionDecl describing the signature of a function. This // handles the common logic shared by function declaration syntax and function // definition syntax. @@ -116,8 +166,7 @@ static auto BuildFunctionDecl(Context& context, // Add the function declaration. auto function_decl = SemIR::FunctionDecl{ - context.GetBuiltinType(SemIR::BuiltinKind::FunctionType), - SemIR::FunctionId::Invalid, decl_block_id}; + SemIR::TypeId::Invalid, SemIR::FunctionId::Invalid, decl_block_id}; auto function_info = SemIR::Function{ .name_id = name_context.name_id_for_new_inst(), .enclosing_scope_id = name_context.enclosing_scope_id_for_new_inst(), @@ -132,40 +181,21 @@ static auto BuildFunctionDecl(Context& context, function_info.definition_id = function_info.decl_id; } - // Check whether this is a redeclaration. - auto prev_id = name_context.prev_inst_id(); - if (prev_id.is_valid()) { - auto prev_inst_for_merge = - ResolvePrevInstForMerge(context, node_id, prev_id); - - if (auto prev_function_decl = - prev_inst_for_merge.inst.TryAs()) { - if (MergeFunctionRedecl(context, node_id, function_info, - /*new_is_import=*/false, is_definition, - prev_function_decl->function_id, - prev_inst_for_merge.import_ir_inst_id)) { - // When merging, use the existing function rather than adding a new one. - function_decl.function_id = prev_function_decl->function_id; - } - } else { - // This is a redeclaration of something other than a function. This - // includes the case where an associated function redeclares another - // associated function. - context.DiagnoseDuplicateName(function_info.decl_id, prev_id); - } - } + TryMergeRedecl(context, node_id, name_context.prev_inst_id(), function_decl, + function_info, is_definition); // Create a new function if this isn't a valid redeclaration. if (!function_decl.function_id.is_valid()) { function_decl.function_id = context.functions().Add(function_info); } + function_decl.type_id = context.GetFunctionType(function_decl.function_id); // Write the function ID into the FunctionDecl. context.ReplaceInstBeforeConstantUse(function_info.decl_id, function_decl); // Check if we need to add this to name lookup, now that the function decl is // done. - if (!prev_id.is_valid()) { + if (!name_context.prev_inst_id().is_valid()) { // At interface scope, a function declaration introduces an associated // function. auto lookup_result_id = function_info.decl_id; diff --git a/toolchain/check/impl.cpp b/toolchain/check/impl.cpp index 7853ae554bb1..60da6cecb4a2 100644 --- a/toolchain/check/impl.cpp +++ b/toolchain/check/impl.cpp @@ -4,6 +4,7 @@ #include "toolchain/check/impl.h" +#include "toolchain/base/kind_switch.h" #include "toolchain/check/context.h" #include "toolchain/check/function.h" #include "toolchain/check/import_ref.h" @@ -93,34 +94,45 @@ static auto BuildInterfaceWitness( auto const_id = context.constant_values().Get(decl_id); CARBON_CHECK(const_id.is_constant()) << "Non-constant associated entity"; auto decl = context.insts().Get(const_id.inst_id()); - if (auto fn_decl = decl.TryAs()) { - auto& fn = context.functions().Get(fn_decl->function_id); - auto impl_decl_id = context.LookupNameInExactScope( - decl_id, fn.name_id, impl_scope, /*mark_imports_used=*/true); - if (impl_decl_id.is_valid()) { - used_decl_ids.push_back(impl_decl_id); - table.push_back(CheckAssociatedFunctionImplementation( - context, fn_decl->function_id, impl_decl_id, substitutions)); - } else { - CARBON_DIAGNOSTIC( - ImplMissingFunction, Error, - "Missing implementation of {0} in impl of interface {1}.", - SemIR::NameId, SemIR::NameId); - auto builder = - context.emitter().Build(impl.definition_id, ImplMissingFunction, - fn.name_id, interface.name_id); - NoteAssociatedFunction(context, builder, fn_decl->function_id); - builder.Emit(); + CARBON_KIND_SWITCH(decl) { + case CARBON_KIND(SemIR::StructValue struct_value): { + if (struct_value.type_id == SemIR::TypeId::Error) { + return SemIR::InstId::BuiltinError; + } + auto type_inst = context.types().GetAsInst(struct_value.type_id); + auto fn_type = type_inst.TryAs(); + if (!fn_type) { + CARBON_FATAL() << "Unexpected type: " << type_inst; + } + auto& fn = context.functions().Get(fn_type->function_id); + auto impl_decl_id = context.LookupNameInExactScope( + decl_id, fn.name_id, impl_scope, /*mark_imports_used=*/true); + if (impl_decl_id.is_valid()) { + used_decl_ids.push_back(impl_decl_id); + table.push_back(CheckAssociatedFunctionImplementation( + context, fn_type->function_id, impl_decl_id, substitutions)); + } else { + CARBON_DIAGNOSTIC( + ImplMissingFunction, Error, + "Missing implementation of {0} in impl of interface {1}.", + SemIR::NameId, SemIR::NameId); + auto builder = + context.emitter().Build(impl.definition_id, ImplMissingFunction, + fn.name_id, interface.name_id); + NoteAssociatedFunction(context, builder, fn_type->function_id); + builder.Emit(); - table.push_back(SemIR::InstId::BuiltinError); + table.push_back(SemIR::InstId::BuiltinError); + } + break; } - } else if (auto const_decl = decl.TryAs()) { - // TODO: Check we have a value for this constant in the constraint. - context.TODO(impl.definition_id, - "impl of interface with associated constant"); - return SemIR::InstId::BuiltinError; - } else { - CARBON_FATAL() << "Unexpected kind of associated entity " << decl; + case SemIR::AssociatedConstantDecl::Kind: + // TODO: Check we have a value for this constant in the constraint. + context.TODO(impl.definition_id, + "impl of interface with associated constant"); + return SemIR::InstId::BuiltinError; + default: + CARBON_FATAL() << "Unexpected kind of associated entity " << decl; } } diff --git a/toolchain/check/import_ref.cpp b/toolchain/check/import_ref.cpp index d95467aa7baa..3768fb999a72 100644 --- a/toolchain/check/import_ref.cpp +++ b/toolchain/check/import_ref.cpp @@ -549,6 +549,9 @@ class ImportRefResolver { case CARBON_KIND(SemIR::FunctionDecl inst): { return TryResolveTypedInst(inst); } + case CARBON_KIND(SemIR::FunctionType inst): { + return TryResolveTypedInst(inst); + } case CARBON_KIND(SemIR::ImportRefUsed inst): { return TryResolveTypedInst(inst, inst_id); } @@ -822,7 +825,6 @@ class ImportRefResolver { auto TryResolveTypedInst(SemIR::FunctionDecl inst) -> ResolveResult { auto initial_work = work_stack_.size(); - auto type_const_id = GetLocalConstantId(inst.type_id); const auto& function = import_ir_.functions().Get(inst.function_id); auto return_type_const_id = SemIR::ConstantId::Invalid; @@ -840,9 +842,9 @@ class ImportRefResolver { } // Add the function declaration. - auto function_decl = SemIR::FunctionDecl{ - context_.GetTypeIdForTypeConstant(type_const_id), - SemIR::FunctionId::Invalid, SemIR::InstBlockId::Empty}; + auto function_decl = + SemIR::FunctionDecl{SemIR::TypeId::Invalid, SemIR::FunctionId::Invalid, + SemIR::InstBlockId::Empty}; // Prefer pointing diagnostics towards a definition. auto import_ir_inst_id = AddImportIRInst(function.definition_id.is_valid() ? function.definition_id @@ -879,11 +881,25 @@ class ImportRefResolver { .definition_id = function.definition_id.is_valid() ? function_decl_id : SemIR::InstId::Invalid}); + function_decl.type_id = context_.GetFunctionType(function_decl.function_id); // Write the function ID into the FunctionDecl. context_.ReplaceInstBeforeConstantUse(function_decl_id, function_decl); return {context_.constant_values().Get(function_decl_id)}; } + auto TryResolveTypedInst(SemIR::FunctionType inst) -> ResolveResult { + auto initial_work = work_stack_.size(); + CARBON_CHECK(inst.type_id == SemIR::TypeId::TypeType); + auto fn_const_id = GetLocalConstantId( + import_ir_.functions().Get(inst.function_id).decl_id); + if (HasNewWork(initial_work)) { + return ResolveResult::Retry(); + } + auto fn_val = context_.insts().Get(fn_const_id.inst_id()); + CARBON_CHECK(context_.types().Is(fn_val.type_id())); + return {context_.types().GetConstantId(fn_val.type_id())}; + } + auto TryResolveTypedInst(SemIR::ImportRefUsed /*inst*/, SemIR::InstId inst_id) -> ResolveResult { auto initial_work = work_stack_.size(); diff --git a/toolchain/check/member_access.cpp b/toolchain/check/member_access.cpp index a65a7aee6085..93871625f05b 100644 --- a/toolchain/check/member_access.cpp +++ b/toolchain/check/member_access.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include "llvm/ADT/STLExtras.h" +#include "toolchain/base/kind_switch.h" #include "toolchain/check/context.h" #include "toolchain/check/convert.h" #include "toolchain/check/import_ref.h" @@ -243,64 +244,49 @@ static auto PerformInstanceBinding(Context& context, Parse::NodeId node_id, SemIR::InstId base_id, SemIR::InstId member_id) -> SemIR::InstId { auto member_type_id = context.insts().Get(member_id).type_id(); - if (auto unbound_element_type = - context.types().TryGetAs(member_type_id)) { - // Convert the base to the type of the element if necessary. - base_id = ConvertToValueOrRefOfType(context, node_id, base_id, - unbound_element_type->class_type_id); + CARBON_KIND_SWITCH(context.types().GetAsInst(member_type_id)) { + case CARBON_KIND(SemIR::UnboundElementType unbound_element_type): { + // Convert the base to the type of the element if necessary. + base_id = ConvertToValueOrRefOfType(context, node_id, base_id, + unbound_element_type.class_type_id); - // Find the specified element, which could be either a field or a base - // class, and build an element access expression. - auto element_id = context.constant_values().Get(member_id); - CARBON_CHECK(element_id.is_constant()) - << "Non-constant value " << context.insts().Get(member_id) - << " of unbound element type"; - auto index = GetClassElementIndex(context, element_id.inst_id()); - auto access_id = context.AddInst( - {node_id, SemIR::ClassElementAccess{ - unbound_element_type->element_type_id, base_id, index}}); - if (SemIR::GetExprCategory(context.sem_ir(), base_id) == - SemIR::ExprCategory::Value && - SemIR::GetExprCategory(context.sem_ir(), access_id) != - SemIR::ExprCategory::Value) { - // Class element access on a value expression produces an ephemeral - // reference if the class's value representation is a pointer to the - // object representation. Add a value binding in that case so that the - // expression category of the result matches the expression category of - // the base. - access_id = ConvertToValueExpr(context, access_id); + // Find the specified element, which could be either a field or a base + // class, and build an element access expression. + auto element_id = context.constant_values().Get(member_id); + CARBON_CHECK(element_id.is_constant()) + << "Non-constant value " << context.insts().Get(member_id) + << " of unbound element type"; + auto index = GetClassElementIndex(context, element_id.inst_id()); + auto access_id = context.AddInst( + {node_id, SemIR::ClassElementAccess{ + unbound_element_type.element_type_id, base_id, index}}); + if (SemIR::GetExprCategory(context.sem_ir(), base_id) == + SemIR::ExprCategory::Value && + SemIR::GetExprCategory(context.sem_ir(), access_id) != + SemIR::ExprCategory::Value) { + // Class element access on a value expression produces an ephemeral + // reference if the class's value representation is a pointer to the + // object representation. Add a value binding in that case so that the + // expression category of the result matches the expression category of + // the base. + access_id = ConvertToValueExpr(context, access_id); + } + return access_id; } - return access_id; + case CARBON_KIND(SemIR::FunctionType fn_type): { + if (IsInstanceMethod(context.sem_ir(), fn_type.function_id)) { + return context.AddInst( + {node_id, + SemIR::BoundMethod{ + context.GetBuiltinType(SemIR::BuiltinKind::BoundMethodType), + base_id, member_id}}); + } + [[fallthrough]]; + } + default: + // Not an instance member: no instance binding. + return member_id; } - - if (member_type_id == - context.GetBuiltinType(SemIR::BuiltinKind::FunctionType)) { - // Find the named function and check whether it's an instance method. - auto function_name_id = context.constant_values().Get(member_id); - if (function_name_id == SemIR::ConstantId::Error) { - return SemIR::InstId::BuiltinError; - } - - CARBON_CHECK(function_name_id.is_constant()) - << "Non-constant value " << context.insts().Get(member_id) - << " of function type"; - auto function_decl = context.insts() - .Get(function_name_id.inst_id()) - .TryAs(); - CARBON_CHECK(function_decl) - << "Unexpected value " - << context.insts().Get(function_name_id.inst_id()) - << " of function type"; - if (IsInstanceMethod(context.sem_ir(), function_decl->function_id)) { - return context.AddInst( - {node_id, SemIR::BoundMethod{context.GetBuiltinType( - SemIR::BuiltinKind::BoundMethodType), - base_id, member_id}}); - } - } - - // Not an instance member: no instance binding. - return member_id; } auto PerformMemberAccess(Context& context, Parse::NodeId node_id, diff --git a/toolchain/check/testdata/alias/no_prelude/fail_local_in_namespace.carbon b/toolchain/check/testdata/alias/no_prelude/fail_local_in_namespace.carbon index cb7f31f7164c..35f64d1a7509 100644 --- a/toolchain/check/testdata/alias/no_prelude/fail_local_in_namespace.carbon +++ b/toolchain/check/testdata/alias/no_prelude/fail_local_in_namespace.carbon @@ -26,16 +26,18 @@ fn F() -> {} { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .NS = %NS -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %NS: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %.loc9_12.1: {} = struct_literal () // CHECK:STDOUT: %.loc9_12.2: type = converted %.loc9_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @F.%return: ref {} = var diff --git a/toolchain/check/testdata/alias/no_prelude/fail_not_constant.carbon b/toolchain/check/testdata/alias/no_prelude/fail_not_constant.carbon index f0aabe398104..194a0bf80493 100644 --- a/toolchain/check/testdata/alias/no_prelude/fail_not_constant.carbon +++ b/toolchain/check/testdata/alias/no_prelude/fail_not_constant.carbon @@ -16,16 +16,18 @@ fn F() { // CHECK:STDOUT: --- fail_not_constant.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: %.2: type = ptr_type () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/alias/no_prelude/in_namespace.carbon b/toolchain/check/testdata/alias/no_prelude/in_namespace.carbon index 9f1294944750..1a0a581c4a23 100644 --- a/toolchain/check/testdata/alias/no_prelude/in_namespace.carbon +++ b/toolchain/check/testdata/alias/no_prelude/in_namespace.carbon @@ -24,14 +24,16 @@ fn F() -> NS.a { // CHECK:STDOUT: %.3: type = struct_type {.v: ()} [template] // CHECK:STDOUT: %.4: type = ptr_type {.v: ()} [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] -// CHECK:STDOUT: %struct: C = struct_value (%tuple) [template] +// CHECK:STDOUT: %struct.1: C = struct_value (%tuple) [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .NS = %NS -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %NS: = namespace [template] { @@ -47,12 +49,12 @@ fn F() -> NS.a { // CHECK:STDOUT: %.loc12_23.3: ref () = class_element_access %.loc12_23.2, element0 // CHECK:STDOUT: %.loc12_22.2: init () = tuple_init () to %.loc12_23.3 [template = constants.%tuple] // CHECK:STDOUT: %.loc12_23.4: init () = converted %.loc12_22.1, %.loc12_22.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc12_23.5: init C = class_init (%.loc12_23.4), %.loc12_23.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc12_23.5: init C = class_init (%.loc12_23.4), %.loc12_23.2 [template = constants.%struct.1] // CHECK:STDOUT: %.loc12_23.6: ref C = temporary %.loc12_23.2, %.loc12_23.5 // CHECK:STDOUT: %.loc12_24.1: ref C = converted %.loc12_23.1, %.loc12_23.6 // CHECK:STDOUT: %.loc12_24.2: C = bind_value %.loc12_24.1 // CHECK:STDOUT: %b: C = bind_name b, %.loc12_24.2 -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %NS.ref.loc14: = name_ref NS, %NS [template = %NS] // CHECK:STDOUT: %a.ref.loc14: type = name_ref a, %a [template = constants.%C] // CHECK:STDOUT: @F.%return: ref C = var @@ -76,8 +78,8 @@ fn F() -> NS.a { // CHECK:STDOUT: %.loc15_18.2: ref () = class_element_access %return, element0 // CHECK:STDOUT: %.loc15_17.2: init () = tuple_init () to %.loc15_18.2 [template = constants.%tuple] // CHECK:STDOUT: %.loc15_18.3: init () = converted %.loc15_17.1, %.loc15_17.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc15_18.4: init C = class_init (%.loc15_18.3), %return [template = constants.%struct] -// CHECK:STDOUT: %.loc15_19: init C = converted %.loc15_18.1, %.loc15_18.4 [template = constants.%struct] +// CHECK:STDOUT: %.loc15_18.4: init C = class_init (%.loc15_18.3), %return [template = constants.%struct.1] +// CHECK:STDOUT: %.loc15_19: init C = converted %.loc15_18.1, %.loc15_18.4 [template = constants.%struct.1] // CHECK:STDOUT: return %.loc15_19 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/alias/no_prelude/local.carbon b/toolchain/check/testdata/alias/no_prelude/local.carbon index 7271ce939241..051927643ea5 100644 --- a/toolchain/check/testdata/alias/no_prelude/local.carbon +++ b/toolchain/check/testdata/alias/no_prelude/local.carbon @@ -14,14 +14,16 @@ fn F() -> () { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %.loc7_12.1: () = tuple_literal () // CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @F.%return: ref () = var diff --git a/toolchain/check/testdata/array/array_in_place.carbon b/toolchain/check/testdata/array/array_in_place.carbon index 0d0f11825a10..882175d4387f 100644 --- a/toolchain/check/testdata/array/array_in_place.carbon +++ b/toolchain/check/testdata/array/array_in_place.carbon @@ -15,28 +15,33 @@ fn G() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type (type, type, type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, (i32, i32, i32) [template] -// CHECK:STDOUT: %.5: type = ptr_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.6: type = ptr_type [(i32, i32, i32); 2] [template] -// CHECK:STDOUT: %.7: type = tuple_type ((i32, i32, i32), (i32, i32, i32)) [template] -// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.9: i32 = int_literal 1 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, (i32, i32, i32) [template] +// CHECK:STDOUT: %.6: type = ptr_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.7: type = ptr_type [(i32, i32, i32); 2] [template] +// CHECK:STDOUT: %.8: type = tuple_type ((i32, i32, i32), (i32, i32, i32)) [template] +// CHECK:STDOUT: %.9: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.10: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %G: = fn_decl @G [template] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> (i32, i32, i32); @@ -44,20 +49,20 @@ fn G() { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_25.1: (type, type, type) = tuple_literal (i32, i32, i32) -// CHECK:STDOUT: %.loc10_28: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_28: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: %.loc10_25.2: type = converted %.loc10_25.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_29: type = array_type %.loc10_28, (i32, i32, i32) [template = constants.%.4] +// CHECK:STDOUT: %.loc10_29: type = array_type %.loc10_28, (i32, i32, i32) [template = constants.%.5] // CHECK:STDOUT: %v.var: ref [(i32, i32, i32); 2] = var v // CHECK:STDOUT: %v: ref [(i32, i32, i32); 2] = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10_34: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref.loc10_34: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_42.3: ref (i32, i32, i32) = splice_block %.loc10_42.2 { -// CHECK:STDOUT: %.loc10_42.1: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc10_42.1: i32 = int_literal 0 [template = constants.%.9] // CHECK:STDOUT: %.loc10_42.2: ref (i32, i32, i32) = array_index %v.var, %.loc10_42.1 // CHECK:STDOUT: } // CHECK:STDOUT: %F.call.loc10_35: init (i32, i32, i32) = call %F.ref.loc10_34() to %.loc10_42.3 -// CHECK:STDOUT: %F.ref.loc10_39: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref.loc10_39: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_42.6: ref (i32, i32, i32) = splice_block %.loc10_42.5 { -// CHECK:STDOUT: %.loc10_42.4: i32 = int_literal 1 [template = constants.%.9] +// CHECK:STDOUT: %.loc10_42.4: i32 = int_literal 1 [template = constants.%.10] // CHECK:STDOUT: %.loc10_42.5: ref (i32, i32, i32) = array_index %v.var, %.loc10_42.4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.call.loc10_40: init (i32, i32, i32) = call %F.ref.loc10_39() to %.loc10_42.6 diff --git a/toolchain/check/testdata/array/array_vs_tuple.carbon b/toolchain/check/testdata/array/array_vs_tuple.carbon index 47c5a471437f..1bdb1c672320 100644 --- a/toolchain/check/testdata/array/array_vs_tuple.carbon +++ b/toolchain/check/testdata/array/array_vs_tuple.carbon @@ -13,64 +13,67 @@ fn G() { // CHECK:STDOUT: --- array_vs_tuple.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] -// CHECK:STDOUT: %.3: type = ptr_type [i32; 3] [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.6: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] -// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.4, %.5, %.1) [template] -// CHECK:STDOUT: %.8: type = tuple_type (type, type, type) [template] -// CHECK:STDOUT: %.9: type = ptr_type (i32, i32, i32) [template] -// CHECK:STDOUT: %tuple: (i32, i32, i32) = tuple_value (%.4, %.5, %.1) [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: G = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template] +// CHECK:STDOUT: %.4: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] +// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.5, %.6, %.2) [template] +// CHECK:STDOUT: %.9: type = tuple_type (type, type, type) [template] +// CHECK:STDOUT: %.10: type = ptr_type (i32, i32, i32) [template] +// CHECK:STDOUT: %tuple: (i32, i32, i32) = tuple_value (%.5, %.6, %.2) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_16: i32 = int_literal 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_17: type = array_type %.loc9_16, i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_16: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_17: type = array_type %.loc9_16, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var -// CHECK:STDOUT: %.loc9_22: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_25: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_28: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_22: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_25: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_28: i32 = int_literal 3 [template = constants.%.2] // CHECK:STDOUT: %.loc9_29.1: (i32, i32, i32) = tuple_literal (%.loc9_22, %.loc9_25, %.loc9_28) -// CHECK:STDOUT: %.loc9_29.2: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_29.2: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc9_29.3: ref i32 = array_index %a.var, %.loc9_29.2 -// CHECK:STDOUT: %.loc9_29.4: init i32 = initialize_from %.loc9_22 to %.loc9_29.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_29.5: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_29.4: init i32 = initialize_from %.loc9_22 to %.loc9_29.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_29.5: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc9_29.6: ref i32 = array_index %a.var, %.loc9_29.5 -// CHECK:STDOUT: %.loc9_29.7: init i32 = initialize_from %.loc9_25 to %.loc9_29.6 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_29.8: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_29.7: init i32 = initialize_from %.loc9_25 to %.loc9_29.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_29.8: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc9_29.9: ref i32 = array_index %a.var, %.loc9_29.8 -// CHECK:STDOUT: %.loc9_29.10: init i32 = initialize_from %.loc9_28 to %.loc9_29.9 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_29.10: init i32 = initialize_from %.loc9_28 to %.loc9_29.9 [template = constants.%.2] // CHECK:STDOUT: %.loc9_29.11: init [i32; 3] = array_init (%.loc9_29.4, %.loc9_29.7, %.loc9_29.10) to %a.var [template = constants.%array] // CHECK:STDOUT: %.loc9_30: init [i32; 3] = converted %.loc9_29.1, %.loc9_29.11 [template = constants.%array] // CHECK:STDOUT: assign %a.var, %.loc9_30 // CHECK:STDOUT: %.loc10_24.1: (type, type, type) = tuple_literal (i32, i32, i32) -// CHECK:STDOUT: %.loc10_24.2: type = converted %.loc10_24.1, constants.%.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc10_24.2: type = converted %.loc10_24.1, constants.%.7 [template = constants.%.7] // CHECK:STDOUT: %b.var: ref (i32, i32, i32) = var b // CHECK:STDOUT: %b: ref (i32, i32, i32) = bind_name b, %b.var -// CHECK:STDOUT: %.loc10_29: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_32: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_35: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_29: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_32: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc10_35: i32 = int_literal 3 [template = constants.%.2] // CHECK:STDOUT: %.loc10_36.1: (i32, i32, i32) = tuple_literal (%.loc10_29, %.loc10_32, %.loc10_35) // CHECK:STDOUT: %.loc10_36.2: ref i32 = tuple_access %b.var, element0 -// CHECK:STDOUT: %.loc10_36.3: init i32 = initialize_from %.loc10_29 to %.loc10_36.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_36.3: init i32 = initialize_from %.loc10_29 to %.loc10_36.2 [template = constants.%.5] // CHECK:STDOUT: %.loc10_36.4: ref i32 = tuple_access %b.var, element1 -// CHECK:STDOUT: %.loc10_36.5: init i32 = initialize_from %.loc10_32 to %.loc10_36.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_36.5: init i32 = initialize_from %.loc10_32 to %.loc10_36.4 [template = constants.%.6] // CHECK:STDOUT: %.loc10_36.6: ref i32 = tuple_access %b.var, element2 -// CHECK:STDOUT: %.loc10_36.7: init i32 = initialize_from %.loc10_35 to %.loc10_36.6 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_36.7: init i32 = initialize_from %.loc10_35 to %.loc10_36.6 [template = constants.%.2] // CHECK:STDOUT: %.loc10_36.8: init (i32, i32, i32) = tuple_init (%.loc10_36.3, %.loc10_36.5, %.loc10_36.7) to %b.var [template = constants.%tuple] // CHECK:STDOUT: %.loc10_37: init (i32, i32, i32) = converted %.loc10_36.1, %.loc10_36.8 [template = constants.%tuple] // CHECK:STDOUT: assign %b.var, %.loc10_37 diff --git a/toolchain/check/testdata/array/assign_return_value.carbon b/toolchain/check/testdata/array/assign_return_value.carbon index d387a7852d33..608e3c83af5f 100644 --- a/toolchain/check/testdata/array/assign_return_value.carbon +++ b/toolchain/check/testdata/array/assign_return_value.carbon @@ -15,31 +15,36 @@ fn Run() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type (type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] -// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.3) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] -// CHECK:STDOUT: %.6: type = ptr_type [i32; 1] [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.4: i32 = int_literal 0 [template] +// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.4) [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %struct.2: Run = struct_value () [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: type = array_type %.5, i32 [template] +// CHECK:STDOUT: %.7: type = ptr_type [i32; 1] [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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: @F.%return: ref (i32,) = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> (i32,) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0 [template = constants.%.4] // CHECK:STDOUT: %.loc7_30: (i32,) = tuple_literal (%.loc7_28) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc7_28) [template = constants.%tuple] // CHECK:STDOUT: %.loc7_31: (i32,) = converted %.loc7_30, %tuple [template = constants.%tuple] @@ -48,17 +53,17 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32 [template = constants.%.6] // CHECK:STDOUT: %t.var: ref [i32; 1] = var t // CHECK:STDOUT: %t: ref [i32; 1] = bind_name t, %t.var -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init (i32,) = call %F.ref() // CHECK:STDOUT: %.loc10_22.1: ref (i32,) = temporary_storage // CHECK:STDOUT: %.loc10_22.2: ref (i32,) = temporary %.loc10_22.1, %F.call // CHECK:STDOUT: %.loc10_22.3: ref i32 = tuple_access %.loc10_22.2, element0 // CHECK:STDOUT: %.loc10_22.4: i32 = bind_value %.loc10_22.3 -// CHECK:STDOUT: %.loc10_22.5: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_22.5: i32 = int_literal 0 [template = constants.%.4] // CHECK:STDOUT: %.loc10_22.6: ref i32 = array_index %t.var, %.loc10_22.5 // CHECK:STDOUT: %.loc10_22.7: init i32 = initialize_from %.loc10_22.4 to %.loc10_22.6 // CHECK:STDOUT: %.loc10_22.8: init [i32; 1] = array_init (%.loc10_22.7) to %t.var diff --git a/toolchain/check/testdata/array/canonicalize_index.carbon b/toolchain/check/testdata/array/canonicalize_index.carbon index a766698296a9..94341137c903 100644 --- a/toolchain/check/testdata/array/canonicalize_index.carbon +++ b/toolchain/check/testdata/array/canonicalize_index.carbon @@ -12,40 +12,43 @@ let b: [i32; 3]* = &a; // CHECK:STDOUT: --- canonicalize_index.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 3] [template] -// CHECK:STDOUT: %.6: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] -// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.1, %.2, %.3) [template] +// CHECK:STDOUT: %Add: type = fn_type @Add [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Add = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] +// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.2, %.3, %.4) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Add = %Add +// CHECK:STDOUT: .Add = %Add.decl // CHECK:STDOUT: .a = %a.loc9 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Add: = fn_decl @Add [template] { +// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct] { // CHECK:STDOUT: %a.loc7_8.1: i32 = param a // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: %b.loc7_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc7_16.1 // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Add.ref: = name_ref Add, %Add [template = %Add] -// CHECK:STDOUT: %.loc9_18: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_21: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc9_18, %.loc9_21) [template = constants.%.3] -// CHECK:STDOUT: %.loc9_23: type = array_type %int.sadd, i32 [template = constants.%.4] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc9_18: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_21: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc9_18, %.loc9_21) [template = constants.%.4] +// CHECK:STDOUT: %.loc9_23: type = array_type %int.sadd, i32 [template = constants.%.5] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a.loc9: ref [i32; 3] = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_16: type = ptr_type [i32; 3] [template = constants.%.5] +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_16: type = ptr_type [i32; 3] [template = constants.%.6] // CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, %a.loc9 // CHECK:STDOUT: %.loc10_20: [i32; 3]* = addr_of %a.ref // CHECK:STDOUT: %b.loc10: [i32; 3]* = bind_name b, %.loc10_20 @@ -55,19 +58,19 @@ let b: [i32; 3]* = &a; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_28: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_31: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_34: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_28: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_31: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_34: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: %.loc9_35.1: (i32, i32, i32) = tuple_literal (%.loc9_28, %.loc9_31, %.loc9_34) -// CHECK:STDOUT: %.loc9_35.2: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_35.2: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc9_35.3: ref i32 = array_index file.%a.var, %.loc9_35.2 -// CHECK:STDOUT: %.loc9_35.4: init i32 = initialize_from %.loc9_28 to %.loc9_35.3 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_35.5: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc9_35.4: init i32 = initialize_from %.loc9_28 to %.loc9_35.3 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_35.5: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc9_35.6: ref i32 = array_index file.%a.var, %.loc9_35.5 -// CHECK:STDOUT: %.loc9_35.7: init i32 = initialize_from %.loc9_31 to %.loc9_35.6 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_35.8: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_35.7: init i32 = initialize_from %.loc9_31 to %.loc9_35.6 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_35.8: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %.loc9_35.9: ref i32 = array_index file.%a.var, %.loc9_35.8 -// CHECK:STDOUT: %.loc9_35.10: init i32 = initialize_from %.loc9_34 to %.loc9_35.9 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_35.10: init i32 = initialize_from %.loc9_34 to %.loc9_35.9 [template = constants.%.4] // CHECK:STDOUT: %.loc9_35.11: init [i32; 3] = array_init (%.loc9_35.4, %.loc9_35.7, %.loc9_35.10) to file.%a.var [template = constants.%array] // CHECK:STDOUT: %.loc9_36: init [i32; 3] = converted %.loc9_35.1, %.loc9_35.11 [template = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc9_36 diff --git a/toolchain/check/testdata/array/fail_bound_negative.carbon b/toolchain/check/testdata/array/fail_bound_negative.carbon index 2192e80965e7..bc65beb2f78f 100644 --- a/toolchain/check/testdata/array/fail_bound_negative.carbon +++ b/toolchain/check/testdata/array/fail_bound_negative.carbon @@ -14,25 +14,28 @@ var a: [i32; Negate(1)]; // CHECK:STDOUT: --- fail_bound_negative.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -1 [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Negate = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct] { // CHECK:STDOUT: %n.loc7_11.1: i32 = param n // CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc7_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc12_21: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_21) [template = constants.%.2] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc12_21: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_21) [template = constants.%.3] // CHECK:STDOUT: %.loc12_23: type = array_type %int.snegate, i32 [template = ] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var diff --git a/toolchain/check/testdata/array/function_param.carbon b/toolchain/check/testdata/array/function_param.carbon index 5ee15c3dd0e8..c5ec40912b74 100644 --- a/toolchain/check/testdata/array/function_param.carbon +++ b/toolchain/check/testdata/array/function_param.carbon @@ -17,22 +17,27 @@ fn G() -> i32 { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 3 [template] // CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] -// CHECK:STDOUT: %.3: type = ptr_type [i32; 3] [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.6: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] -// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.4, %.5, %.1) [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] +// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.5, %.6, %.1) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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 @@ -41,7 +46,7 @@ fn G() -> i32 { // CHECK:STDOUT: @F.%i: i32 = bind_name i, %i.loc7_21.1 // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -58,20 +63,20 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc12_13: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_16: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc12_13: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_16: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc12_19: i32 = int_literal 3 [template = constants.%.1] // CHECK:STDOUT: %.loc12_20.1: (i32, i32, i32) = tuple_literal (%.loc12_13, %.loc12_16, %.loc12_19) -// CHECK:STDOUT: %.loc12_23: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_23: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc12_20.2: ref [i32; 3] = temporary_storage -// CHECK:STDOUT: %.loc12_20.3: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_20.3: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc12_20.4: ref i32 = array_index %.loc12_20.2, %.loc12_20.3 -// CHECK:STDOUT: %.loc12_20.5: init i32 = initialize_from %.loc12_13 to %.loc12_20.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc12_20.6: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_20.5: init i32 = initialize_from %.loc12_13 to %.loc12_20.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_20.6: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc12_20.7: ref i32 = array_index %.loc12_20.2, %.loc12_20.6 -// CHECK:STDOUT: %.loc12_20.8: init i32 = initialize_from %.loc12_16 to %.loc12_20.7 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_20.9: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_20.8: init i32 = initialize_from %.loc12_16 to %.loc12_20.7 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_20.9: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc12_20.10: ref i32 = array_index %.loc12_20.2, %.loc12_20.9 // CHECK:STDOUT: %.loc12_20.11: init i32 = initialize_from %.loc12_19 to %.loc12_20.10 [template = constants.%.1] // CHECK:STDOUT: %.loc12_20.12: init [i32; 3] = array_init (%.loc12_20.5, %.loc12_20.8, %.loc12_20.11) to %.loc12_20.2 [template = constants.%array] diff --git a/toolchain/check/testdata/as/adapter_conversion.carbon b/toolchain/check/testdata/as/adapter_conversion.carbon index c5851f6f1120..a3fc2badc71e 100644 --- a/toolchain/check/testdata/as/adapter_conversion.carbon +++ b/toolchain/check/testdata/as/adapter_conversion.carbon @@ -103,13 +103,16 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: constants { // CHECK:STDOUT: %A: type = class_type @A [template] // CHECK:STDOUT: %.1: type = unbound_element_type A, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.x: i32, .y: i32} [template] -// CHECK:STDOUT: %.3: type = ptr_type {.x: i32, .y: i32} [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct: A = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %Make: type = fn_type @Make [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Make = struct_value () [template] +// CHECK:STDOUT: %.3: type = struct_type {.x: i32, .y: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.x: i32, .y: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %struct.2: A = struct_value (%.5, %.6) [template] // CHECK:STDOUT: %B: type = class_type @B [template] -// CHECK:STDOUT: %.6: type = ptr_type B [template] +// CHECK:STDOUT: %.7: type = ptr_type B [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -137,7 +140,7 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: %.loc21_22.2: B = converted %a_val.ref, %.loc21_22.1 // CHECK:STDOUT: %b_val: B = bind_name b_val, %.loc21_22.2 // CHECK:STDOUT: %B.ref.loc22_12: type = name_ref B, %B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc22_13: type = ptr_type B [template = constants.%.6] +// CHECK:STDOUT: %.loc22_13: type = ptr_type B [template = constants.%.7] // CHECK:STDOUT: %a_ref.ref.loc22: ref A = name_ref a_ref, %a_ref // CHECK:STDOUT: %B.ref.loc22_28: type = name_ref B, %B.decl [template = constants.%B] // CHECK:STDOUT: %.loc22_25.1: ref B = as_compatible %a_ref.ref.loc22 @@ -152,7 +155,7 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: class @A { // CHECK:STDOUT: %.loc5: = field_decl x, element0 [template] // CHECK:STDOUT: %.loc6: = field_decl y, element1 [template] -// CHECK:STDOUT: %Make: = fn_decl @Make [template] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.1] { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %return.var: ref A = var // CHECK:STDOUT: } @@ -161,7 +164,7 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: .Self = constants.%A // CHECK:STDOUT: .x = %.loc5 // CHECK:STDOUT: .y = %.loc6 -// CHECK:STDOUT: .Make = %Make +// CHECK:STDOUT: .Make = %Make.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { @@ -174,32 +177,32 @@ var b: B = {.x = 1} as B; // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> @A.%return.var: A { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_18: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_26: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_18: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_26: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc9_27.1: {.x: i32, .y: i32} = struct_literal (%.loc9_18, %.loc9_26) // CHECK:STDOUT: %.loc9_27.2: ref i32 = class_element_access @A.%return.var, element0 -// CHECK:STDOUT: %.loc9_27.3: init i32 = initialize_from %.loc9_18 to %.loc9_27.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_27.3: init i32 = initialize_from %.loc9_18 to %.loc9_27.2 [template = constants.%.5] // CHECK:STDOUT: %.loc9_27.4: ref i32 = class_element_access @A.%return.var, element1 -// CHECK:STDOUT: %.loc9_27.5: init i32 = initialize_from %.loc9_26 to %.loc9_27.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_27.6: init A = class_init (%.loc9_27.3, %.loc9_27.5), @A.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc9_28: init A = converted %.loc9_27.1, %.loc9_27.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc9_27.5: init i32 = initialize_from %.loc9_26 to %.loc9_27.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_27.6: init A = class_init (%.loc9_27.3, %.loc9_27.5), @A.%return.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc9_28: init A = converted %.loc9_27.1, %.loc9_27.6 [template = constants.%struct.2] // CHECK:STDOUT: return %.loc9_28 to @A.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_22: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc17_30: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_22: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_30: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc17_31.1: {.x: i32, .y: i32} = struct_literal (%.loc17_22, %.loc17_30) // CHECK:STDOUT: %.loc17_31.2: ref i32 = class_element_access file.%a_ref.var, element0 -// CHECK:STDOUT: %.loc17_31.3: init i32 = initialize_from %.loc17_22 to %.loc17_31.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc17_31.3: init i32 = initialize_from %.loc17_22 to %.loc17_31.2 [template = constants.%.5] // CHECK:STDOUT: %.loc17_31.4: ref i32 = class_element_access file.%a_ref.var, element1 -// CHECK:STDOUT: %.loc17_31.5: init i32 = initialize_from %.loc17_30 to %.loc17_31.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc17_31.6: init A = class_init (%.loc17_31.3, %.loc17_31.5), file.%a_ref.var [template = constants.%struct] -// CHECK:STDOUT: %.loc17_32: init A = converted %.loc17_31.1, %.loc17_31.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc17_31.5: init i32 = initialize_from %.loc17_30 to %.loc17_31.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc17_31.6: init A = class_init (%.loc17_31.3, %.loc17_31.5), file.%a_ref.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc17_32: init A = converted %.loc17_31.1, %.loc17_31.6 [template = constants.%struct.2] // CHECK:STDOUT: assign file.%a_ref.var, %.loc17_32 // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %Make.ref: = name_ref Make, @A.%Make [template = @A.%Make] +// CHECK:STDOUT: %Make.ref: Make = name_ref Make, @A.%Make.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc24_5: ref B = splice_block file.%b_factory.var {} // CHECK:STDOUT: %Make.call: init A = call %Make.ref() to %.loc24_5 // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] diff --git a/toolchain/check/testdata/as/basic.carbon b/toolchain/check/testdata/as/basic.carbon index 5358a9401c0a..518ddf685098 100644 --- a/toolchain/check/testdata/as/basic.carbon +++ b/toolchain/check/testdata/as/basic.carbon @@ -11,23 +11,26 @@ fn Main() -> i32 { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] { +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/identity.carbon b/toolchain/check/testdata/as/identity.carbon index bc17addd9303..88ceb8ff9bc9 100644 --- a/toolchain/check/testdata/as/identity.carbon +++ b/toolchain/check/testdata/as/identity.carbon @@ -29,38 +29,46 @@ fn Initializing() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %X: type = class_type @X [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %Value: type = fn_type @Value [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Value = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = ptr_type X [template] +// CHECK:STDOUT: %Reference: type = fn_type @Reference [template] +// CHECK:STDOUT: %struct.2: Reference = struct_value () [template] +// CHECK:STDOUT: %Make: type = fn_type @Make [template] +// CHECK:STDOUT: %struct.3: Make = struct_value () [template] +// CHECK:STDOUT: %Initializing: type = fn_type @Initializing [template] +// CHECK:STDOUT: %struct.4: Initializing = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .X = %X.decl -// CHECK:STDOUT: .Value = %Value -// CHECK:STDOUT: .Reference = %Reference -// CHECK:STDOUT: .Make = %Make -// CHECK:STDOUT: .Initializing = %Initializing +// CHECK:STDOUT: .Value = %Value.decl +// CHECK:STDOUT: .Reference = %Reference.decl +// CHECK:STDOUT: .Make = %Make.decl +// CHECK:STDOUT: .Initializing = %Initializing.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {} -// CHECK:STDOUT: %Value: = fn_decl @Value [template] { +// CHECK:STDOUT: %Value.decl: Value = fn_decl @Value [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %Reference: = fn_decl @Reference [template] { +// CHECK:STDOUT: %Reference.decl: Reference = fn_decl @Reference [template = constants.%struct.2] { // 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: } -// CHECK:STDOUT: %Make: = fn_decl @Make [template] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.3] { // CHECK:STDOUT: %X.ref.loc21: type = name_ref X, %X.decl [template = constants.%X] // CHECK:STDOUT: @Make.%return: ref X = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Initializing: = fn_decl @Initializing [template] {} +// CHECK:STDOUT: %Initializing.decl: Initializing = fn_decl @Initializing [template = constants.%struct.4] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @X { @@ -96,7 +104,7 @@ fn Initializing() { // CHECK:STDOUT: %X.ref.loc24_10: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %x.var: ref X = var x // CHECK:STDOUT: %x: ref X = bind_name x, %x.var -// CHECK:STDOUT: %Make.ref: = name_ref Make, file.%Make [template = file.%Make] +// CHECK:STDOUT: %Make.ref: Make = name_ref Make, file.%Make.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc24: ref X = splice_block %x.var {} // CHECK:STDOUT: %Make.call: init X = call %Make.ref() to %.loc24 // CHECK:STDOUT: %X.ref.loc24_25: type = name_ref X, file.%X.decl [template = constants.%X] diff --git a/toolchain/check/testdata/as/no_prelude/tuple.carbon b/toolchain/check/testdata/as/no_prelude/tuple.carbon index 2ddcdb8d6a3e..a900e679ac43 100644 --- a/toolchain/check/testdata/as/no_prelude/tuple.carbon +++ b/toolchain/check/testdata/as/no_prelude/tuple.carbon @@ -25,28 +25,34 @@ fn Var() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %X: type = class_type @X [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.3: type = tuple_type (X, X) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Make: type = fn_type @Make [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Make = struct_value () [template] +// CHECK:STDOUT: %Let: type = fn_type @Let [template] +// CHECK:STDOUT: %struct.2: Let = struct_value () [template] +// CHECK:STDOUT: %.3: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.4: type = tuple_type (X, X) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] // CHECK:STDOUT: %.6: type = tuple_type ({}*, {}*) [template] // CHECK:STDOUT: %.7: type = ptr_type ({}*, {}*) [template] +// CHECK:STDOUT: %Var: type = fn_type @Var [template] +// CHECK:STDOUT: %struct.3: Var = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .X = %X.decl -// CHECK:STDOUT: .Make = %Make -// CHECK:STDOUT: .Let = %Let -// CHECK:STDOUT: .Var = %Var +// CHECK:STDOUT: .Make = %Make.decl +// CHECK:STDOUT: .Let = %Let.decl +// CHECK:STDOUT: .Var = %Var.decl // CHECK:STDOUT: } // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {} -// CHECK:STDOUT: %Make: = fn_decl @Make [template] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.1] { // CHECK:STDOUT: %X.ref: type = name_ref X, %X.decl [template = constants.%X] // CHECK:STDOUT: @Make.%return: ref X = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Let: = fn_decl @Let [template] {} -// CHECK:STDOUT: %Var: = fn_decl @Var [template] {} +// CHECK:STDOUT: %Let.decl: Let = fn_decl @Let [template = constants.%struct.2] {} +// CHECK:STDOUT: %Var.decl: Var = fn_decl @Var [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @X { @@ -61,18 +67,18 @@ fn Var() { // CHECK:STDOUT: %X.ref.loc15_11: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %X.ref.loc15_14: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc15_15.1: (type, type) = tuple_literal (%X.ref.loc15_11, %X.ref.loc15_14) -// CHECK:STDOUT: %.loc15_15.2: type = converted %.loc15_15.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %Make.ref.loc15_20: = name_ref Make, file.%Make [template = file.%Make] +// CHECK:STDOUT: %.loc15_15.2: type = converted %.loc15_15.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %Make.ref.loc15_20: Make = name_ref Make, file.%Make.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc15_24.1: ref X = temporary_storage // CHECK:STDOUT: %Make.call.loc15_24: init X = call %Make.ref.loc15_20() to %.loc15_24.1 -// CHECK:STDOUT: %Make.ref.loc15_28: = name_ref Make, file.%Make [template = file.%Make] +// CHECK:STDOUT: %Make.ref.loc15_28: Make = name_ref Make, file.%Make.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc15_32.1: ref X = temporary_storage // CHECK:STDOUT: %Make.call.loc15_32: init X = call %Make.ref.loc15_28() to %.loc15_32.1 // CHECK:STDOUT: %.loc15_34: (X, X) = tuple_literal (%Make.call.loc15_24, %Make.call.loc15_32) // CHECK:STDOUT: %X.ref.loc15_40: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %X.ref.loc15_43: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc15_44.1: (type, type) = tuple_literal (%X.ref.loc15_40, %X.ref.loc15_43) -// CHECK:STDOUT: %.loc15_44.2: type = converted %.loc15_44.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_44.2: type = converted %.loc15_44.1, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: %.loc15_24.2: ref X = temporary %.loc15_24.1, %Make.call.loc15_24 // CHECK:STDOUT: %.loc15_24.3: X = bind_value %.loc15_24.2 // CHECK:STDOUT: %.loc15_32.2: ref X = temporary %.loc15_32.1, %Make.call.loc15_32 @@ -88,20 +94,20 @@ fn Var() { // CHECK:STDOUT: %X.ref.loc20_11: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %X.ref.loc20_14: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc20_15.1: (type, type) = tuple_literal (%X.ref.loc20_11, %X.ref.loc20_14) -// CHECK:STDOUT: %.loc20_15.2: type = converted %.loc20_15.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc20_15.2: type = converted %.loc20_15.1, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: %b.var: ref (X, X) = var b // CHECK:STDOUT: %b: ref (X, X) = bind_name b, %b.var -// CHECK:STDOUT: %Make.ref.loc20_20: = name_ref Make, file.%Make [template = file.%Make] +// CHECK:STDOUT: %Make.ref.loc20_20: Make = name_ref Make, file.%Make.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc20_34.1: ref X = tuple_access %b.var, element0 // CHECK:STDOUT: %Make.call.loc20_24: init X = call %Make.ref.loc20_20() to %.loc20_34.1 -// CHECK:STDOUT: %Make.ref.loc20_28: = name_ref Make, file.%Make [template = file.%Make] +// CHECK:STDOUT: %Make.ref.loc20_28: Make = name_ref Make, file.%Make.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc20_34.2: ref X = tuple_access %b.var, element1 // CHECK:STDOUT: %Make.call.loc20_32: init X = call %Make.ref.loc20_28() to %.loc20_34.2 // CHECK:STDOUT: %.loc20_34.3: (X, X) = tuple_literal (%Make.call.loc20_24, %Make.call.loc20_32) // CHECK:STDOUT: %X.ref.loc20_40: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %X.ref.loc20_43: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc20_44.1: (type, type) = tuple_literal (%X.ref.loc20_40, %X.ref.loc20_43) -// CHECK:STDOUT: %.loc20_44.2: type = converted %.loc20_44.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc20_44.2: type = converted %.loc20_44.1, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: %.loc20_34.4: init (X, X) = tuple_init (%Make.call.loc20_24, %Make.call.loc20_32) to %b.var // CHECK:STDOUT: %.loc20_45: init (X, X) = converted %.loc20_34.3, %.loc20_34.4 // CHECK:STDOUT: assign %b.var, %.loc20_45 diff --git a/toolchain/check/testdata/basics/builtin_insts.carbon b/toolchain/check/testdata/basics/builtin_insts.carbon index 2ed1492b50e4..c81266b8d5a4 100644 --- a/toolchain/check/testdata/basics/builtin_insts.carbon +++ b/toolchain/check/testdata/basics/builtin_insts.carbon @@ -25,7 +25,6 @@ // CHECK:STDOUT: instIntType: {kind: Builtin, arg0: IntType, type: typeTypeType} // CHECK:STDOUT: instFloatType: {kind: Builtin, arg0: FloatType, type: typeTypeType} // CHECK:STDOUT: instStringType: {kind: Builtin, arg0: StringType, type: typeTypeType} -// CHECK:STDOUT: instFunctionType: {kind: Builtin, arg0: FunctionType, type: typeTypeType} // CHECK:STDOUT: instBoundMethodType: {kind: Builtin, arg0: BoundMethodType, type: typeTypeType} // CHECK:STDOUT: instNamespaceType: {kind: Builtin, arg0: NamespaceType, type: typeTypeType} // CHECK:STDOUT: instWitnessType: {kind: Builtin, arg0: WitnessType, type: typeTypeType} @@ -37,7 +36,6 @@ // CHECK:STDOUT: instIntType: template instIntType // CHECK:STDOUT: instFloatType: template instFloatType // CHECK:STDOUT: instStringType: template instStringType -// CHECK:STDOUT: instFunctionType: template instFunctionType // CHECK:STDOUT: instBoundMethodType: template instBoundMethodType // CHECK:STDOUT: instNamespaceType: template instNamespaceType // CHECK:STDOUT: instWitnessType: template instWitnessType diff --git a/toolchain/check/testdata/basics/fail_bad_run.carbon b/toolchain/check/testdata/basics/fail_bad_run.carbon index 86c491fc8c98..f43006ac2b75 100644 --- a/toolchain/check/testdata/basics/fail_bad_run.carbon +++ b/toolchain/check/testdata/basics/fail_bad_run.carbon @@ -16,17 +16,19 @@ fn Run() -> String {} // CHECK:STDOUT: --- fail_bad_run.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Run: type = fn_type @Run [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Run = struct_value () [template] // CHECK:STDOUT: %.2: type = ptr_type String [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] { +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct] { // CHECK:STDOUT: @Run.%return: ref String = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/basics/fail_bad_run_2.carbon b/toolchain/check/testdata/basics/fail_bad_run_2.carbon index 725c6215baa7..e4e4d1bfb97a 100644 --- a/toolchain/check/testdata/basics/fail_bad_run_2.carbon +++ b/toolchain/check/testdata/basics/fail_bad_run_2.carbon @@ -11,13 +11,19 @@ fn Run(n: i32) {} // CHECK:STDOUT: --- fail_bad_run_2.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Run = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] { +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct] { // CHECK:STDOUT: %n.loc10_8.1: i32 = param n // CHECK:STDOUT: @Run.%n: i32 = bind_name n, %n.loc10_8.1 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/basics/multifile.carbon b/toolchain/check/testdata/basics/multifile.carbon index be8a182846d0..d3aa048c2372 100644 --- a/toolchain/check/testdata/basics/multifile.carbon +++ b/toolchain/check/testdata/basics/multifile.carbon @@ -16,13 +16,19 @@ fn B() {} // CHECK:STDOUT: --- a.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -32,13 +38,19 @@ fn B() {} // CHECK:STDOUT: // CHECK:STDOUT: --- b.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: B = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .B = %B +// CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %B: = fn_decl @B [template] {} +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() { diff --git a/toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon b/toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon index 5b8ba49af880..7fdb58eda481 100644 --- a/toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon +++ b/toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon @@ -13,11 +13,17 @@ fn Main() { // CHECK:STDOUT: --- fail_name_lookup.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon b/toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon index 01db165a2c42..3fec57ab4609 100644 --- a/toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon +++ b/toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon @@ -30,22 +30,31 @@ fn B() {} // CHECK:STDOUT: classes: {} // CHECK:STDOUT: types: // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}} -// CHECK:STDOUT: type1: {constant: template instFunctionType, value_rep: {kind: copy, type: type1}} -// CHECK:STDOUT: type_blocks: {} +// CHECK:STDOUT: type1: {constant: template inst+2, value_rep: {kind: none, type: type2}} +// CHECK:STDOUT: type2: {constant: template inst+3, value_rep: {kind: none, type: type2}} +// CHECK:STDOUT: type_blocks: +// CHECK:STDOUT: typeBlock0: {} +// CHECK:STDOUT: typeBlock1: {} // CHECK:STDOUT: insts: // CHECK:STDOUT: 'inst+0': {kind: Namespace, arg0: name_scope0, arg1: inst, type: type0} // CHECK:STDOUT: 'inst+1': {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1} -// CHECK:STDOUT: 'inst+2': {kind: Return} +// CHECK:STDOUT: 'inst+2': {kind: FunctionType, arg0: function0, type: typeTypeType} +// CHECK:STDOUT: 'inst+3': {kind: TupleType, arg0: typeBlock0, type: typeTypeType} +// CHECK:STDOUT: 'inst+4': {kind: StructValue, arg0: empty, type: type1} +// CHECK:STDOUT: 'inst+5': {kind: Return} // CHECK:STDOUT: constant_values: // CHECK:STDOUT: 'inst+0': template inst+0 -// CHECK:STDOUT: 'inst+1': template inst+1 +// CHECK:STDOUT: 'inst+1': template inst+4 +// CHECK:STDOUT: 'inst+2': template inst+2 +// CHECK:STDOUT: 'inst+3': template inst+3 +// CHECK:STDOUT: 'inst+4': template inst+4 // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: // CHECK:STDOUT: 0: inst+1 // CHECK:STDOUT: global_init: {} // CHECK:STDOUT: block3: -// CHECK:STDOUT: 0: inst+2 +// CHECK:STDOUT: 0: inst+5 // CHECK:STDOUT: block4: // CHECK:STDOUT: 0: inst+0 // CHECK:STDOUT: 1: inst+1 @@ -53,11 +62,17 @@ fn B() {} // CHECK:STDOUT: // CHECK:STDOUT: --- a.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -77,22 +92,31 @@ fn B() {} // CHECK:STDOUT: classes: {} // CHECK:STDOUT: types: // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}} -// CHECK:STDOUT: type1: {constant: template instFunctionType, value_rep: {kind: copy, type: type1}} -// CHECK:STDOUT: type_blocks: {} +// CHECK:STDOUT: type1: {constant: template inst+2, value_rep: {kind: none, type: type2}} +// CHECK:STDOUT: type2: {constant: template inst+3, value_rep: {kind: none, type: type2}} +// CHECK:STDOUT: type_blocks: +// CHECK:STDOUT: typeBlock0: {} +// CHECK:STDOUT: typeBlock1: {} // CHECK:STDOUT: insts: // CHECK:STDOUT: 'inst+0': {kind: Namespace, arg0: name_scope0, arg1: inst, type: type0} // CHECK:STDOUT: 'inst+1': {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1} -// CHECK:STDOUT: 'inst+2': {kind: Return} +// CHECK:STDOUT: 'inst+2': {kind: FunctionType, arg0: function0, type: typeTypeType} +// CHECK:STDOUT: 'inst+3': {kind: TupleType, arg0: typeBlock0, type: typeTypeType} +// CHECK:STDOUT: 'inst+4': {kind: StructValue, arg0: empty, type: type1} +// CHECK:STDOUT: 'inst+5': {kind: Return} // CHECK:STDOUT: constant_values: // CHECK:STDOUT: 'inst+0': template inst+0 -// CHECK:STDOUT: 'inst+1': template inst+1 +// CHECK:STDOUT: 'inst+1': template inst+4 +// CHECK:STDOUT: 'inst+2': template inst+2 +// CHECK:STDOUT: 'inst+3': template inst+3 +// CHECK:STDOUT: 'inst+4': template inst+4 // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: // CHECK:STDOUT: 0: inst+1 // CHECK:STDOUT: global_init: {} // CHECK:STDOUT: block3: -// CHECK:STDOUT: 0: inst+2 +// CHECK:STDOUT: 0: inst+5 // CHECK:STDOUT: block4: // CHECK:STDOUT: 0: inst+0 // CHECK:STDOUT: 1: inst+1 @@ -100,11 +124,17 @@ fn B() {} // CHECK:STDOUT: // CHECK:STDOUT: --- b.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: B = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .B = %B +// CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %B: = fn_decl @B [template] {} +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() { diff --git a/toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon b/toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon index 55350ac5ccba..9428b95091ea 100644 --- a/toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon +++ b/toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon @@ -30,22 +30,31 @@ fn B() {} // CHECK:STDOUT: classes: {} // CHECK:STDOUT: types: // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}} -// CHECK:STDOUT: type1: {constant: template instFunctionType, value_rep: {kind: copy, type: type1}} -// CHECK:STDOUT: type_blocks: {} +// CHECK:STDOUT: type1: {constant: template inst+2, value_rep: {kind: none, type: type2}} +// CHECK:STDOUT: type2: {constant: template inst+3, value_rep: {kind: none, type: type2}} +// CHECK:STDOUT: type_blocks: +// CHECK:STDOUT: typeBlock0: {} +// CHECK:STDOUT: typeBlock1: {} // CHECK:STDOUT: insts: // CHECK:STDOUT: 'inst+0': {kind: Namespace, arg0: name_scope0, arg1: inst, type: type0} // CHECK:STDOUT: 'inst+1': {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1} -// CHECK:STDOUT: 'inst+2': {kind: Return} +// CHECK:STDOUT: 'inst+2': {kind: FunctionType, arg0: function0, type: typeTypeType} +// CHECK:STDOUT: 'inst+3': {kind: TupleType, arg0: typeBlock0, type: typeTypeType} +// CHECK:STDOUT: 'inst+4': {kind: StructValue, arg0: empty, type: type1} +// CHECK:STDOUT: 'inst+5': {kind: Return} // CHECK:STDOUT: constant_values: // CHECK:STDOUT: 'inst+0': template inst+0 -// CHECK:STDOUT: 'inst+1': template inst+1 +// CHECK:STDOUT: 'inst+1': template inst+4 +// CHECK:STDOUT: 'inst+2': template inst+2 +// CHECK:STDOUT: 'inst+3': template inst+3 +// CHECK:STDOUT: 'inst+4': template inst+4 // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: // CHECK:STDOUT: 0: inst+1 // CHECK:STDOUT: global_init: {} // CHECK:STDOUT: block3: -// CHECK:STDOUT: 0: inst+2 +// CHECK:STDOUT: 0: inst+5 // CHECK:STDOUT: block4: // CHECK:STDOUT: 0: inst+0 // CHECK:STDOUT: 1: inst+1 @@ -62,22 +71,31 @@ fn B() {} // CHECK:STDOUT: classes: {} // CHECK:STDOUT: types: // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}} -// CHECK:STDOUT: type1: {constant: template instFunctionType, value_rep: {kind: copy, type: type1}} -// CHECK:STDOUT: type_blocks: {} +// CHECK:STDOUT: type1: {constant: template inst+2, value_rep: {kind: none, type: type2}} +// CHECK:STDOUT: type2: {constant: template inst+3, value_rep: {kind: none, type: type2}} +// CHECK:STDOUT: type_blocks: +// CHECK:STDOUT: typeBlock0: {} +// CHECK:STDOUT: typeBlock1: {} // CHECK:STDOUT: insts: // CHECK:STDOUT: 'inst+0': {kind: Namespace, arg0: name_scope0, arg1: inst, type: type0} // CHECK:STDOUT: 'inst+1': {kind: FunctionDecl, arg0: function0, arg1: empty, type: type1} -// CHECK:STDOUT: 'inst+2': {kind: Return} +// CHECK:STDOUT: 'inst+2': {kind: FunctionType, arg0: function0, type: typeTypeType} +// CHECK:STDOUT: 'inst+3': {kind: TupleType, arg0: typeBlock0, type: typeTypeType} +// CHECK:STDOUT: 'inst+4': {kind: StructValue, arg0: empty, type: type1} +// CHECK:STDOUT: 'inst+5': {kind: Return} // CHECK:STDOUT: constant_values: // CHECK:STDOUT: 'inst+0': template inst+0 -// CHECK:STDOUT: 'inst+1': template inst+1 +// CHECK:STDOUT: 'inst+1': template inst+4 +// CHECK:STDOUT: 'inst+2': template inst+2 +// CHECK:STDOUT: 'inst+3': template inst+3 +// CHECK:STDOUT: 'inst+4': template inst+4 // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: // CHECK:STDOUT: 0: inst+1 // CHECK:STDOUT: global_init: {} // CHECK:STDOUT: block3: -// CHECK:STDOUT: 0: inst+2 +// CHECK:STDOUT: 0: inst+5 // CHECK:STDOUT: block4: // CHECK:STDOUT: 0: inst+0 // CHECK:STDOUT: 1: inst+1 diff --git a/toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon b/toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon index 49c52212eb35..dde218df52d2 100644 --- a/toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon +++ b/toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon @@ -27,8 +27,8 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}} // CHECK:STDOUT: type1: {constant: template inst+1, value_rep: {kind: none, type: type1}} // CHECK:STDOUT: type2: {constant: template inst+8, value_rep: {kind: pointer, type: type4}} -// CHECK:STDOUT: type3: {constant: template instFunctionType, value_rep: {kind: copy, type: type3}} -// CHECK:STDOUT: type4: {constant: template inst+15, value_rep: {kind: copy, type: type4}} +// CHECK:STDOUT: type3: {constant: template inst+15, value_rep: {kind: none, type: type1}} +// CHECK:STDOUT: type4: {constant: template inst+17, value_rep: {kind: copy, type: type4}} // CHECK:STDOUT: type_blocks: // CHECK:STDOUT: typeBlock0: {} // CHECK:STDOUT: typeBlock1: {} @@ -44,7 +44,8 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: 1: type1 // CHECK:STDOUT: typeBlock8: {} // CHECK:STDOUT: typeBlock9: {} -// CHECK:STDOUT: typeBlock10: +// CHECK:STDOUT: typeBlock10: {} +// CHECK:STDOUT: typeBlock11: // CHECK:STDOUT: 0: type1 // CHECK:STDOUT: 1: type1 // CHECK:STDOUT: insts: @@ -63,21 +64,23 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: 'inst+12': {kind: Converted, arg0: inst+9, arg1: inst+8, type: typeTypeType} // CHECK:STDOUT: 'inst+13': {kind: VarStorage, arg0: nameReturnSlot, type: type2} // CHECK:STDOUT: 'inst+14': {kind: FunctionDecl, arg0: function0, arg1: block5, type: type3} -// CHECK:STDOUT: 'inst+15': {kind: PointerType, arg0: type2, type: typeTypeType} -// CHECK:STDOUT: 'inst+16': {kind: NameRef, arg0: name1, arg1: inst+5, type: type1} -// CHECK:STDOUT: 'inst+17': {kind: TupleLiteral, arg0: empty, type: type1} -// CHECK:STDOUT: 'inst+18': {kind: TupleLiteral, arg0: block7, type: type2} -// CHECK:STDOUT: 'inst+19': {kind: TupleAccess, arg0: inst+13, arg1: element0, type: type1} -// CHECK:STDOUT: 'inst+20': {kind: TupleInit, arg0: block8, arg1: inst+19, type: type1} -// CHECK:STDOUT: 'inst+21': {kind: TupleValue, arg0: block9, type: type1} -// CHECK:STDOUT: 'inst+22': {kind: Converted, arg0: inst+16, arg1: inst+20, type: type1} -// CHECK:STDOUT: 'inst+23': {kind: TupleAccess, arg0: inst+13, arg1: element1, type: type1} -// CHECK:STDOUT: 'inst+24': {kind: TupleInit, arg0: empty, arg1: inst+23, type: type1} -// CHECK:STDOUT: 'inst+25': {kind: Converted, arg0: inst+17, arg1: inst+24, type: type1} -// CHECK:STDOUT: 'inst+26': {kind: TupleInit, arg0: block10, arg1: inst+13, type: type2} -// CHECK:STDOUT: 'inst+27': {kind: TupleValue, arg0: block12, type: type2} -// CHECK:STDOUT: 'inst+28': {kind: Converted, arg0: inst+18, arg1: inst+26, type: type2} -// CHECK:STDOUT: 'inst+29': {kind: ReturnExpr, arg0: inst+28, arg1: inst+13} +// CHECK:STDOUT: 'inst+15': {kind: FunctionType, arg0: function0, type: typeTypeType} +// CHECK:STDOUT: 'inst+16': {kind: StructValue, arg0: empty, type: type3} +// CHECK:STDOUT: 'inst+17': {kind: PointerType, arg0: type2, type: typeTypeType} +// CHECK:STDOUT: 'inst+18': {kind: NameRef, arg0: name1, arg1: inst+5, type: type1} +// CHECK:STDOUT: 'inst+19': {kind: TupleLiteral, arg0: empty, type: type1} +// CHECK:STDOUT: 'inst+20': {kind: TupleLiteral, arg0: block7, type: type2} +// CHECK:STDOUT: 'inst+21': {kind: TupleAccess, arg0: inst+13, arg1: element0, type: type1} +// CHECK:STDOUT: 'inst+22': {kind: TupleInit, arg0: block8, arg1: inst+21, type: type1} +// CHECK:STDOUT: 'inst+23': {kind: TupleValue, arg0: block9, type: type1} +// CHECK:STDOUT: 'inst+24': {kind: Converted, arg0: inst+18, arg1: inst+22, type: type1} +// CHECK:STDOUT: 'inst+25': {kind: TupleAccess, arg0: inst+13, arg1: element1, type: type1} +// CHECK:STDOUT: 'inst+26': {kind: TupleInit, arg0: empty, arg1: inst+25, type: type1} +// CHECK:STDOUT: 'inst+27': {kind: Converted, arg0: inst+19, arg1: inst+26, type: type1} +// CHECK:STDOUT: 'inst+28': {kind: TupleInit, arg0: block10, arg1: inst+13, type: type2} +// CHECK:STDOUT: 'inst+29': {kind: TupleValue, arg0: block12, type: type2} +// CHECK:STDOUT: 'inst+30': {kind: Converted, arg0: inst+20, arg1: inst+28, type: type2} +// CHECK:STDOUT: 'inst+31': {kind: ReturnExpr, arg0: inst+30, arg1: inst+13} // CHECK:STDOUT: constant_values: // CHECK:STDOUT: 'inst+0': template inst+0 // CHECK:STDOUT: 'inst+1': template inst+1 @@ -86,16 +89,18 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: 'inst+10': template inst+1 // CHECK:STDOUT: 'inst+11': template inst+1 // CHECK:STDOUT: 'inst+12': template inst+8 -// CHECK:STDOUT: 'inst+14': template inst+14 +// CHECK:STDOUT: 'inst+14': template inst+16 // CHECK:STDOUT: 'inst+15': template inst+15 -// CHECK:STDOUT: 'inst+20': template inst+21 -// CHECK:STDOUT: 'inst+21': template inst+21 -// CHECK:STDOUT: 'inst+22': template inst+21 -// CHECK:STDOUT: 'inst+24': template inst+21 -// CHECK:STDOUT: 'inst+25': template inst+21 -// CHECK:STDOUT: 'inst+26': template inst+27 -// CHECK:STDOUT: 'inst+27': template inst+27 -// CHECK:STDOUT: 'inst+28': template inst+27 +// CHECK:STDOUT: 'inst+16': template inst+16 +// CHECK:STDOUT: 'inst+17': template inst+17 +// CHECK:STDOUT: 'inst+22': template inst+23 +// CHECK:STDOUT: 'inst+23': template inst+23 +// CHECK:STDOUT: 'inst+24': template inst+23 +// CHECK:STDOUT: 'inst+26': template inst+23 +// CHECK:STDOUT: 'inst+27': template inst+23 +// CHECK:STDOUT: 'inst+28': template inst+29 +// CHECK:STDOUT: 'inst+29': template inst+29 +// CHECK:STDOUT: 'inst+30': template inst+29 // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: @@ -119,30 +124,30 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: 9: inst+12 // CHECK:STDOUT: 10: inst+13 // CHECK:STDOUT: block6: -// CHECK:STDOUT: 0: inst+16 -// CHECK:STDOUT: 1: inst+17 -// CHECK:STDOUT: 2: inst+18 -// CHECK:STDOUT: 3: inst+19 -// CHECK:STDOUT: 4: inst+20 -// CHECK:STDOUT: 5: inst+22 -// CHECK:STDOUT: 6: inst+23 -// CHECK:STDOUT: 7: inst+24 -// CHECK:STDOUT: 8: inst+25 -// CHECK:STDOUT: 9: inst+26 -// CHECK:STDOUT: 10: inst+28 -// CHECK:STDOUT: 11: inst+29 +// CHECK:STDOUT: 0: inst+18 +// CHECK:STDOUT: 1: inst+19 +// CHECK:STDOUT: 2: inst+20 +// CHECK:STDOUT: 3: inst+21 +// CHECK:STDOUT: 4: inst+22 +// CHECK:STDOUT: 5: inst+24 +// CHECK:STDOUT: 6: inst+25 +// CHECK:STDOUT: 7: inst+26 +// CHECK:STDOUT: 8: inst+27 +// CHECK:STDOUT: 9: inst+28 +// CHECK:STDOUT: 10: inst+30 +// CHECK:STDOUT: 11: inst+31 // CHECK:STDOUT: block7: -// CHECK:STDOUT: 0: inst+16 -// CHECK:STDOUT: 1: inst+17 +// CHECK:STDOUT: 0: inst+18 +// CHECK:STDOUT: 1: inst+19 // CHECK:STDOUT: block8: {} // CHECK:STDOUT: block9: {} // CHECK:STDOUT: block10: -// CHECK:STDOUT: 0: inst+22 -// CHECK:STDOUT: 1: inst+25 +// CHECK:STDOUT: 0: inst+24 +// CHECK:STDOUT: 1: inst+27 // CHECK:STDOUT: block11: {} // CHECK:STDOUT: block12: -// CHECK:STDOUT: 0: inst+21 -// CHECK:STDOUT: 1: inst+21 +// CHECK:STDOUT: 0: inst+23 +// CHECK:STDOUT: 1: inst+23 // CHECK:STDOUT: block13: // CHECK:STDOUT: 0: inst+0 // CHECK:STDOUT: 1: inst+14 @@ -153,6 +158,8 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %.2: type = tuple_type ((), ()) [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct: Foo = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type ((), ()) [template] // CHECK:STDOUT: %tuple.1: () = tuple_value () [template] // CHECK:STDOUT: %tuple.2: ((), ()) = tuple_value (%tuple.1, %tuple.1) [template] @@ -160,9 +167,9 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] { // CHECK:STDOUT: %.loc11_12.1: () = tuple_literal () // CHECK:STDOUT: %.loc11_12.2: type = converted %.loc11_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %n.loc11_8.1: () = param n diff --git a/toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon b/toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon index a63b1c9ae057..10dac04ea701 100644 --- a/toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon +++ b/toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon @@ -24,15 +24,21 @@ fn C(r#if: ()) -> () { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .B = %B -// CHECK:STDOUT: .C = %C +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .B = %B.decl +// CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { // CHECK:STDOUT: %.loc11_10.1: () = tuple_literal () // CHECK:STDOUT: %.loc11_10.2: type = converted %.loc11_10.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %n.loc11_6.1: () = param n @@ -41,7 +47,7 @@ fn C(r#if: ()) -> () { // CHECK:STDOUT: %.loc11_17.2: type = converted %.loc11_17.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @A.%return: ref () = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B: = fn_decl @B [template] { +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: %.loc15_12.1: () = tuple_literal () // CHECK:STDOUT: %.loc15_12.2: type = converted %.loc15_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %n.loc15_6.1: () = param n @@ -50,7 +56,7 @@ fn C(r#if: ()) -> () { // CHECK:STDOUT: %.loc15_19.2: type = converted %.loc15_19.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @B.%return: ref () = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C: = fn_decl @C [template] { +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { // CHECK:STDOUT: %.loc19_13.1: () = tuple_literal () // CHECK:STDOUT: %.loc19_13.2: type = converted %.loc19_13.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %if.loc19_6.1: () = param r#if diff --git a/toolchain/check/testdata/basics/no_prelude/raw_ir.carbon b/toolchain/check/testdata/basics/no_prelude/raw_ir.carbon index 1f4db164806c..4ba5892a5d62 100644 --- a/toolchain/check/testdata/basics/no_prelude/raw_ir.carbon +++ b/toolchain/check/testdata/basics/no_prelude/raw_ir.carbon @@ -27,8 +27,8 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: type0: {constant: template instNamespaceType, value_rep: {kind: copy, type: type0}} // CHECK:STDOUT: type1: {constant: template inst+1, value_rep: {kind: none, type: type1}} // CHECK:STDOUT: type2: {constant: template inst+8, value_rep: {kind: pointer, type: type4}} -// CHECK:STDOUT: type3: {constant: template instFunctionType, value_rep: {kind: copy, type: type3}} -// CHECK:STDOUT: type4: {constant: template inst+15, value_rep: {kind: copy, type: type4}} +// CHECK:STDOUT: type3: {constant: template inst+15, value_rep: {kind: none, type: type1}} +// CHECK:STDOUT: type4: {constant: template inst+17, value_rep: {kind: copy, type: type4}} // CHECK:STDOUT: type_blocks: // CHECK:STDOUT: typeBlock0: {} // CHECK:STDOUT: typeBlock1: {} @@ -44,7 +44,8 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: 1: type1 // CHECK:STDOUT: typeBlock8: {} // CHECK:STDOUT: typeBlock9: {} -// CHECK:STDOUT: typeBlock10: +// CHECK:STDOUT: typeBlock10: {} +// CHECK:STDOUT: typeBlock11: // CHECK:STDOUT: 0: type1 // CHECK:STDOUT: 1: type1 // CHECK:STDOUT: insts: @@ -63,21 +64,23 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: 'inst+12': {kind: Converted, arg0: inst+9, arg1: inst+8, type: typeTypeType} // CHECK:STDOUT: 'inst+13': {kind: VarStorage, arg0: nameReturnSlot, type: type2} // CHECK:STDOUT: 'inst+14': {kind: FunctionDecl, arg0: function0, arg1: block5, type: type3} -// CHECK:STDOUT: 'inst+15': {kind: PointerType, arg0: type2, type: typeTypeType} -// CHECK:STDOUT: 'inst+16': {kind: NameRef, arg0: name1, arg1: inst+5, type: type1} -// CHECK:STDOUT: 'inst+17': {kind: TupleLiteral, arg0: empty, type: type1} -// CHECK:STDOUT: 'inst+18': {kind: TupleLiteral, arg0: block7, type: type2} -// CHECK:STDOUT: 'inst+19': {kind: TupleAccess, arg0: inst+13, arg1: element0, type: type1} -// CHECK:STDOUT: 'inst+20': {kind: TupleInit, arg0: block8, arg1: inst+19, type: type1} -// CHECK:STDOUT: 'inst+21': {kind: TupleValue, arg0: block9, type: type1} -// CHECK:STDOUT: 'inst+22': {kind: Converted, arg0: inst+16, arg1: inst+20, type: type1} -// CHECK:STDOUT: 'inst+23': {kind: TupleAccess, arg0: inst+13, arg1: element1, type: type1} -// CHECK:STDOUT: 'inst+24': {kind: TupleInit, arg0: empty, arg1: inst+23, type: type1} -// CHECK:STDOUT: 'inst+25': {kind: Converted, arg0: inst+17, arg1: inst+24, type: type1} -// CHECK:STDOUT: 'inst+26': {kind: TupleInit, arg0: block10, arg1: inst+13, type: type2} -// CHECK:STDOUT: 'inst+27': {kind: TupleValue, arg0: block12, type: type2} -// CHECK:STDOUT: 'inst+28': {kind: Converted, arg0: inst+18, arg1: inst+26, type: type2} -// CHECK:STDOUT: 'inst+29': {kind: ReturnExpr, arg0: inst+28, arg1: inst+13} +// CHECK:STDOUT: 'inst+15': {kind: FunctionType, arg0: function0, type: typeTypeType} +// CHECK:STDOUT: 'inst+16': {kind: StructValue, arg0: empty, type: type3} +// CHECK:STDOUT: 'inst+17': {kind: PointerType, arg0: type2, type: typeTypeType} +// CHECK:STDOUT: 'inst+18': {kind: NameRef, arg0: name1, arg1: inst+5, type: type1} +// CHECK:STDOUT: 'inst+19': {kind: TupleLiteral, arg0: empty, type: type1} +// CHECK:STDOUT: 'inst+20': {kind: TupleLiteral, arg0: block7, type: type2} +// CHECK:STDOUT: 'inst+21': {kind: TupleAccess, arg0: inst+13, arg1: element0, type: type1} +// CHECK:STDOUT: 'inst+22': {kind: TupleInit, arg0: block8, arg1: inst+21, type: type1} +// CHECK:STDOUT: 'inst+23': {kind: TupleValue, arg0: block9, type: type1} +// CHECK:STDOUT: 'inst+24': {kind: Converted, arg0: inst+18, arg1: inst+22, type: type1} +// CHECK:STDOUT: 'inst+25': {kind: TupleAccess, arg0: inst+13, arg1: element1, type: type1} +// CHECK:STDOUT: 'inst+26': {kind: TupleInit, arg0: empty, arg1: inst+25, type: type1} +// CHECK:STDOUT: 'inst+27': {kind: Converted, arg0: inst+19, arg1: inst+26, type: type1} +// CHECK:STDOUT: 'inst+28': {kind: TupleInit, arg0: block10, arg1: inst+13, type: type2} +// CHECK:STDOUT: 'inst+29': {kind: TupleValue, arg0: block12, type: type2} +// CHECK:STDOUT: 'inst+30': {kind: Converted, arg0: inst+20, arg1: inst+28, type: type2} +// CHECK:STDOUT: 'inst+31': {kind: ReturnExpr, arg0: inst+30, arg1: inst+13} // CHECK:STDOUT: constant_values: // CHECK:STDOUT: 'inst+0': template inst+0 // CHECK:STDOUT: 'inst+1': template inst+1 @@ -86,16 +89,18 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: 'inst+10': template inst+1 // CHECK:STDOUT: 'inst+11': template inst+1 // CHECK:STDOUT: 'inst+12': template inst+8 -// CHECK:STDOUT: 'inst+14': template inst+14 +// CHECK:STDOUT: 'inst+14': template inst+16 // CHECK:STDOUT: 'inst+15': template inst+15 -// CHECK:STDOUT: 'inst+20': template inst+21 -// CHECK:STDOUT: 'inst+21': template inst+21 -// CHECK:STDOUT: 'inst+22': template inst+21 -// CHECK:STDOUT: 'inst+24': template inst+21 -// CHECK:STDOUT: 'inst+25': template inst+21 -// CHECK:STDOUT: 'inst+26': template inst+27 -// CHECK:STDOUT: 'inst+27': template inst+27 -// CHECK:STDOUT: 'inst+28': template inst+27 +// CHECK:STDOUT: 'inst+16': template inst+16 +// CHECK:STDOUT: 'inst+17': template inst+17 +// CHECK:STDOUT: 'inst+22': template inst+23 +// CHECK:STDOUT: 'inst+23': template inst+23 +// CHECK:STDOUT: 'inst+24': template inst+23 +// CHECK:STDOUT: 'inst+26': template inst+23 +// CHECK:STDOUT: 'inst+27': template inst+23 +// CHECK:STDOUT: 'inst+28': template inst+29 +// CHECK:STDOUT: 'inst+29': template inst+29 +// CHECK:STDOUT: 'inst+30': template inst+29 // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: @@ -119,30 +124,30 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: 9: inst+12 // CHECK:STDOUT: 10: inst+13 // CHECK:STDOUT: block6: -// CHECK:STDOUT: 0: inst+16 -// CHECK:STDOUT: 1: inst+17 -// CHECK:STDOUT: 2: inst+18 -// CHECK:STDOUT: 3: inst+19 -// CHECK:STDOUT: 4: inst+20 -// CHECK:STDOUT: 5: inst+22 -// CHECK:STDOUT: 6: inst+23 -// CHECK:STDOUT: 7: inst+24 -// CHECK:STDOUT: 8: inst+25 -// CHECK:STDOUT: 9: inst+26 -// CHECK:STDOUT: 10: inst+28 -// CHECK:STDOUT: 11: inst+29 +// CHECK:STDOUT: 0: inst+18 +// CHECK:STDOUT: 1: inst+19 +// CHECK:STDOUT: 2: inst+20 +// CHECK:STDOUT: 3: inst+21 +// CHECK:STDOUT: 4: inst+22 +// CHECK:STDOUT: 5: inst+24 +// CHECK:STDOUT: 6: inst+25 +// CHECK:STDOUT: 7: inst+26 +// CHECK:STDOUT: 8: inst+27 +// CHECK:STDOUT: 9: inst+28 +// CHECK:STDOUT: 10: inst+30 +// CHECK:STDOUT: 11: inst+31 // CHECK:STDOUT: block7: -// CHECK:STDOUT: 0: inst+16 -// CHECK:STDOUT: 1: inst+17 +// CHECK:STDOUT: 0: inst+18 +// CHECK:STDOUT: 1: inst+19 // CHECK:STDOUT: block8: {} // CHECK:STDOUT: block9: {} // CHECK:STDOUT: block10: -// CHECK:STDOUT: 0: inst+22 -// CHECK:STDOUT: 1: inst+25 +// CHECK:STDOUT: 0: inst+24 +// CHECK:STDOUT: 1: inst+27 // CHECK:STDOUT: block11: {} // CHECK:STDOUT: block12: -// CHECK:STDOUT: 0: inst+21 -// CHECK:STDOUT: 1: inst+21 +// CHECK:STDOUT: 0: inst+23 +// CHECK:STDOUT: 1: inst+23 // CHECK:STDOUT: block13: // CHECK:STDOUT: 0: inst+0 // CHECK:STDOUT: 1: inst+14 diff --git a/toolchain/check/testdata/basics/no_prelude/textual_ir.carbon b/toolchain/check/testdata/basics/no_prelude/textual_ir.carbon index 3504b8033780..3836ce9e3521 100644 --- a/toolchain/check/testdata/basics/no_prelude/textual_ir.carbon +++ b/toolchain/check/testdata/basics/no_prelude/textual_ir.carbon @@ -17,6 +17,8 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %.2: type = tuple_type ((), ()) [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct: Foo = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type ((), ()) [template] // CHECK:STDOUT: %tuple.1: () = tuple_value () [template] // CHECK:STDOUT: %tuple.2: ((), ()) = tuple_value (%tuple.1, %tuple.1) [template] @@ -24,9 +26,9 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] { // CHECK:STDOUT: %.loc11_12.1: () = tuple_literal () // CHECK:STDOUT: %.loc11_12.2: type = converted %.loc11_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %n.loc11_8.1: () = param n diff --git a/toolchain/check/testdata/basics/no_prelude/verbose.carbon b/toolchain/check/testdata/basics/no_prelude/verbose.carbon index fd5eb495e7a7..13bc20f1ce83 100644 --- a/toolchain/check/testdata/basics/no_prelude/verbose.carbon +++ b/toolchain/check/testdata/basics/no_prelude/verbose.carbon @@ -8,8 +8,8 @@ // NOAUTOUPDATE // SET-CHECK-SUBSET // CHECK:STDERR: Node Push 0: FunctionIntroducer -> -// CHECK:STDERR: AddPlaceholderInst: {kind: FunctionDecl, arg0: {{.*}}, type: type{{[0-9]+}}} -// CHECK:STDERR: ReplaceInst: inst+{{[0-9]+}} -> {kind: FunctionDecl, arg0: {{.*}}, type: type{{[0-9]+}}} +// CHECK:STDERR: AddPlaceholderInst: {kind: FunctionDecl, arg0: function, arg1: empty} +// CHECK:STDERR: ReplaceInst: inst+{{[0-9]+}} -> {kind: FunctionDecl, arg0: function{{[0-9]+}}, arg1: empty, type: type{{[0-9]+}}} // CHECK:STDERR: inst_block_stack_ Push 1 // CHECK:STDERR: AddInst: {kind: Return} // CHECK:STDERR: inst_block_stack_ Pop 1: block{{[0-9]+}} diff --git a/toolchain/check/testdata/basics/numeric_literals.carbon b/toolchain/check/testdata/basics/numeric_literals.carbon index f54328bc111c..a1cfaee2d821 100644 --- a/toolchain/check/testdata/basics/numeric_literals.carbon +++ b/toolchain/check/testdata/basics/numeric_literals.carbon @@ -28,104 +28,107 @@ fn F() { // CHECK:STDOUT: --- numeric_literals.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 6 [template] -// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] -// CHECK:STDOUT: %.3: type = ptr_type [i32; 6] [template] -// CHECK:STDOUT: %.4: i32 = int_literal 8 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 9 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 2147483647 [template] -// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32, i32, i32, i32) [template] -// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.9: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.10: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.11: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.12: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.13: i32 = int_literal 5 [template] -// CHECK:STDOUT: %array.1: [i32; 6] = tuple_value (%.4, %.5, %.4, %.4, %.6, %.6) [template] -// CHECK:STDOUT: %.14: type = array_type %.1, f64 [template] -// CHECK:STDOUT: %.15: type = ptr_type [f64; 6] [template] -// CHECK:STDOUT: %.16: f64 = float_literal 0.90000000000000002 [template] -// CHECK:STDOUT: %.17: f64 = float_literal 8 [template] -// CHECK:STDOUT: %.18: f64 = float_literal 80 [template] -// CHECK:STDOUT: %.19: f64 = float_literal 1.0E+7 [template] -// CHECK:STDOUT: %.20: f64 = float_literal 1.0E+8 [template] -// CHECK:STDOUT: %.21: f64 = float_literal 1.0E-8 [template] -// CHECK:STDOUT: %.22: type = tuple_type (f64, f64, f64, f64, f64, f64) [template] -// CHECK:STDOUT: %array.2: [f64; 6] = tuple_value (%.16, %.17, %.18, %.19, %.20, %.21) [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 6 [template] +// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template] +// CHECK:STDOUT: %.4: type = ptr_type [i32; 6] [template] +// CHECK:STDOUT: %.5: i32 = int_literal 8 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 9 [template] +// CHECK:STDOUT: %.7: i32 = int_literal 2147483647 [template] +// CHECK:STDOUT: %.8: type = tuple_type (i32, i32, i32, i32, i32, i32) [template] +// CHECK:STDOUT: %.9: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.10: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.11: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.12: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.13: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.14: i32 = int_literal 5 [template] +// CHECK:STDOUT: %array.1: [i32; 6] = tuple_value (%.5, %.6, %.5, %.5, %.7, %.7) [template] +// CHECK:STDOUT: %.15: type = array_type %.2, f64 [template] +// CHECK:STDOUT: %.16: type = ptr_type [f64; 6] [template] +// CHECK:STDOUT: %.17: f64 = float_literal 0.90000000000000002 [template] +// CHECK:STDOUT: %.18: f64 = float_literal 8 [template] +// CHECK:STDOUT: %.19: f64 = float_literal 80 [template] +// CHECK:STDOUT: %.20: f64 = float_literal 1.0E+7 [template] +// CHECK:STDOUT: %.21: f64 = float_literal 1.0E+8 [template] +// CHECK:STDOUT: %.22: f64 = float_literal 1.0E-8 [template] +// CHECK:STDOUT: %.23: type = tuple_type (f64, f64, f64, f64, f64, f64) [template] +// CHECK:STDOUT: %array.2: [f64; 6] = tuple_value (%.17, %.18, %.19, %.20, %.21, %.22) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_19: i32 = int_literal 6 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_20: type = array_type %.loc10_19, i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_19: i32 = int_literal 6 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_20: type = array_type %.loc10_19, i32 [template = constants.%.3] // CHECK:STDOUT: %ints.var: ref [i32; 6] = var ints // CHECK:STDOUT: %ints: ref [i32; 6] = bind_name ints, %ints.var -// CHECK:STDOUT: %.loc11: i32 = int_literal 8 [template = constants.%.4] -// CHECK:STDOUT: %.loc12: i32 = int_literal 9 [template = constants.%.5] -// CHECK:STDOUT: %.loc13: i32 = int_literal 8 [template = constants.%.4] -// CHECK:STDOUT: %.loc14: i32 = int_literal 8 [template = constants.%.4] -// CHECK:STDOUT: %.loc15: i32 = int_literal 2147483647 [template = constants.%.6] -// CHECK:STDOUT: %.loc16: i32 = int_literal 2147483647 [template = constants.%.6] +// CHECK:STDOUT: %.loc11: i32 = int_literal 8 [template = constants.%.5] +// CHECK:STDOUT: %.loc12: i32 = int_literal 9 [template = constants.%.6] +// CHECK:STDOUT: %.loc13: i32 = int_literal 8 [template = constants.%.5] +// CHECK:STDOUT: %.loc14: i32 = int_literal 8 [template = constants.%.5] +// CHECK:STDOUT: %.loc15: i32 = int_literal 2147483647 [template = constants.%.7] +// CHECK:STDOUT: %.loc16: i32 = int_literal 2147483647 [template = constants.%.7] // CHECK:STDOUT: %.loc17_3.1: (i32, i32, i32, i32, i32, i32) = tuple_literal (%.loc11, %.loc12, %.loc13, %.loc14, %.loc15, %.loc16) -// CHECK:STDOUT: %.loc17_3.2: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc17_3.2: i32 = int_literal 0 [template = constants.%.9] // CHECK:STDOUT: %.loc17_3.3: ref i32 = array_index %ints.var, %.loc17_3.2 -// CHECK:STDOUT: %.loc17_3.4: init i32 = initialize_from %.loc11 to %.loc17_3.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc17_3.5: i32 = int_literal 1 [template = constants.%.9] +// CHECK:STDOUT: %.loc17_3.4: init i32 = initialize_from %.loc11 to %.loc17_3.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_3.5: i32 = int_literal 1 [template = constants.%.10] // CHECK:STDOUT: %.loc17_3.6: ref i32 = array_index %ints.var, %.loc17_3.5 -// CHECK:STDOUT: %.loc17_3.7: init i32 = initialize_from %.loc12 to %.loc17_3.6 [template = constants.%.5] -// CHECK:STDOUT: %.loc17_3.8: i32 = int_literal 2 [template = constants.%.10] +// CHECK:STDOUT: %.loc17_3.7: init i32 = initialize_from %.loc12 to %.loc17_3.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc17_3.8: i32 = int_literal 2 [template = constants.%.11] // CHECK:STDOUT: %.loc17_3.9: ref i32 = array_index %ints.var, %.loc17_3.8 -// CHECK:STDOUT: %.loc17_3.10: init i32 = initialize_from %.loc13 to %.loc17_3.9 [template = constants.%.4] -// CHECK:STDOUT: %.loc17_3.11: i32 = int_literal 3 [template = constants.%.11] +// CHECK:STDOUT: %.loc17_3.10: init i32 = initialize_from %.loc13 to %.loc17_3.9 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_3.11: i32 = int_literal 3 [template = constants.%.12] // CHECK:STDOUT: %.loc17_3.12: ref i32 = array_index %ints.var, %.loc17_3.11 -// CHECK:STDOUT: %.loc17_3.13: init i32 = initialize_from %.loc14 to %.loc17_3.12 [template = constants.%.4] -// CHECK:STDOUT: %.loc17_3.14: i32 = int_literal 4 [template = constants.%.12] +// CHECK:STDOUT: %.loc17_3.13: init i32 = initialize_from %.loc14 to %.loc17_3.12 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_3.14: i32 = int_literal 4 [template = constants.%.13] // CHECK:STDOUT: %.loc17_3.15: ref i32 = array_index %ints.var, %.loc17_3.14 -// CHECK:STDOUT: %.loc17_3.16: init i32 = initialize_from %.loc15 to %.loc17_3.15 [template = constants.%.6] -// CHECK:STDOUT: %.loc17_3.17: i32 = int_literal 5 [template = constants.%.13] +// CHECK:STDOUT: %.loc17_3.16: init i32 = initialize_from %.loc15 to %.loc17_3.15 [template = constants.%.7] +// CHECK:STDOUT: %.loc17_3.17: i32 = int_literal 5 [template = constants.%.14] // CHECK:STDOUT: %.loc17_3.18: ref i32 = array_index %ints.var, %.loc17_3.17 -// CHECK:STDOUT: %.loc17_3.19: init i32 = initialize_from %.loc16 to %.loc17_3.18 [template = constants.%.6] +// CHECK:STDOUT: %.loc17_3.19: init i32 = initialize_from %.loc16 to %.loc17_3.18 [template = constants.%.7] // CHECK:STDOUT: %.loc17_3.20: init [i32; 6] = array_init (%.loc17_3.4, %.loc17_3.7, %.loc17_3.10, %.loc17_3.13, %.loc17_3.16, %.loc17_3.19) to %ints.var [template = constants.%array.1] // CHECK:STDOUT: %.loc17_4: init [i32; 6] = converted %.loc17_3.1, %.loc17_3.20 [template = constants.%array.1] // CHECK:STDOUT: assign %ints.var, %.loc17_4 -// CHECK:STDOUT: %.loc18_21: i32 = int_literal 6 [template = constants.%.1] -// CHECK:STDOUT: %.loc18_22: type = array_type %.loc18_21, f64 [template = constants.%.14] +// CHECK:STDOUT: %.loc18_21: i32 = int_literal 6 [template = constants.%.2] +// CHECK:STDOUT: %.loc18_22: type = array_type %.loc18_21, f64 [template = constants.%.15] // CHECK:STDOUT: %floats.var: ref [f64; 6] = var floats // CHECK:STDOUT: %floats: ref [f64; 6] = bind_name floats, %floats.var -// CHECK:STDOUT: %.loc19: f64 = float_literal 0.90000000000000002 [template = constants.%.16] -// CHECK:STDOUT: %.loc20: f64 = float_literal 8 [template = constants.%.17] -// CHECK:STDOUT: %.loc21: f64 = float_literal 80 [template = constants.%.18] -// CHECK:STDOUT: %.loc22: f64 = float_literal 1.0E+7 [template = constants.%.19] -// CHECK:STDOUT: %.loc23: f64 = float_literal 1.0E+8 [template = constants.%.20] -// CHECK:STDOUT: %.loc24: f64 = float_literal 1.0E-8 [template = constants.%.21] +// CHECK:STDOUT: %.loc19: f64 = float_literal 0.90000000000000002 [template = constants.%.17] +// CHECK:STDOUT: %.loc20: f64 = float_literal 8 [template = constants.%.18] +// CHECK:STDOUT: %.loc21: f64 = float_literal 80 [template = constants.%.19] +// CHECK:STDOUT: %.loc22: f64 = float_literal 1.0E+7 [template = constants.%.20] +// CHECK:STDOUT: %.loc23: f64 = float_literal 1.0E+8 [template = constants.%.21] +// CHECK:STDOUT: %.loc24: f64 = float_literal 1.0E-8 [template = constants.%.22] // CHECK:STDOUT: %.loc25_3.1: (f64, f64, f64, f64, f64, f64) = tuple_literal (%.loc19, %.loc20, %.loc21, %.loc22, %.loc23, %.loc24) -// CHECK:STDOUT: %.loc25_3.2: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc25_3.2: i32 = int_literal 0 [template = constants.%.9] // CHECK:STDOUT: %.loc25_3.3: ref f64 = array_index %floats.var, %.loc25_3.2 -// CHECK:STDOUT: %.loc25_3.4: init f64 = initialize_from %.loc19 to %.loc25_3.3 [template = constants.%.16] -// CHECK:STDOUT: %.loc25_3.5: i32 = int_literal 1 [template = constants.%.9] +// CHECK:STDOUT: %.loc25_3.4: init f64 = initialize_from %.loc19 to %.loc25_3.3 [template = constants.%.17] +// CHECK:STDOUT: %.loc25_3.5: i32 = int_literal 1 [template = constants.%.10] // CHECK:STDOUT: %.loc25_3.6: ref f64 = array_index %floats.var, %.loc25_3.5 -// CHECK:STDOUT: %.loc25_3.7: init f64 = initialize_from %.loc20 to %.loc25_3.6 [template = constants.%.17] -// CHECK:STDOUT: %.loc25_3.8: i32 = int_literal 2 [template = constants.%.10] +// CHECK:STDOUT: %.loc25_3.7: init f64 = initialize_from %.loc20 to %.loc25_3.6 [template = constants.%.18] +// CHECK:STDOUT: %.loc25_3.8: i32 = int_literal 2 [template = constants.%.11] // CHECK:STDOUT: %.loc25_3.9: ref f64 = array_index %floats.var, %.loc25_3.8 -// CHECK:STDOUT: %.loc25_3.10: init f64 = initialize_from %.loc21 to %.loc25_3.9 [template = constants.%.18] -// CHECK:STDOUT: %.loc25_3.11: i32 = int_literal 3 [template = constants.%.11] +// CHECK:STDOUT: %.loc25_3.10: init f64 = initialize_from %.loc21 to %.loc25_3.9 [template = constants.%.19] +// CHECK:STDOUT: %.loc25_3.11: i32 = int_literal 3 [template = constants.%.12] // CHECK:STDOUT: %.loc25_3.12: ref f64 = array_index %floats.var, %.loc25_3.11 -// CHECK:STDOUT: %.loc25_3.13: init f64 = initialize_from %.loc22 to %.loc25_3.12 [template = constants.%.19] -// CHECK:STDOUT: %.loc25_3.14: i32 = int_literal 4 [template = constants.%.12] +// CHECK:STDOUT: %.loc25_3.13: init f64 = initialize_from %.loc22 to %.loc25_3.12 [template = constants.%.20] +// CHECK:STDOUT: %.loc25_3.14: i32 = int_literal 4 [template = constants.%.13] // CHECK:STDOUT: %.loc25_3.15: ref f64 = array_index %floats.var, %.loc25_3.14 -// CHECK:STDOUT: %.loc25_3.16: init f64 = initialize_from %.loc23 to %.loc25_3.15 [template = constants.%.20] -// CHECK:STDOUT: %.loc25_3.17: i32 = int_literal 5 [template = constants.%.13] +// CHECK:STDOUT: %.loc25_3.16: init f64 = initialize_from %.loc23 to %.loc25_3.15 [template = constants.%.21] +// CHECK:STDOUT: %.loc25_3.17: i32 = int_literal 5 [template = constants.%.14] // CHECK:STDOUT: %.loc25_3.18: ref f64 = array_index %floats.var, %.loc25_3.17 -// CHECK:STDOUT: %.loc25_3.19: init f64 = initialize_from %.loc24 to %.loc25_3.18 [template = constants.%.21] +// CHECK:STDOUT: %.loc25_3.19: init f64 = initialize_from %.loc24 to %.loc25_3.18 [template = constants.%.22] // CHECK:STDOUT: %.loc25_3.20: init [f64; 6] = array_init (%.loc25_3.4, %.loc25_3.7, %.loc25_3.10, %.loc25_3.13, %.loc25_3.16, %.loc25_3.19) to %floats.var [template = constants.%array.2] // CHECK:STDOUT: %.loc25_4: init [f64; 6] = converted %.loc25_3.1, %.loc25_3.20 [template = constants.%array.2] // CHECK:STDOUT: assign %floats.var, %.loc25_4 diff --git a/toolchain/check/testdata/basics/run.carbon b/toolchain/check/testdata/basics/run.carbon index c24a606a63a6..651e05bb29de 100644 --- a/toolchain/check/testdata/basics/run.carbon +++ b/toolchain/check/testdata/basics/run.carbon @@ -8,13 +8,19 @@ fn Run() {} // CHECK:STDOUT: --- run.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Run = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct] {} // 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 b6ecf335226f..806bdc229582 100644 --- a/toolchain/check/testdata/basics/run_i32.carbon +++ b/toolchain/check/testdata/basics/run_i32.carbon @@ -9,23 +9,26 @@ fn Run() -> i32 { return 0; } // CHECK:STDOUT: --- run_i32.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Run = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] { +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct] { // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc7: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/bool/make_type.carbon b/toolchain/check/testdata/builtins/bool/make_type.carbon index 8b6e5aa69d39..bb81538ab524 100644 --- a/toolchain/check/testdata/builtins/bool/make_type.carbon +++ b/toolchain/check/testdata/builtins/bool/make_type.carbon @@ -20,13 +20,19 @@ var b: Bool() = false; // CHECK:STDOUT: --- types.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Bool = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Bool = %Bool +// CHECK:STDOUT: .Bool = %Bool.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Bool: = fn_decl @Bool [template] { +// CHECK:STDOUT: %Bool.decl: Bool = fn_decl @Bool [template = constants.%struct] { // CHECK:STDOUT: @Bool.%return: ref type = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -36,7 +42,10 @@ var b: Bool() = false; // CHECK:STDOUT: --- use_types.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal false [template] +// CHECK:STDOUT: %Bool: type = fn_type @Bool [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Bool = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal false [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -45,9 +54,9 @@ var b: Bool() = false; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+3, loc_11 [template = imports.%Bool] +// CHECK:STDOUT: %import_ref: Bool = import_ref ir1, inst+3, loc_11 [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Bool.ref: = name_ref Bool, %import_ref [template = imports.%Bool] +// CHECK:STDOUT: %Bool.ref: Bool = name_ref Bool, %import_ref [template = constants.%struct] // CHECK:STDOUT: %bool.make_type: init type = call %Bool.ref() [template = bool] // CHECK:STDOUT: %.loc6_13.1: type = value_of_initializer %bool.make_type [template = bool] // CHECK:STDOUT: %.loc6_13.2: type = converted %bool.make_type, %.loc6_13.1 [template = bool] @@ -59,7 +68,7 @@ var b: Bool() = false; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc6: bool = bool_literal false [template = constants.%.1] +// CHECK:STDOUT: %.loc6: bool = bool_literal false [template = constants.%.2] // CHECK:STDOUT: assign file.%b.var, %.loc6 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/float/add.carbon b/toolchain/check/testdata/builtins/float/add.carbon index 774fe16c7517..cd813e5bf9a6 100644 --- a/toolchain/check/testdata/builtins/float/add.carbon +++ b/toolchain/check/testdata/builtins/float/add.carbon @@ -49,27 +49,32 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_add.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: f64 = float_literal 2.2000000000000002 [template] -// CHECK:STDOUT: %.2: f64 = float_literal 2.3000000000000003 [template] -// CHECK:STDOUT: %.3: f64 = float_literal 4.5 [template] +// CHECK:STDOUT: %Add: type = fn_type @Add [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Add = struct_value () [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %.2: f64 = float_literal 2.2000000000000002 [template] +// CHECK:STDOUT: %.3: f64 = float_literal 2.3000000000000003 [template] +// CHECK:STDOUT: %.4: f64 = float_literal 4.5 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Add = %Add -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .Add = %Add.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Add: = fn_decl @Add [template] { +// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: f64 = param a // CHECK:STDOUT: @Add.%a: f64 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: f64 = param b // CHECK:STDOUT: @Add.%b: f64 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Add.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc4_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc4_16.1 // CHECK:STDOUT: %b.loc4_24.1: f64 = param b @@ -84,7 +89,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Add.ref: = name_ref Add, file.%Add [template = file.%Add] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, file.%Add.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.add: init f64 = call %Add.ref(%a.ref, %b.ref) @@ -95,34 +100,52 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Add.ref: = name_ref Add, file.%Add [template = file.%Add] -// CHECK:STDOUT: %.loc8_18: f64 = float_literal 2.2000000000000002 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_23: f64 = float_literal 2.3000000000000003 [template = constants.%.2] -// CHECK:STDOUT: %float.add: init f64 = call %Add.ref(%.loc8_18, %.loc8_23) [template = constants.%.3] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, file.%Add.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc8_18: f64 = float_literal 2.2000000000000002 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_23: f64 = float_literal 2.3000000000000003 [template = constants.%.3] +// CHECK:STDOUT: %float.add: init f64 = call %Add.ref(%.loc8_18, %.loc8_23) [template = constants.%.4] // CHECK:STDOUT: assign file.%x.var, %float.add // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] +// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] +// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] +// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] +// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] +// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] +// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .TooFew = %TooFew -// CHECK:STDOUT: .TooMany = %TooMany -// CHECK:STDOUT: .BadReturnType = %BadReturnType -// CHECK:STDOUT: .JustRight = %JustRight -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType +// CHECK:STDOUT: .TooFew = %TooFew.decl +// CHECK:STDOUT: .TooMany = %TooMany.decl +// CHECK:STDOUT: .BadReturnType = %BadReturnType.decl +// CHECK:STDOUT: .JustRight = %JustRight.decl +// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl +// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl +// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew: = fn_decl @TooFew [template] { +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc8_11.1: f64 = param a // CHECK:STDOUT: @TooFew.%a: f64 = bind_name a, %a.loc8_11.1 // CHECK:STDOUT: @TooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany: = fn_decl @TooMany [template] { +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc13_12.1: f64 = param a // CHECK:STDOUT: @TooMany.%a: f64 = bind_name a, %a.loc13_12.1 // CHECK:STDOUT: %b.loc13_20.1: f64 = param b @@ -131,26 +154,26 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: @TooMany.%c: f64 = bind_name c, %c.loc13_28.1 // CHECK:STDOUT: @TooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType: = fn_decl @BadReturnType [template] { +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc17_18.1: f64 = param a // CHECK:STDOUT: @BadReturnType.%a: f64 = bind_name a, %a.loc17_18.1 // CHECK:STDOUT: %b.loc17_26.1: f64 = param b // CHECK:STDOUT: @BadReturnType.%b: f64 = bind_name b, %b.loc17_26.1 // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight: = fn_decl @JustRight [template] { +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc18_14.1: f64 = param a // CHECK:STDOUT: @JustRight.%a: f64 = bind_name a, %a.loc18_14.1 // CHECK:STDOUT: %b.loc18_22.1: f64 = param b // CHECK:STDOUT: @JustRight.%b: f64 = bind_name b, %b.loc18_22.1 // CHECK:STDOUT: @JustRight.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew: = fn_decl @RuntimeCallTooFew [template] { +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { // CHECK:STDOUT: %a.loc20_22.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: f64 = bind_name a, %a.loc20_22.1 // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany: = fn_decl @RuntimeCallTooMany [template] { +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { // CHECK:STDOUT: %a.loc24_23.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: f64 = bind_name a, %a.loc24_23.1 // CHECK:STDOUT: %b.loc24_31.1: f64 = param b @@ -159,7 +182,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: @RuntimeCallTooMany.%c: f64 = bind_name c, %c.loc24_39.1 // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType: = fn_decl @RuntimeCallBadReturnType [template] { +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { // CHECK:STDOUT: %a.loc28_29.1: f64 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: f64 = bind_name a, %a.loc28_29.1 // CHECK:STDOUT: %b.loc28_37.1: f64 = param b @@ -178,7 +201,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init f64 = call %TooFew.ref(%a.ref) // CHECK:STDOUT: %.loc21_19.1: f64 = value_of_initializer %TooFew.call @@ -188,7 +211,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: f64, %b: f64, %c: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, file.%TooMany [template = file.%TooMany] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %c.ref: f64 = name_ref c, %c @@ -200,7 +223,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/div.carbon b/toolchain/check/testdata/builtins/float/div.carbon index 8baed86973ab..eac8396a7774 100644 --- a/toolchain/check/testdata/builtins/float/div.carbon +++ b/toolchain/check/testdata/builtins/float/div.carbon @@ -51,33 +51,38 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_div.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: f64 = float_literal 10 [template] -// CHECK:STDOUT: %.2: f64 = float_literal 2.5 [template] -// CHECK:STDOUT: %.3: f64 = float_literal 4 [template] -// CHECK:STDOUT: %.4: f64 = float_literal 1 [template] -// CHECK:STDOUT: %.5: f64 = float_literal 0 [template] -// CHECK:STDOUT: %.6: f64 = float_literal +Inf [template] -// CHECK:STDOUT: %.7: f64 = float_literal 0 [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Div = struct_value () [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %.2: f64 = float_literal 10 [template] +// CHECK:STDOUT: %.3: f64 = float_literal 2.5 [template] +// CHECK:STDOUT: %.4: f64 = float_literal 4 [template] +// CHECK:STDOUT: %.5: f64 = float_literal 1 [template] +// CHECK:STDOUT: %.6: f64 = float_literal 0 [template] +// CHECK:STDOUT: %.7: f64 = float_literal +Inf [template] // CHECK:STDOUT: %.8: f64 = float_literal 0 [template] -// CHECK:STDOUT: %.9: f64 = float_literal NaN [template] +// CHECK:STDOUT: %.9: f64 = float_literal 0 [template] +// CHECK:STDOUT: %.10: f64 = float_literal NaN [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Div = %Div -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .Div = %Div.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: .a = %a.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div: = fn_decl @Div [template] { +// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: f64 = param a // CHECK:STDOUT: @Div.%a: f64 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: f64 = param b // CHECK:STDOUT: @Div.%b: f64 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Div.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc4_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc4_16.1 // CHECK:STDOUT: %b.loc4_24.1: f64 = param b @@ -86,19 +91,19 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: %a.var: ref f64 = var a // CHECK:STDOUT: %a.loc8: ref f64 = bind_name a, %a.var -// CHECK:STDOUT: %Div.ref.loc9: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %.loc9_18: f64 = float_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_23: f64 = float_literal 0 [template = constants.%.5] -// CHECK:STDOUT: %float.div.loc9: init f64 = call %Div.ref.loc9(%.loc9_18, %.loc9_23) [template = constants.%.6] -// CHECK:STDOUT: %.loc9_27.1: f64 = value_of_initializer %float.div.loc9 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_27.2: f64 = converted %float.div.loc9, %.loc9_27.1 [template = constants.%.6] +// CHECK:STDOUT: %Div.ref.loc9: Div = name_ref Div, %Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc9_18: f64 = float_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_23: f64 = float_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %float.div.loc9: init f64 = call %Div.ref.loc9(%.loc9_18, %.loc9_23) [template = constants.%.7] +// CHECK:STDOUT: %.loc9_27.1: f64 = value_of_initializer %float.div.loc9 [template = constants.%.7] +// CHECK:STDOUT: %.loc9_27.2: f64 = converted %float.div.loc9, %.loc9_27.1 [template = constants.%.7] // CHECK:STDOUT: %b.loc9: f64 = bind_name b, %.loc9_27.2 -// CHECK:STDOUT: %Div.ref.loc10: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %.loc10_18: f64 = float_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc10_23: f64 = float_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %float.div.loc10: init f64 = call %Div.ref.loc10(%.loc10_18, %.loc10_23) [template = constants.%.9] -// CHECK:STDOUT: %.loc10_27.1: f64 = value_of_initializer %float.div.loc10 [template = constants.%.9] -// CHECK:STDOUT: %.loc10_27.2: f64 = converted %float.div.loc10, %.loc10_27.1 [template = constants.%.9] +// CHECK:STDOUT: %Div.ref.loc10: Div = name_ref Div, %Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc10_18: f64 = float_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc10_23: f64 = float_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %float.div.loc10: init f64 = call %Div.ref.loc10(%.loc10_18, %.loc10_23) [template = constants.%.10] +// CHECK:STDOUT: %.loc10_27.1: f64 = value_of_initializer %float.div.loc10 [template = constants.%.10] +// CHECK:STDOUT: %.loc10_27.2: f64 = converted %float.div.loc10, %.loc10_27.1 [template = constants.%.10] // CHECK:STDOUT: %c: f64 = bind_name c, %.loc10_27.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -106,7 +111,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref: = name_ref Div, file.%Div [template = file.%Div] +// CHECK:STDOUT: %Div.ref: Div = name_ref Div, file.%Div.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.div: init f64 = call %Div.ref(%a.ref, %b.ref) @@ -117,34 +122,52 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref: = name_ref Div, file.%Div [template = file.%Div] -// CHECK:STDOUT: %.loc8_18: f64 = float_literal 10 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_24: f64 = float_literal 2.5 [template = constants.%.2] -// CHECK:STDOUT: %float.div: init f64 = call %Div.ref(%.loc8_18, %.loc8_24) [template = constants.%.3] +// CHECK:STDOUT: %Div.ref: Div = name_ref Div, file.%Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc8_18: f64 = float_literal 10 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_24: f64 = float_literal 2.5 [template = constants.%.3] +// CHECK:STDOUT: %float.div: init f64 = call %Div.ref(%.loc8_18, %.loc8_24) [template = constants.%.4] // CHECK:STDOUT: assign file.%a.var, %float.div // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] +// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] +// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] +// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] +// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] +// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] +// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .TooFew = %TooFew -// CHECK:STDOUT: .TooMany = %TooMany -// CHECK:STDOUT: .BadReturnType = %BadReturnType -// CHECK:STDOUT: .JustRight = %JustRight -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType +// CHECK:STDOUT: .TooFew = %TooFew.decl +// CHECK:STDOUT: .TooMany = %TooMany.decl +// CHECK:STDOUT: .BadReturnType = %BadReturnType.decl +// CHECK:STDOUT: .JustRight = %JustRight.decl +// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl +// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl +// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew: = fn_decl @TooFew [template] { +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc8_11.1: f64 = param a // CHECK:STDOUT: @TooFew.%a: f64 = bind_name a, %a.loc8_11.1 // CHECK:STDOUT: @TooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany: = fn_decl @TooMany [template] { +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc13_12.1: f64 = param a // CHECK:STDOUT: @TooMany.%a: f64 = bind_name a, %a.loc13_12.1 // CHECK:STDOUT: %b.loc13_20.1: f64 = param b @@ -153,26 +176,26 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: @TooMany.%c: f64 = bind_name c, %c.loc13_28.1 // CHECK:STDOUT: @TooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType: = fn_decl @BadReturnType [template] { +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc17_18.1: f64 = param a // CHECK:STDOUT: @BadReturnType.%a: f64 = bind_name a, %a.loc17_18.1 // CHECK:STDOUT: %b.loc17_26.1: f64 = param b // CHECK:STDOUT: @BadReturnType.%b: f64 = bind_name b, %b.loc17_26.1 // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight: = fn_decl @JustRight [template] { +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc18_14.1: f64 = param a // CHECK:STDOUT: @JustRight.%a: f64 = bind_name a, %a.loc18_14.1 // CHECK:STDOUT: %b.loc18_22.1: f64 = param b // CHECK:STDOUT: @JustRight.%b: f64 = bind_name b, %b.loc18_22.1 // CHECK:STDOUT: @JustRight.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew: = fn_decl @RuntimeCallTooFew [template] { +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { // CHECK:STDOUT: %a.loc20_22.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: f64 = bind_name a, %a.loc20_22.1 // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany: = fn_decl @RuntimeCallTooMany [template] { +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { // CHECK:STDOUT: %a.loc24_23.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: f64 = bind_name a, %a.loc24_23.1 // CHECK:STDOUT: %b.loc24_31.1: f64 = param b @@ -181,7 +204,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: @RuntimeCallTooMany.%c: f64 = bind_name c, %c.loc24_39.1 // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType: = fn_decl @RuntimeCallBadReturnType [template] { +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { // CHECK:STDOUT: %a.loc28_29.1: f64 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: f64 = bind_name a, %a.loc28_29.1 // CHECK:STDOUT: %b.loc28_37.1: f64 = param b @@ -200,7 +223,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init f64 = call %TooFew.ref(%a.ref) // CHECK:STDOUT: %.loc21_19.1: f64 = value_of_initializer %TooFew.call @@ -210,7 +233,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: f64, %b: f64, %c: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, file.%TooMany [template = file.%TooMany] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %c.ref: f64 = name_ref c, %c @@ -222,7 +245,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/eq.carbon b/toolchain/check/testdata/builtins/float/eq.carbon index 06fa1f5b677c..2ce6e9d20ab5 100644 --- a/toolchain/check/testdata/builtins/float/eq.carbon +++ b/toolchain/check/testdata/builtins/float/eq.carbon @@ -32,10 +32,14 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: --- float_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Eq: type = fn_type @Eq [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Eq = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: f64 = float_literal 1 [template] // CHECK:STDOUT: %.5: f64 = float_literal 1 [template] @@ -43,19 +47,21 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: %.7: f64 = float_literal 1 [template] // CHECK:STDOUT: %.8: f64 = float_literal 2 [template] // CHECK:STDOUT: %.9: bool = bool_literal false [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Eq = %Eq +// CHECK:STDOUT: .Eq = %Eq.decl // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Eq: = fn_decl @Eq [template] { +// CHECK:STDOUT: %Eq.decl: Eq = fn_decl @Eq [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_7.1: f64 = param a // CHECK:STDOUT: @Eq.%a: f64 = bind_name a, %a.loc2_7.1 // CHECK:STDOUT: %b.loc2_15.1: f64 = param b @@ -64,7 +70,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc7_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc7_6.1 @@ -72,7 +78,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: %false_.loc7_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc7_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc12_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc12_16.1 // CHECK:STDOUT: %b.loc12_24.1: f64 = param b @@ -96,7 +102,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref: True = name_ref true_, %true_ -// CHECK:STDOUT: %Eq.ref.loc8: = name_ref Eq, file.%Eq [template = file.%Eq] +// CHECK:STDOUT: %Eq.ref.loc8: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc8_19: f64 = float_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc8_24: f64 = float_literal 1 [template = constants.%.5] // CHECK:STDOUT: %float.eq.loc8: init bool = call %Eq.ref.loc8(%.loc8_19, %.loc8_24) [template = constants.%.6] @@ -115,7 +121,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: !if.expr.result.loc8: // CHECK:STDOUT: %.loc8_13.3: type = block_arg !if.expr.result.loc8 [template = constants.%True] // CHECK:STDOUT: %false_.ref: False = name_ref false_, %false_ -// CHECK:STDOUT: %Eq.ref.loc9: = name_ref Eq, file.%Eq [template = file.%Eq] +// CHECK:STDOUT: %Eq.ref.loc9: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9_20: f64 = float_literal 1 [template = constants.%.7] // CHECK:STDOUT: %.loc9_25: f64 = float_literal 2 [template = constants.%.8] // CHECK:STDOUT: %float.eq.loc9: init bool = call %Eq.ref.loc9(%.loc9_20, %.loc9_25) [template = constants.%.9] @@ -138,7 +144,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Eq.ref: = name_ref Eq, file.%Eq [template = file.%Eq] +// CHECK:STDOUT: %Eq.ref: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.eq: init bool = call %Eq.ref(%a.ref, %b.ref) @@ -149,13 +155,19 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; // CHECK:STDOUT: // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %WrongResult: type = fn_type @WrongResult [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: WrongResult = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .WrongResult = %WrongResult +// CHECK:STDOUT: .WrongResult = %WrongResult.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %WrongResult: = fn_decl @WrongResult [template] { +// CHECK:STDOUT: %WrongResult.decl: WrongResult = fn_decl @WrongResult [template = constants.%struct] { // CHECK:STDOUT: %a.loc7_16.1: f64 = param a // CHECK:STDOUT: @WrongResult.%a: f64 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: f64 = param b diff --git a/toolchain/check/testdata/builtins/float/greater.carbon b/toolchain/check/testdata/builtins/float/greater.carbon index 3938c5b26ec5..4b55812ba79f 100644 --- a/toolchain/check/testdata/builtins/float/greater.carbon +++ b/toolchain/check/testdata/builtins/float/greater.carbon @@ -27,10 +27,16 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_greater.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Greater: type = fn_type @Greater [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Greater = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: f64 = float_literal 1 [template] // CHECK:STDOUT: %.5: f64 = float_literal 2 [template] @@ -46,34 +52,36 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %.15: f64 = float_literal 0 [template] // CHECK:STDOUT: %.16: f64 = float_literal 1 [template] // CHECK:STDOUT: %.17: f64 = float_literal -1 [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Greater = %Greater -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Greater = %Greater.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Greater: = fn_decl @Greater [template] { +// CHECK:STDOUT: %Greater.decl: Greater = fn_decl @Greater [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_12.1: f64 = param a // CHECK:STDOUT: @Greater.%a: f64 = bind_name a, %a.loc2_12.1 // CHECK:STDOUT: %b.loc2_20.1: f64 = param b // CHECK:STDOUT: @Greater.%b: f64 = bind_name b, %b.loc2_20.1 // CHECK:STDOUT: @Greater.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc3_11.1: f64 = param a // CHECK:STDOUT: @Negate.%a: f64 = bind_name a, %a.loc3_11.1 // CHECK:STDOUT: @Negate.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -81,7 +89,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc16_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc16_16.1 // CHECK:STDOUT: %b.loc16_24.1: f64 = param b @@ -107,7 +115,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref.loc9: False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc9: = name_ref Greater, file.%Greater [template = file.%Greater] +// CHECK:STDOUT: %Greater.ref.loc9: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9_25: f64 = float_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_30: f64 = float_literal 2 [template = constants.%.5] // CHECK:STDOUT: %float.greater.loc9: init bool = call %Greater.ref.loc9(%.loc9_25, %.loc9_30) [template = constants.%.6] @@ -126,7 +134,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] // CHECK:STDOUT: %false_.ref.loc10: False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc10: = name_ref Greater, file.%Greater [template = file.%Greater] +// CHECK:STDOUT: %Greater.ref.loc10: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_25: f64 = float_literal 1 [template = constants.%.7] // CHECK:STDOUT: %.loc10_30: f64 = float_literal 1 [template = constants.%.8] // CHECK:STDOUT: %float.greater.loc10: init bool = call %Greater.ref.loc10(%.loc10_25, %.loc10_30) [template = constants.%.6] @@ -145,7 +153,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_14.3: type = block_arg !if.expr.result.loc10 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc11: True = name_ref true_, %true_ -// CHECK:STDOUT: %Greater.ref.loc11: = name_ref Greater, file.%Greater [template = file.%Greater] +// CHECK:STDOUT: %Greater.ref.loc11: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc11_24: f64 = float_literal 1 [template = constants.%.9] // CHECK:STDOUT: %.loc11_29: f64 = float_literal 0 [template = constants.%.10] // CHECK:STDOUT: %float.greater.loc11: init bool = call %Greater.ref.loc11(%.loc11_24, %.loc11_29) [template = constants.%.11] @@ -164,8 +172,8 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_13.3: type = block_arg !if.expr.result.loc11 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc12: False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc12: = name_ref Greater, file.%Greater [template = file.%Greater] -// CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Greater.ref.loc12: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_32: f64 = float_literal 1 [template = constants.%.12] // CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%.loc12_32) [template = constants.%.13] // CHECK:STDOUT: %.loc12_38: f64 = float_literal 0 [template = constants.%.14] @@ -187,9 +195,9 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc13: True = name_ref true_, %true_ -// CHECK:STDOUT: %Greater.ref.loc13: = name_ref Greater, file.%Greater [template = file.%Greater] +// CHECK:STDOUT: %Greater.ref.loc13: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc13_24: f64 = float_literal 0 [template = constants.%.15] -// CHECK:STDOUT: %Negate.ref.loc13: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_36: f64 = float_literal 1 [template = constants.%.16] // CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%.loc13_36) [template = constants.%.17] // CHECK:STDOUT: %.loc13_23.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%.17] @@ -214,7 +222,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Greater.ref: = name_ref Greater, file.%Greater [template = file.%Greater] +// CHECK:STDOUT: %Greater.ref: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.greater: init bool = call %Greater.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/greater_eq.carbon b/toolchain/check/testdata/builtins/float/greater_eq.carbon index 1817a887ead4..aef2f347af8e 100644 --- a/toolchain/check/testdata/builtins/float/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/float/greater_eq.carbon @@ -27,10 +27,16 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_greater_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %GreaterEq: type = fn_type @GreaterEq [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: GreaterEq = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: f64 = float_literal 1 [template] // CHECK:STDOUT: %.5: f64 = float_literal 2 [template] @@ -46,34 +52,36 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %.15: f64 = float_literal 0 [template] // CHECK:STDOUT: %.16: f64 = float_literal 1 [template] // CHECK:STDOUT: %.17: f64 = float_literal -1 [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .GreaterEq = %GreaterEq -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .GreaterEq = %GreaterEq.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %GreaterEq: = fn_decl @GreaterEq [template] { +// CHECK:STDOUT: %GreaterEq.decl: GreaterEq = fn_decl @GreaterEq [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_14.1: f64 = param a // CHECK:STDOUT: @GreaterEq.%a: f64 = bind_name a, %a.loc2_14.1 // CHECK:STDOUT: %b.loc2_22.1: f64 = param b // CHECK:STDOUT: @GreaterEq.%b: f64 = bind_name b, %b.loc2_22.1 // CHECK:STDOUT: @GreaterEq.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc3_11.1: f64 = param a // CHECK:STDOUT: @Negate.%a: f64 = bind_name a, %a.loc3_11.1 // CHECK:STDOUT: @Negate.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -81,7 +89,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc16_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc16_16.1 // CHECK:STDOUT: %b.loc16_24.1: f64 = param b @@ -107,7 +115,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref.loc9: False = name_ref false_, %false_ -// CHECK:STDOUT: %GreaterEq.ref.loc9: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] +// CHECK:STDOUT: %GreaterEq.ref.loc9: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9_27: f64 = float_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_32: f64 = float_literal 2 [template = constants.%.5] // CHECK:STDOUT: %float.greater_eq.loc9: init bool = call %GreaterEq.ref.loc9(%.loc9_27, %.loc9_32) [template = constants.%.6] @@ -126,7 +134,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc10: True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc10: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] +// CHECK:STDOUT: %GreaterEq.ref.loc10: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_26: f64 = float_literal 1 [template = constants.%.7] // CHECK:STDOUT: %.loc10_31: f64 = float_literal 1 [template = constants.%.8] // CHECK:STDOUT: %float.greater_eq.loc10: init bool = call %GreaterEq.ref.loc10(%.loc10_26, %.loc10_31) [template = constants.%.9] @@ -145,7 +153,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] // CHECK:STDOUT: %true_.ref.loc11: True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc11: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] +// CHECK:STDOUT: %GreaterEq.ref.loc11: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc11_26: f64 = float_literal 1 [template = constants.%.10] // CHECK:STDOUT: %.loc11_31: f64 = float_literal 0 [template = constants.%.11] // CHECK:STDOUT: %float.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%.loc11_26, %.loc11_31) [template = constants.%.9] @@ -164,8 +172,8 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_13.3: type = block_arg !if.expr.result.loc11 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc12: False = name_ref false_, %false_ -// CHECK:STDOUT: %GreaterEq.ref.loc12: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] -// CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %GreaterEq.ref.loc12: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_34: f64 = float_literal 1 [template = constants.%.12] // CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%.loc12_34) [template = constants.%.13] // CHECK:STDOUT: %.loc12_40: f64 = float_literal 0 [template = constants.%.14] @@ -187,9 +195,9 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc13: True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc13: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] +// CHECK:STDOUT: %GreaterEq.ref.loc13: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc13_26: f64 = float_literal 0 [template = constants.%.15] -// CHECK:STDOUT: %Negate.ref.loc13: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_38: f64 = float_literal 1 [template = constants.%.16] // CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%.loc13_38) [template = constants.%.17] // CHECK:STDOUT: %.loc13_25.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%.17] @@ -214,7 +222,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %GreaterEq.ref: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] +// CHECK:STDOUT: %GreaterEq.ref: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.greater_eq: init bool = call %GreaterEq.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/less.carbon b/toolchain/check/testdata/builtins/float/less.carbon index 14d6e2b8a38e..e33309b0beed 100644 --- a/toolchain/check/testdata/builtins/float/less.carbon +++ b/toolchain/check/testdata/builtins/float/less.carbon @@ -27,10 +27,16 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_less.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Less: type = fn_type @Less [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Less = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: f64 = float_literal 1 [template] // CHECK:STDOUT: %.5: f64 = float_literal 2 [template] @@ -46,34 +52,36 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %.15: f64 = float_literal 0 [template] // CHECK:STDOUT: %.16: f64 = float_literal 1 [template] // CHECK:STDOUT: %.17: f64 = float_literal -1 [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Less = %Less -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Less = %Less.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Less: = fn_decl @Less [template] { +// CHECK:STDOUT: %Less.decl: Less = fn_decl @Less [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_9.1: f64 = param a // CHECK:STDOUT: @Less.%a: f64 = bind_name a, %a.loc2_9.1 // CHECK:STDOUT: %b.loc2_17.1: f64 = param b // CHECK:STDOUT: @Less.%b: f64 = bind_name b, %b.loc2_17.1 // CHECK:STDOUT: @Less.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc3_11.1: f64 = param a // CHECK:STDOUT: @Negate.%a: f64 = bind_name a, %a.loc3_11.1 // CHECK:STDOUT: @Negate.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -81,7 +89,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc16_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc16_16.1 // CHECK:STDOUT: %b.loc16_24.1: f64 = param b @@ -107,7 +115,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref.loc9: True = name_ref true_, %true_ -// CHECK:STDOUT: %Less.ref.loc9: = name_ref Less, file.%Less [template = file.%Less] +// CHECK:STDOUT: %Less.ref.loc9: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9_21: f64 = float_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_26: f64 = float_literal 2 [template = constants.%.5] // CHECK:STDOUT: %float.less.loc9: init bool = call %Less.ref.loc9(%.loc9_21, %.loc9_26) [template = constants.%.6] @@ -126,7 +134,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc10: False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc10: = name_ref Less, file.%Less [template = file.%Less] +// CHECK:STDOUT: %Less.ref.loc10: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_22: f64 = float_literal 1 [template = constants.%.7] // CHECK:STDOUT: %.loc10_27: f64 = float_literal 1 [template = constants.%.8] // CHECK:STDOUT: %float.less.loc10: init bool = call %Less.ref.loc10(%.loc10_22, %.loc10_27) [template = constants.%.9] @@ -145,7 +153,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_14.3: type = block_arg !if.expr.result.loc10 [template = constants.%False] // CHECK:STDOUT: %false_.ref.loc11: False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc11: = name_ref Less, file.%Less [template = file.%Less] +// CHECK:STDOUT: %Less.ref.loc11: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc11_22: f64 = float_literal 1 [template = constants.%.10] // CHECK:STDOUT: %.loc11_27: f64 = float_literal 0 [template = constants.%.11] // CHECK:STDOUT: %float.less.loc11: init bool = call %Less.ref.loc11(%.loc11_22, %.loc11_27) [template = constants.%.9] @@ -164,8 +172,8 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc12: True = name_ref true_, %true_ -// CHECK:STDOUT: %Less.ref.loc12: = name_ref Less, file.%Less [template = file.%Less] -// CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Less.ref.loc12: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_28: f64 = float_literal 1 [template = constants.%.12] // CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%.loc12_28) [template = constants.%.13] // CHECK:STDOUT: %.loc12_34: f64 = float_literal 0 [template = constants.%.14] @@ -187,9 +195,9 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc13: False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc13: = name_ref Less, file.%Less [template = file.%Less] +// CHECK:STDOUT: %Less.ref.loc13: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc13_22: f64 = float_literal 0 [template = constants.%.15] -// CHECK:STDOUT: %Negate.ref.loc13: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_34: f64 = float_literal 1 [template = constants.%.16] // CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%.loc13_34) [template = constants.%.17] // CHECK:STDOUT: %.loc13_21.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%.17] @@ -214,7 +222,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Less.ref: = name_ref Less, file.%Less [template = file.%Less] +// CHECK:STDOUT: %Less.ref: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.less: init bool = call %Less.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/less_eq.carbon b/toolchain/check/testdata/builtins/float/less_eq.carbon index d270f85497b9..5f0d9ac1d9d9 100644 --- a/toolchain/check/testdata/builtins/float/less_eq.carbon +++ b/toolchain/check/testdata/builtins/float/less_eq.carbon @@ -27,10 +27,16 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_less_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %LessEq: type = fn_type @LessEq [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: LessEq = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: f64 = float_literal 1 [template] // CHECK:STDOUT: %.5: f64 = float_literal 2 [template] @@ -46,34 +52,36 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %.15: f64 = float_literal 0 [template] // CHECK:STDOUT: %.16: f64 = float_literal 1 [template] // CHECK:STDOUT: %.17: f64 = float_literal -1 [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .LessEq = %LessEq -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .LessEq = %LessEq.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %LessEq: = fn_decl @LessEq [template] { +// CHECK:STDOUT: %LessEq.decl: LessEq = fn_decl @LessEq [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_11.1: f64 = param a // CHECK:STDOUT: @LessEq.%a: f64 = bind_name a, %a.loc2_11.1 // CHECK:STDOUT: %b.loc2_19.1: f64 = param b // CHECK:STDOUT: @LessEq.%b: f64 = bind_name b, %b.loc2_19.1 // CHECK:STDOUT: @LessEq.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc3_11.1: f64 = param a // CHECK:STDOUT: @Negate.%a: f64 = bind_name a, %a.loc3_11.1 // CHECK:STDOUT: @Negate.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -81,7 +89,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc16_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc16_16.1 // CHECK:STDOUT: %b.loc16_24.1: f64 = param b @@ -107,7 +115,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref.loc9: True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc9: = name_ref LessEq, file.%LessEq [template = file.%LessEq] +// CHECK:STDOUT: %LessEq.ref.loc9: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9_23: f64 = float_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_28: f64 = float_literal 2 [template = constants.%.5] // CHECK:STDOUT: %float.less_eq.loc9: init bool = call %LessEq.ref.loc9(%.loc9_23, %.loc9_28) [template = constants.%.6] @@ -126,7 +134,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] // CHECK:STDOUT: %true_.ref.loc10: True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc10: = name_ref LessEq, file.%LessEq [template = file.%LessEq] +// CHECK:STDOUT: %LessEq.ref.loc10: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_23: f64 = float_literal 1 [template = constants.%.7] // CHECK:STDOUT: %.loc10_28: f64 = float_literal 1 [template = constants.%.8] // CHECK:STDOUT: %float.less_eq.loc10: init bool = call %LessEq.ref.loc10(%.loc10_23, %.loc10_28) [template = constants.%.6] @@ -145,7 +153,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc11: False = name_ref false_, %false_ -// CHECK:STDOUT: %LessEq.ref.loc11: = name_ref LessEq, file.%LessEq [template = file.%LessEq] +// CHECK:STDOUT: %LessEq.ref.loc11: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc11_24: f64 = float_literal 1 [template = constants.%.9] // CHECK:STDOUT: %.loc11_29: f64 = float_literal 0 [template = constants.%.10] // CHECK:STDOUT: %float.less_eq.loc11: init bool = call %LessEq.ref.loc11(%.loc11_24, %.loc11_29) [template = constants.%.11] @@ -164,8 +172,8 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc12: True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc12: = name_ref LessEq, file.%LessEq [template = file.%LessEq] -// CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %LessEq.ref.loc12: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_30: f64 = float_literal 1 [template = constants.%.12] // CHECK:STDOUT: %float.negate.loc12: init f64 = call %Negate.ref.loc12(%.loc12_30) [template = constants.%.13] // CHECK:STDOUT: %.loc12_36: f64 = float_literal 0 [template = constants.%.14] @@ -187,9 +195,9 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc13: False = name_ref false_, %false_ -// CHECK:STDOUT: %LessEq.ref.loc13: = name_ref LessEq, file.%LessEq [template = file.%LessEq] +// CHECK:STDOUT: %LessEq.ref.loc13: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc13_24: f64 = float_literal 0 [template = constants.%.15] -// CHECK:STDOUT: %Negate.ref.loc13: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_36: f64 = float_literal 1 [template = constants.%.16] // CHECK:STDOUT: %float.negate.loc13: init f64 = call %Negate.ref.loc13(%.loc13_36) [template = constants.%.17] // CHECK:STDOUT: %.loc13_23.1: f64 = value_of_initializer %float.negate.loc13 [template = constants.%.17] @@ -214,7 +222,7 @@ fn RuntimeCall(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %LessEq.ref: = name_ref LessEq, file.%LessEq [template = file.%LessEq] +// CHECK:STDOUT: %LessEq.ref: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.less_eq: init bool = call %LessEq.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/make_type.carbon b/toolchain/check/testdata/builtins/float/make_type.carbon index 81c1e2f5b075..39137679c465 100644 --- a/toolchain/check/testdata/builtins/float/make_type.carbon +++ b/toolchain/check/testdata/builtins/float/make_type.carbon @@ -42,13 +42,19 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: --- types.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Float = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Float = %Float +// CHECK:STDOUT: .Float = %Float.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Float: = fn_decl @Float [template] { +// CHECK:STDOUT: %Float.decl: Float = fn_decl @Float [template = constants.%struct] { // CHECK:STDOUT: %size.loc4_10.1: i32 = param size // CHECK:STDOUT: @Float.%size: i32 = bind_name size, %size.loc4_10.1 // CHECK:STDOUT: @Float.%return: ref type = var @@ -60,8 +66,13 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: --- use_types.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] -// CHECK:STDOUT: %.2: f64 = float_literal 0 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Float = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 64 [template] +// CHECK:STDOUT: %.3: f64 = float_literal 0 [template] +// CHECK:STDOUT: %GetFloat: type = fn_type @GetFloat [template] +// CHECK:STDOUT: %struct.2: GetFloat = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -69,18 +80,18 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: .Float = %import_ref // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .f = %f -// CHECK:STDOUT: .GetFloat = %GetFloat +// CHECK:STDOUT: .GetFloat = %GetFloat.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+5, loc_11 [template = imports.%Float] +// CHECK:STDOUT: %import_ref: Float = import_ref ir1, inst+5, loc_11 [template = constants.%struct.1] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Float.ref: = name_ref Float, %import_ref [template = imports.%Float] -// CHECK:STDOUT: %.loc6_14: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %Float.ref: Float = name_ref Float, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %.loc6_14: i32 = int_literal 64 [template = constants.%.2] // CHECK:STDOUT: %float.make_type: init type = call %Float.ref(%.loc6_14) [template = f64] // CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %float.make_type [template = f64] // CHECK:STDOUT: %.loc6_16.2: type = converted %float.make_type, %.loc6_16.1 [template = f64] // CHECK:STDOUT: %f.var: ref f64 = var f // CHECK:STDOUT: %f: ref f64 = bind_name f, %f.var -// CHECK:STDOUT: %GetFloat: = fn_decl @GetFloat [template] { +// CHECK:STDOUT: %GetFloat.decl: GetFloat = fn_decl @GetFloat [template = constants.%struct.2] { // CHECK:STDOUT: %dyn_size.loc8_13.1: i32 = param dyn_size // CHECK:STDOUT: @GetFloat.%dyn_size: i32 = bind_name dyn_size, %dyn_size.loc8_13.1 // CHECK:STDOUT: @GetFloat.%return: ref type = var @@ -91,7 +102,7 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: // CHECK:STDOUT: fn @GetFloat(%dyn_size: i32) -> type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Float.ref: = name_ref Float, file.%import_ref [template = imports.%Float] +// CHECK:STDOUT: %Float.ref: Float = name_ref Float, file.%import_ref [template = constants.%struct.1] // CHECK:STDOUT: %dyn_size.ref: i32 = name_ref dyn_size, %dyn_size // CHECK:STDOUT: %float.make_type: init type = call %Float.ref(%dyn_size.ref) // CHECK:STDOUT: %.loc9_25.1: type = value_of_initializer %float.make_type @@ -101,7 +112,7 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc6: f64 = float_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc6: f64 = float_literal 0 [template = constants.%.3] // CHECK:STDOUT: assign file.%f.var, %.loc6 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -109,8 +120,11 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: --- fail_invalid_size.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 32 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 64 [template] +// CHECK:STDOUT: %Float: type = fn_type @Float [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Float = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 32 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 64 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -121,10 +135,10 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: .dyn_size = %dyn_size // CHECK:STDOUT: .dyn = %dyn // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+5, loc_11 [template = imports.%Float] +// CHECK:STDOUT: %import_ref: Float = import_ref ir1, inst+5, loc_11 [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Float.ref.loc10: = name_ref Float, %import_ref [template = imports.%Float] -// CHECK:STDOUT: %.loc10_26: i32 = int_literal 32 [template = constants.%.1] +// CHECK:STDOUT: %Float.ref.loc10: Float = name_ref Float, %import_ref [template = constants.%struct] +// CHECK:STDOUT: %.loc10_26: i32 = int_literal 32 [template = constants.%.2] // CHECK:STDOUT: %float.make_type.loc10: init type = call %Float.ref.loc10(%.loc10_26) [template = ] // CHECK:STDOUT: %.loc10_28.1: type = value_of_initializer %float.make_type.loc10 [template = ] // CHECK:STDOUT: %.loc10_28.2: type = converted %float.make_type.loc10, %.loc10_28.1 [template = ] @@ -132,7 +146,7 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: %invalid_float: ref = bind_name invalid_float, %invalid_float.var // CHECK:STDOUT: %dyn_size.var: ref i32 = var dyn_size // CHECK:STDOUT: %dyn_size: ref i32 = bind_name dyn_size, %dyn_size.var -// CHECK:STDOUT: %Float.ref.loc16: = name_ref Float, %import_ref [template = imports.%Float] +// CHECK:STDOUT: %Float.ref.loc16: Float = name_ref Float, %import_ref [template = constants.%struct] // CHECK:STDOUT: %dyn_size.ref: ref i32 = name_ref dyn_size, %dyn_size // CHECK:STDOUT: %.loc16_16: i32 = bind_value %dyn_size.ref // CHECK:STDOUT: %float.make_type.loc16: init type = call %Float.ref.loc16(%.loc16_16) @@ -146,7 +160,7 @@ var dyn: Float(dyn_size); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %.loc12: i32 = int_literal 64 [template = constants.%.3] // CHECK:STDOUT: assign file.%dyn_size.var, %.loc12 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/float/mul.carbon b/toolchain/check/testdata/builtins/float/mul.carbon index 49c70db0b39c..b8c90abe6cec 100644 --- a/toolchain/check/testdata/builtins/float/mul.carbon +++ b/toolchain/check/testdata/builtins/float/mul.carbon @@ -49,27 +49,32 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- mul_sub.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: f64 = float_literal 2 [template] -// CHECK:STDOUT: %.2: f64 = float_literal 0.5 [template] -// CHECK:STDOUT: %.3: f64 = float_literal 1 [template] +// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Mul = struct_value () [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %.2: f64 = float_literal 2 [template] +// CHECK:STDOUT: %.3: f64 = float_literal 0.5 [template] +// CHECK:STDOUT: %.4: f64 = float_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Mul = %Mul -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .Mul = %Mul.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mul: = fn_decl @Mul [template] { +// CHECK:STDOUT: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: f64 = param a // CHECK:STDOUT: @Mul.%a: f64 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: f64 = param b // CHECK:STDOUT: @Mul.%b: f64 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Mul.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc4_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc4_16.1 // CHECK:STDOUT: %b.loc4_24.1: f64 = param b @@ -84,7 +89,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mul.ref: = name_ref Mul, file.%Mul [template = file.%Mul] +// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, file.%Mul.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.mul: init f64 = call %Mul.ref(%a.ref, %b.ref) @@ -95,34 +100,52 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mul.ref: = name_ref Mul, file.%Mul [template = file.%Mul] -// CHECK:STDOUT: %.loc8_18: f64 = float_literal 2 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_23: f64 = float_literal 0.5 [template = constants.%.2] -// CHECK:STDOUT: %float.mul: init f64 = call %Mul.ref(%.loc8_18, %.loc8_23) [template = constants.%.3] +// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, file.%Mul.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc8_18: f64 = float_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_23: f64 = float_literal 0.5 [template = constants.%.3] +// CHECK:STDOUT: %float.mul: init f64 = call %Mul.ref(%.loc8_18, %.loc8_23) [template = constants.%.4] // CHECK:STDOUT: assign file.%x.var, %float.mul // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] +// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] +// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] +// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] +// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] +// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] +// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .TooFew = %TooFew -// CHECK:STDOUT: .TooMany = %TooMany -// CHECK:STDOUT: .BadReturnType = %BadReturnType -// CHECK:STDOUT: .JustRight = %JustRight -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType +// CHECK:STDOUT: .TooFew = %TooFew.decl +// CHECK:STDOUT: .TooMany = %TooMany.decl +// CHECK:STDOUT: .BadReturnType = %BadReturnType.decl +// CHECK:STDOUT: .JustRight = %JustRight.decl +// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl +// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl +// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew: = fn_decl @TooFew [template] { +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc8_11.1: f64 = param a // CHECK:STDOUT: @TooFew.%a: f64 = bind_name a, %a.loc8_11.1 // CHECK:STDOUT: @TooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany: = fn_decl @TooMany [template] { +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc13_12.1: f64 = param a // CHECK:STDOUT: @TooMany.%a: f64 = bind_name a, %a.loc13_12.1 // CHECK:STDOUT: %b.loc13_20.1: f64 = param b @@ -131,26 +154,26 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: @TooMany.%c: f64 = bind_name c, %c.loc13_28.1 // CHECK:STDOUT: @TooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType: = fn_decl @BadReturnType [template] { +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc17_18.1: f64 = param a // CHECK:STDOUT: @BadReturnType.%a: f64 = bind_name a, %a.loc17_18.1 // CHECK:STDOUT: %b.loc17_26.1: f64 = param b // CHECK:STDOUT: @BadReturnType.%b: f64 = bind_name b, %b.loc17_26.1 // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight: = fn_decl @JustRight [template] { +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc18_14.1: f64 = param a // CHECK:STDOUT: @JustRight.%a: f64 = bind_name a, %a.loc18_14.1 // CHECK:STDOUT: %b.loc18_22.1: f64 = param b // CHECK:STDOUT: @JustRight.%b: f64 = bind_name b, %b.loc18_22.1 // CHECK:STDOUT: @JustRight.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew: = fn_decl @RuntimeCallTooFew [template] { +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { // CHECK:STDOUT: %a.loc20_22.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: f64 = bind_name a, %a.loc20_22.1 // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany: = fn_decl @RuntimeCallTooMany [template] { +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { // CHECK:STDOUT: %a.loc24_23.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: f64 = bind_name a, %a.loc24_23.1 // CHECK:STDOUT: %b.loc24_31.1: f64 = param b @@ -159,7 +182,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: @RuntimeCallTooMany.%c: f64 = bind_name c, %c.loc24_39.1 // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType: = fn_decl @RuntimeCallBadReturnType [template] { +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { // CHECK:STDOUT: %a.loc28_29.1: f64 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: f64 = bind_name a, %a.loc28_29.1 // CHECK:STDOUT: %b.loc28_37.1: f64 = param b @@ -178,7 +201,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init f64 = call %TooFew.ref(%a.ref) // CHECK:STDOUT: %.loc21_19.1: f64 = value_of_initializer %TooFew.call @@ -188,7 +211,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: f64, %b: f64, %c: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, file.%TooMany [template = file.%TooMany] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %c.ref: f64 = name_ref c, %c @@ -200,7 +223,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/float/negate.carbon b/toolchain/check/testdata/builtins/float/negate.carbon index fffc2d29a083..61bf2cfd6353 100644 --- a/toolchain/check/testdata/builtins/float/negate.carbon +++ b/toolchain/check/testdata/builtins/float/negate.carbon @@ -70,34 +70,39 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_negate.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: f64 = float_literal 1.5 [template] -// CHECK:STDOUT: %.2: f64 = float_literal -1.5 [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Negate = struct_value () [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %.2: f64 = float_literal 1.5 [template] +// CHECK:STDOUT: %.3: f64 = float_literal -1.5 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Negate = %Negate -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .Negate = %Negate.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_11.1: f64 = param a // CHECK:STDOUT: @Negate.%a: f64 = bind_name a, %a.loc2_11.1 // CHECK:STDOUT: @Negate.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc4_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc4_16.1 // CHECK:STDOUT: %b.loc4_24.1: f64 = param b // CHECK:STDOUT: @RuntimeCall.%b: f64 = bind_name b, %b.loc4_24.1 // CHECK:STDOUT: @RuntimeCall.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc8_21: f64 = float_literal 1.5 [template = constants.%.1] -// CHECK:STDOUT: %float.negate: init f64 = call %Negate.ref(%.loc8_21) [template = constants.%.2] -// CHECK:STDOUT: %.loc8_25.1: f64 = value_of_initializer %float.negate [template = constants.%.2] -// CHECK:STDOUT: %.loc8_25.2: f64 = converted %float.negate, %.loc8_25.1 [template = constants.%.2] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc8_21: f64 = float_literal 1.5 [template = constants.%.2] +// CHECK:STDOUT: %float.negate: init f64 = call %Negate.ref(%.loc8_21) [template = constants.%.3] +// CHECK:STDOUT: %.loc8_25.1: f64 = value_of_initializer %float.negate [template = constants.%.3] +// CHECK:STDOUT: %.loc8_25.2: f64 = converted %float.negate, %.loc8_25.1 [template = constants.%.3] // CHECK:STDOUT: %a.loc8: f64 = bind_name a, %.loc8_25.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -105,7 +110,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Negate.ref: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %float.negate: init f64 = call %Negate.ref(%a.ref) // CHECK:STDOUT: %.loc5_19.1: f64 = value_of_initializer %float.negate @@ -115,44 +120,62 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] +// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] +// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] +// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] +// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] +// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] +// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .TooFew = %TooFew -// CHECK:STDOUT: .TooMany = %TooMany -// CHECK:STDOUT: .BadReturnType = %BadReturnType -// CHECK:STDOUT: .JustRight = %JustRight -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType +// CHECK:STDOUT: .TooFew = %TooFew.decl +// CHECK:STDOUT: .TooMany = %TooMany.decl +// CHECK:STDOUT: .BadReturnType = %BadReturnType.decl +// CHECK:STDOUT: .JustRight = %JustRight.decl +// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl +// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl +// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew: = fn_decl @TooFew [template] { +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { // CHECK:STDOUT: @TooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany: = fn_decl @TooMany [template] { +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc13_12.1: f64 = param a // CHECK:STDOUT: @TooMany.%a: f64 = bind_name a, %a.loc13_12.1 // CHECK:STDOUT: %b.loc13_20.1: f64 = param b // CHECK:STDOUT: @TooMany.%b: f64 = bind_name b, %b.loc13_20.1 // CHECK:STDOUT: @TooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType: = fn_decl @BadReturnType [template] { +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc18_18.1: f64 = param a // CHECK:STDOUT: @BadReturnType.%a: f64 = bind_name a, %a.loc18_18.1 // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight: = fn_decl @JustRight [template] { +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc19_14.1: f64 = param a // CHECK:STDOUT: @JustRight.%a: f64 = bind_name a, %a.loc19_14.1 // CHECK:STDOUT: @JustRight.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew: = fn_decl @RuntimeCallTooFew [template] { +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { // CHECK:STDOUT: %a.loc21_22.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: f64 = bind_name a, %a.loc21_22.1 // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany: = fn_decl @RuntimeCallTooMany [template] { +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { // CHECK:STDOUT: %a.loc32_23.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: f64 = bind_name a, %a.loc32_23.1 // CHECK:STDOUT: %b.loc32_31.1: f64 = param b @@ -161,7 +184,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: @RuntimeCallTooMany.%c: f64 = bind_name c, %c.loc32_39.1 // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType: = fn_decl @RuntimeCallBadReturnType [template] { +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { // CHECK:STDOUT: %a.loc43_29.1: f64 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: f64 = bind_name a, %a.loc43_29.1 // CHECK:STDOUT: %b.loc43_37.1: f64 = param b @@ -180,7 +203,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init f64 = call %TooFew.ref() [template = ] // CHECK:STDOUT: %.loc29_19.1: f64 = value_of_initializer %TooFew.call [template = ] @@ -190,7 +213,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: f64, %b: f64, %c: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, file.%TooMany [template = file.%TooMany] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %c.ref: f64 = name_ref c, %c @@ -202,7 +225,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref() [template = ] diff --git a/toolchain/check/testdata/builtins/float/neq.carbon b/toolchain/check/testdata/builtins/float/neq.carbon index b4aff815cbf6..cf18319d06b1 100644 --- a/toolchain/check/testdata/builtins/float/neq.carbon +++ b/toolchain/check/testdata/builtins/float/neq.carbon @@ -32,10 +32,14 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: --- float_neq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Neq: type = fn_type @Neq [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Neq = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: f64 = float_literal 1 [template] // CHECK:STDOUT: %.5: f64 = float_literal 2 [template] @@ -43,19 +47,21 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: %.7: f64 = float_literal 1 [template] // CHECK:STDOUT: %.8: f64 = float_literal 1 [template] // CHECK:STDOUT: %.9: bool = bool_literal false [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Neq = %Neq +// CHECK:STDOUT: .Neq = %Neq.decl // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Neq: = fn_decl @Neq [template] { +// CHECK:STDOUT: %Neq.decl: Neq = fn_decl @Neq [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: f64 = param a // CHECK:STDOUT: @Neq.%a: f64 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: f64 = param b @@ -64,7 +70,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc7_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc7_6.1 @@ -72,7 +78,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: %false_.loc7_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc7_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc12_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc12_16.1 // CHECK:STDOUT: %b.loc12_24.1: f64 = param b @@ -96,7 +102,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref: True = name_ref true_, %true_ -// CHECK:STDOUT: %Neq.ref.loc8: = name_ref Neq, file.%Neq [template = file.%Neq] +// CHECK:STDOUT: %Neq.ref.loc8: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc8_20: f64 = float_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc8_25: f64 = float_literal 2 [template = constants.%.5] // CHECK:STDOUT: %float.neq.loc8: init bool = call %Neq.ref.loc8(%.loc8_20, %.loc8_25) [template = constants.%.6] @@ -115,7 +121,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: !if.expr.result.loc8: // CHECK:STDOUT: %.loc8_13.3: type = block_arg !if.expr.result.loc8 [template = constants.%True] // CHECK:STDOUT: %false_.ref: False = name_ref false_, %false_ -// CHECK:STDOUT: %Neq.ref.loc9: = name_ref Neq, file.%Neq [template = file.%Neq] +// CHECK:STDOUT: %Neq.ref.loc9: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9_21: f64 = float_literal 1 [template = constants.%.7] // CHECK:STDOUT: %.loc9_26: f64 = float_literal 1 [template = constants.%.8] // CHECK:STDOUT: %float.neq.loc9: init bool = call %Neq.ref.loc9(%.loc9_21, %.loc9_26) [template = constants.%.9] @@ -138,7 +144,7 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Neq.ref: = name_ref Neq, file.%Neq [template = file.%Neq] +// CHECK:STDOUT: %Neq.ref: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.neq: init bool = call %Neq.ref(%a.ref, %b.ref) @@ -149,13 +155,19 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; // CHECK:STDOUT: // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %WrongResult: type = fn_type @WrongResult [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: WrongResult = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .WrongResult = %WrongResult +// CHECK:STDOUT: .WrongResult = %WrongResult.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %WrongResult: = fn_decl @WrongResult [template] { +// CHECK:STDOUT: %WrongResult.decl: WrongResult = fn_decl @WrongResult [template = constants.%struct] { // CHECK:STDOUT: %a.loc7_16.1: f64 = param a // CHECK:STDOUT: @WrongResult.%a: f64 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: f64 = param b diff --git a/toolchain/check/testdata/builtins/float/sub.carbon b/toolchain/check/testdata/builtins/float/sub.carbon index d10dd94947d1..47594aaf757f 100644 --- a/toolchain/check/testdata/builtins/float/sub.carbon +++ b/toolchain/check/testdata/builtins/float/sub.carbon @@ -49,27 +49,32 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: --- float_sub.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: f64 = float_literal 2 [template] -// CHECK:STDOUT: %.2: f64 = float_literal 0.5 [template] -// CHECK:STDOUT: %.3: f64 = float_literal 1.5 [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Sub = struct_value () [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] +// CHECK:STDOUT: %.2: f64 = float_literal 2 [template] +// CHECK:STDOUT: %.3: f64 = float_literal 0.5 [template] +// CHECK:STDOUT: %.4: f64 = float_literal 1.5 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Sub = %Sub -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .Sub = %Sub.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { +// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: f64 = param a // CHECK:STDOUT: @Sub.%a: f64 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: f64 = param b // CHECK:STDOUT: @Sub.%b: f64 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Sub.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc4_16.1: f64 = param a // CHECK:STDOUT: @RuntimeCall.%a: f64 = bind_name a, %a.loc4_16.1 // CHECK:STDOUT: %b.loc4_24.1: f64 = param b @@ -84,7 +89,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: f64, %b: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Sub.ref: = name_ref Sub, file.%Sub [template = file.%Sub] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, file.%Sub.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %float.sub: init f64 = call %Sub.ref(%a.ref, %b.ref) @@ -95,34 +100,52 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Sub.ref: = name_ref Sub, file.%Sub [template = file.%Sub] -// CHECK:STDOUT: %.loc8_18: f64 = float_literal 2 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_23: f64 = float_literal 0.5 [template = constants.%.2] -// CHECK:STDOUT: %float.sub: init f64 = call %Sub.ref(%.loc8_18, %.loc8_23) [template = constants.%.3] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, file.%Sub.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc8_18: f64 = float_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_23: f64 = float_literal 0.5 [template = constants.%.3] +// CHECK:STDOUT: %float.sub: init f64 = call %Sub.ref(%.loc8_18, %.loc8_23) [template = constants.%.4] // CHECK:STDOUT: assign file.%x.var, %float.sub // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] +// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] +// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] +// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] +// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] +// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] +// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .TooFew = %TooFew -// CHECK:STDOUT: .TooMany = %TooMany -// CHECK:STDOUT: .BadReturnType = %BadReturnType -// CHECK:STDOUT: .JustRight = %JustRight -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType +// CHECK:STDOUT: .TooFew = %TooFew.decl +// CHECK:STDOUT: .TooMany = %TooMany.decl +// CHECK:STDOUT: .BadReturnType = %BadReturnType.decl +// CHECK:STDOUT: .JustRight = %JustRight.decl +// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl +// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl +// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew: = fn_decl @TooFew [template] { +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc8_11.1: f64 = param a // CHECK:STDOUT: @TooFew.%a: f64 = bind_name a, %a.loc8_11.1 // CHECK:STDOUT: @TooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany: = fn_decl @TooMany [template] { +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc13_12.1: f64 = param a // CHECK:STDOUT: @TooMany.%a: f64 = bind_name a, %a.loc13_12.1 // CHECK:STDOUT: %b.loc13_20.1: f64 = param b @@ -131,26 +154,26 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: @TooMany.%c: f64 = bind_name c, %c.loc13_28.1 // CHECK:STDOUT: @TooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType: = fn_decl @BadReturnType [template] { +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc17_18.1: f64 = param a // CHECK:STDOUT: @BadReturnType.%a: f64 = bind_name a, %a.loc17_18.1 // CHECK:STDOUT: %b.loc17_26.1: f64 = param b // CHECK:STDOUT: @BadReturnType.%b: f64 = bind_name b, %b.loc17_26.1 // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight: = fn_decl @JustRight [template] { +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc18_14.1: f64 = param a // CHECK:STDOUT: @JustRight.%a: f64 = bind_name a, %a.loc18_14.1 // CHECK:STDOUT: %b.loc18_22.1: f64 = param b // CHECK:STDOUT: @JustRight.%b: f64 = bind_name b, %b.loc18_22.1 // CHECK:STDOUT: @JustRight.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooFew: = fn_decl @RuntimeCallTooFew [template] { +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { // CHECK:STDOUT: %a.loc20_22.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: f64 = bind_name a, %a.loc20_22.1 // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany: = fn_decl @RuntimeCallTooMany [template] { +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { // CHECK:STDOUT: %a.loc24_23.1: f64 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: f64 = bind_name a, %a.loc24_23.1 // CHECK:STDOUT: %b.loc24_31.1: f64 = param b @@ -159,7 +182,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: @RuntimeCallTooMany.%c: f64 = bind_name c, %c.loc24_39.1 // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType: = fn_decl @RuntimeCallBadReturnType [template] { +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { // CHECK:STDOUT: %a.loc28_29.1: f64 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: f64 = bind_name a, %a.loc28_29.1 // CHECK:STDOUT: %b.loc28_37.1: f64 = param b @@ -178,7 +201,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init f64 = call %TooFew.ref(%a.ref) // CHECK:STDOUT: %.loc21_19.1: f64 = value_of_initializer %TooFew.call @@ -188,7 +211,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: f64, %b: f64, %c: f64) -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, file.%TooMany [template = file.%TooMany] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %c.ref: f64 = name_ref c, %c @@ -200,7 +223,7 @@ fn RuntimeCallBadReturnType(a: f64, b: f64) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: f64, %b: f64) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: f64 = name_ref a, %a // CHECK:STDOUT: %b.ref: f64 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index b56c4892738e..fb0ef520405f 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -18,42 +18,47 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: --- int_and.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 10 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 8 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 8] [template] +// CHECK:STDOUT: %And: type = fn_type @And [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: And = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 10 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 8 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 8] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .And = %And +// CHECK:STDOUT: .And = %And.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %And: = fn_decl @And [template] { +// CHECK:STDOUT: %And.decl: And = fn_decl @And [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @And.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @And.%b: i32 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @And.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %And.ref: = name_ref And, %And [template = %And] -// CHECK:STDOUT: %.loc4_20: i32 = int_literal 12 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_24: i32 = int_literal 10 [template = constants.%.2] -// CHECK:STDOUT: %int.and: init i32 = call %And.ref(%.loc4_20, %.loc4_24) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_27: type = array_type %int.and, i32 [template = constants.%.4] +// CHECK:STDOUT: %And.ref: And = name_ref And, %And.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_20: i32 = int_literal 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_24: i32 = int_literal 10 [template = constants.%.3] +// CHECK:STDOUT: %int.and: init i32 = call %And.ref(%.loc4_20, %.loc4_24) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_27: type = array_type %int.and, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 8] = var arr // CHECK:STDOUT: %arr: ref [i32; 8] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 8 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 8] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 8 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 8] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 8] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 8]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 8]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -66,7 +71,7 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %And.ref: = name_ref And, file.%And [template = file.%And] +// CHECK:STDOUT: %And.ref: And = name_ref And, file.%And.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.and: init i32 = call %And.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/complement.carbon b/toolchain/check/testdata/builtins/int/complement.carbon index 92e682d9d221..43aae3bbb994 100644 --- a/toolchain/check/testdata/builtins/int/complement.carbon +++ b/toolchain/check/testdata/builtins/int/complement.carbon @@ -19,53 +19,60 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: --- int_complement.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1193046 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -1193047 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 16777215 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 15584169 [template] -// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] -// CHECK:STDOUT: %.6: type = ptr_type [i32; 15584169] [template] +// CHECK:STDOUT: %Complement: type = fn_type @Complement [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Complement = struct_value () [template] +// CHECK:STDOUT: %And: type = fn_type @And [template] +// CHECK:STDOUT: %struct.2: And = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1193046 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -1193047 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 16777215 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 15584169 [template] +// CHECK:STDOUT: %.6: type = array_type %.5, i32 [template] +// CHECK:STDOUT: %.7: type = ptr_type [i32; 15584169] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Complement = %Complement -// CHECK:STDOUT: .And = %And +// CHECK:STDOUT: .Complement = %Complement.decl +// CHECK:STDOUT: .And = %And.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Complement: = fn_decl @Complement [template] { +// CHECK:STDOUT: %Complement.decl: Complement = fn_decl @Complement [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_15.1: i32 = param a // CHECK:STDOUT: @Complement.%a: i32 = bind_name a, %a.loc2_15.1 // CHECK:STDOUT: @Complement.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %And: = fn_decl @And [template] { +// CHECK:STDOUT: %And.decl: And = fn_decl @And [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc3_8.1: i32 = param a // CHECK:STDOUT: @And.%a: i32 = bind_name a, %a.loc3_8.1 // CHECK:STDOUT: %b.loc3_16.1: i32 = param b // CHECK:STDOUT: @And.%b: i32 = bind_name b, %b.loc3_16.1 // CHECK:STDOUT: @And.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %And.ref: = name_ref And, %And [template = %And] -// CHECK:STDOUT: %Complement.ref: = name_ref Complement, %Complement [template = %Complement] -// CHECK:STDOUT: %.loc5_31: i32 = int_literal 1193046 [template = constants.%.1] -// CHECK:STDOUT: %int.complement: init i32 = call %Complement.ref(%.loc5_31) [template = constants.%.2] -// CHECK:STDOUT: %.loc5_42: i32 = int_literal 16777215 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19.1: i32 = value_of_initializer %int.complement [template = constants.%.2] -// CHECK:STDOUT: %.loc5_19.2: i32 = converted %int.complement, %.loc5_19.1 [template = constants.%.2] -// CHECK:STDOUT: %int.and: init i32 = call %And.ref(%.loc5_19.2, %.loc5_42) [template = constants.%.4] -// CHECK:STDOUT: %.loc5_51: type = array_type %int.and, i32 [template = constants.%.5] +// CHECK:STDOUT: %And.ref: And = name_ref And, %And.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Complement.ref: Complement = name_ref Complement, %Complement.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc5_31: i32 = int_literal 1193046 [template = constants.%.2] +// CHECK:STDOUT: %int.complement: init i32 = call %Complement.ref(%.loc5_31) [template = constants.%.3] +// CHECK:STDOUT: %.loc5_42: i32 = int_literal 16777215 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19.1: i32 = value_of_initializer %int.complement [template = constants.%.3] +// CHECK:STDOUT: %.loc5_19.2: i32 = converted %int.complement, %.loc5_19.1 [template = constants.%.3] +// CHECK:STDOUT: %int.and: init i32 = call %And.ref(%.loc5_19.2, %.loc5_42) [template = constants.%.5] +// CHECK:STDOUT: %.loc5_51: type = array_type %int.and, i32 [template = constants.%.6] // CHECK:STDOUT: %arr.var: ref [i32; 15584169] = var arr // CHECK:STDOUT: %arr: ref [i32; 15584169] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc6_18: i32 = int_literal 15584169 [template = constants.%.4] -// CHECK:STDOUT: %.loc6_26: type = array_type %.loc6_18, i32 [template = constants.%.5] -// CHECK:STDOUT: %.loc6_27: type = ptr_type [i32; 15584169] [template = constants.%.6] +// CHECK:STDOUT: %.loc6_18: i32 = int_literal 15584169 [template = constants.%.5] +// CHECK:STDOUT: %.loc6_26: type = array_type %.loc6_18, i32 [template = constants.%.6] +// CHECK:STDOUT: %.loc6_27: type = ptr_type [i32; 15584169] [template = constants.%.7] // CHECK:STDOUT: %arr.ref: ref [i32; 15584169] = name_ref arr, %arr // CHECK:STDOUT: %.loc6_31: [i32; 15584169]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 15584169]* = bind_name arr_p, %.loc6_31 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc8_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc8_16.1 // CHECK:STDOUT: @RuntimeCall.%return: ref i32 = var @@ -78,7 +85,7 @@ fn RuntimeCall(a: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Complement.ref: = name_ref Complement, file.%Complement [template = file.%Complement] +// CHECK:STDOUT: %Complement.ref: Complement = name_ref Complement, file.%Complement.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %int.complement: init i32 = call %Complement.ref(%a.ref) // CHECK:STDOUT: %.loc9_23.1: i32 = value_of_initializer %int.complement diff --git a/toolchain/check/testdata/builtins/int/eq.carbon b/toolchain/check/testdata/builtins/int/eq.carbon index 2a966b4ba198..c33414702f72 100644 --- a/toolchain/check/testdata/builtins/int/eq.carbon +++ b/toolchain/check/testdata/builtins/int/eq.carbon @@ -32,28 +32,34 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: --- int_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Eq: type = fn_type @Eq [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Eq = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: bool = bool_literal true [template] // CHECK:STDOUT: %.6: i32 = int_literal 2 [template] // CHECK:STDOUT: %.7: bool = bool_literal false [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Eq = %Eq +// CHECK:STDOUT: .Eq = %Eq.decl // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Eq: = fn_decl @Eq [template] { +// CHECK:STDOUT: %Eq.decl: Eq = fn_decl @Eq [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_7.1: i32 = param a // CHECK:STDOUT: @Eq.%a: i32 = bind_name a, %a.loc2_7.1 // CHECK:STDOUT: %b.loc2_15.1: i32 = param b @@ -62,7 +68,7 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc7_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc7_6.1 @@ -70,7 +76,7 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: %false_.loc7_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc7_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc12_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc12_16.1 // CHECK:STDOUT: %b.loc12_24.1: i32 = param b @@ -94,7 +100,7 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref: True = name_ref true_, %true_ -// CHECK:STDOUT: %Eq.ref.loc8: = name_ref Eq, file.%Eq [template = file.%Eq] +// CHECK:STDOUT: %Eq.ref.loc8: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc8_19: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc8_22: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.eq.loc8: init bool = call %Eq.ref.loc8(%.loc8_19, %.loc8_22) [template = constants.%.5] @@ -113,7 +119,7 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: !if.expr.result.loc8: // CHECK:STDOUT: %.loc8_13.3: type = block_arg !if.expr.result.loc8 [template = constants.%True] // CHECK:STDOUT: %false_.ref: False = name_ref false_, %false_ -// CHECK:STDOUT: %Eq.ref.loc9: = name_ref Eq, file.%Eq [template = file.%Eq] +// CHECK:STDOUT: %Eq.ref.loc9: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9_20: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %int.eq.loc9: init bool = call %Eq.ref.loc9(%.loc9_20, %.loc9_23) [template = constants.%.7] @@ -136,7 +142,7 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Eq.ref: = name_ref Eq, file.%Eq [template = file.%Eq] +// CHECK:STDOUT: %Eq.ref: Eq = name_ref Eq, file.%Eq.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.eq: init bool = call %Eq.ref(%a.ref, %b.ref) @@ -147,13 +153,19 @@ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; // CHECK:STDOUT: // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %WrongResult: type = fn_type @WrongResult [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: WrongResult = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .WrongResult = %WrongResult +// CHECK:STDOUT: .WrongResult = %WrongResult.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %WrongResult: = fn_decl @WrongResult [template] { +// CHECK:STDOUT: %WrongResult.decl: WrongResult = fn_decl @WrongResult [template = constants.%struct] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @WrongResult.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b diff --git a/toolchain/check/testdata/builtins/int/greater.carbon b/toolchain/check/testdata/builtins/int/greater.carbon index 877fb913779f..53fba1308fef 100644 --- a/toolchain/check/testdata/builtins/int/greater.carbon +++ b/toolchain/check/testdata/builtins/int/greater.carbon @@ -27,10 +27,16 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: --- int_greater.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Greater: type = fn_type @Greater [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Greater = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] @@ -38,34 +44,36 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.7: i32 = int_literal 0 [template] // CHECK:STDOUT: %.8: bool = bool_literal true [template] // CHECK:STDOUT: %.9: i32 = int_literal -1 [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Greater = %Greater -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Greater = %Greater.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Greater: = fn_decl @Greater [template] { +// CHECK:STDOUT: %Greater.decl: Greater = fn_decl @Greater [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_12.1: i32 = param a // CHECK:STDOUT: @Greater.%a: i32 = bind_name a, %a.loc2_12.1 // CHECK:STDOUT: %b.loc2_20.1: i32 = param b // CHECK:STDOUT: @Greater.%b: i32 = bind_name b, %b.loc2_20.1 // CHECK:STDOUT: @Greater.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc3_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc3_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -73,7 +81,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc16_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc16_16.1 // CHECK:STDOUT: %b.loc16_24.1: i32 = param b @@ -99,7 +107,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref.loc9: False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc9: = name_ref Greater, file.%Greater [template = file.%Greater] +// CHECK:STDOUT: %Greater.ref.loc9: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9_25: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_28: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %int.greater.loc9: init bool = call %Greater.ref.loc9(%.loc9_25, %.loc9_28) [template = constants.%.6] @@ -118,7 +126,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] // CHECK:STDOUT: %false_.ref.loc10: False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc10: = name_ref Greater, file.%Greater [template = file.%Greater] +// CHECK:STDOUT: %Greater.ref.loc10: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_25: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_28: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.greater.loc10: init bool = call %Greater.ref.loc10(%.loc10_25, %.loc10_28) [template = constants.%.6] @@ -137,7 +145,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_14.3: type = block_arg !if.expr.result.loc10 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc11: True = name_ref true_, %true_ -// CHECK:STDOUT: %Greater.ref.loc11: = name_ref Greater, file.%Greater [template = file.%Greater] +// CHECK:STDOUT: %Greater.ref.loc11: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_27: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %int.greater.loc11: init bool = call %Greater.ref.loc11(%.loc11_24, %.loc11_27) [template = constants.%.8] @@ -156,8 +164,8 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_13.3: type = block_arg !if.expr.result.loc11 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc12: False = name_ref false_, %false_ -// CHECK:STDOUT: %Greater.ref.loc12: = name_ref Greater, file.%Greater [template = file.%Greater] -// CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Greater.ref.loc12: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_32: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_32) [template = constants.%.9] // CHECK:STDOUT: %.loc12_36: i32 = int_literal 0 [template = constants.%.7] @@ -179,9 +187,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc13: True = name_ref true_, %true_ -// CHECK:STDOUT: %Greater.ref.loc13: = name_ref Greater, file.%Greater [template = file.%Greater] +// CHECK:STDOUT: %Greater.ref.loc13: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc13_24: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %Negate.ref.loc13: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_34: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_34) [template = constants.%.9] // CHECK:STDOUT: %.loc13_23.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.9] @@ -206,7 +214,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Greater.ref: = name_ref Greater, file.%Greater [template = file.%Greater] +// CHECK:STDOUT: %Greater.ref: Greater = name_ref Greater, file.%Greater.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.greater: init bool = call %Greater.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/greater_eq.carbon b/toolchain/check/testdata/builtins/int/greater_eq.carbon index f6e7cff43e51..f7b4ee5ceb60 100644 --- a/toolchain/check/testdata/builtins/int/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/int/greater_eq.carbon @@ -27,10 +27,16 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: --- int_greater_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %GreaterEq: type = fn_type @GreaterEq [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: GreaterEq = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] @@ -38,34 +44,36 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.7: bool = bool_literal true [template] // CHECK:STDOUT: %.8: i32 = int_literal 0 [template] // CHECK:STDOUT: %.9: i32 = int_literal -1 [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .GreaterEq = %GreaterEq -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .GreaterEq = %GreaterEq.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %GreaterEq: = fn_decl @GreaterEq [template] { +// CHECK:STDOUT: %GreaterEq.decl: GreaterEq = fn_decl @GreaterEq [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_14.1: i32 = param a // CHECK:STDOUT: @GreaterEq.%a: i32 = bind_name a, %a.loc2_14.1 // CHECK:STDOUT: %b.loc2_22.1: i32 = param b // CHECK:STDOUT: @GreaterEq.%b: i32 = bind_name b, %b.loc2_22.1 // CHECK:STDOUT: @GreaterEq.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc3_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc3_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -73,7 +81,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc16_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc16_16.1 // CHECK:STDOUT: %b.loc16_24.1: i32 = param b @@ -99,7 +107,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref.loc9: False = name_ref false_, %false_ -// CHECK:STDOUT: %GreaterEq.ref.loc9: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] +// CHECK:STDOUT: %GreaterEq.ref.loc9: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9_27: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_30: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %int.greater_eq.loc9: init bool = call %GreaterEq.ref.loc9(%.loc9_27, %.loc9_30) [template = constants.%.6] @@ -118,7 +126,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_14.3: type = block_arg !if.expr.result.loc9 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc10: True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc10: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] +// CHECK:STDOUT: %GreaterEq.ref.loc10: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_26: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_29: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.greater_eq.loc10: init bool = call %GreaterEq.ref.loc10(%.loc10_26, %.loc10_29) [template = constants.%.7] @@ -137,7 +145,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] // CHECK:STDOUT: %true_.ref.loc11: True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc11: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] +// CHECK:STDOUT: %GreaterEq.ref.loc11: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc11_26: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_29: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %int.greater_eq.loc11: init bool = call %GreaterEq.ref.loc11(%.loc11_26, %.loc11_29) [template = constants.%.7] @@ -156,8 +164,8 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_13.3: type = block_arg !if.expr.result.loc11 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc12: False = name_ref false_, %false_ -// CHECK:STDOUT: %GreaterEq.ref.loc12: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] -// CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %GreaterEq.ref.loc12: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_34: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_34) [template = constants.%.9] // CHECK:STDOUT: %.loc12_38: i32 = int_literal 0 [template = constants.%.8] @@ -179,9 +187,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_14.3: type = block_arg !if.expr.result.loc12 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc13: True = name_ref true_, %true_ -// CHECK:STDOUT: %GreaterEq.ref.loc13: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] +// CHECK:STDOUT: %GreaterEq.ref.loc13: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc13_26: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %Negate.ref.loc13: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_36: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_36) [template = constants.%.9] // CHECK:STDOUT: %.loc13_25.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.9] @@ -206,7 +214,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %GreaterEq.ref: = name_ref GreaterEq, file.%GreaterEq [template = file.%GreaterEq] +// CHECK:STDOUT: %GreaterEq.ref: GreaterEq = name_ref GreaterEq, file.%GreaterEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.greater_eq: init bool = call %GreaterEq.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index caa7f119ca04..9ea1f6374d8b 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -62,42 +62,47 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: --- int_left_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 20 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 20] [template] +// CHECK:STDOUT: %LeftShift: type = fn_type @LeftShift [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: LeftShift = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 20 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 20] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .LeftShift = %LeftShift +// CHECK:STDOUT: .LeftShift = %LeftShift.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %LeftShift: = fn_decl @LeftShift [template] { +// CHECK:STDOUT: %LeftShift.decl: LeftShift = fn_decl @LeftShift [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_14.1: i32 = param a // CHECK:STDOUT: @LeftShift.%a: i32 = bind_name a, %a.loc2_14.1 // CHECK:STDOUT: %b.loc2_22.1: i32 = param b // CHECK:STDOUT: @LeftShift.%b: i32 = bind_name b, %b.loc2_22.1 // CHECK:STDOUT: @LeftShift.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %LeftShift.ref: = name_ref LeftShift, %LeftShift [template = %LeftShift] -// CHECK:STDOUT: %.loc4_26: i32 = int_literal 5 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_29: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.left_shift: init i32 = call %LeftShift.ref(%.loc4_26, %.loc4_29) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_31: type = array_type %int.left_shift, i32 [template = constants.%.4] +// CHECK:STDOUT: %LeftShift.ref: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_26: i32 = int_literal 5 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_29: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.left_shift: init i32 = call %LeftShift.ref(%.loc4_26, %.loc4_29) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_31: type = array_type %int.left_shift, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 20] = var arr // CHECK:STDOUT: %arr: ref [i32; 20] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 20 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_20: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_21: type = ptr_type [i32; 20] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 20 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_20: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_21: type = ptr_type [i32; 20] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 20] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_25: [i32; 20]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 20]* = bind_name arr_p, %.loc5_25 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -110,7 +115,7 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %LeftShift.ref: = name_ref LeftShift, file.%LeftShift [template = file.%LeftShift] +// CHECK:STDOUT: %LeftShift.ref: LeftShift = name_ref LeftShift, file.%LeftShift.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.left_shift: init i32 = call %LeftShift.ref(%a.ref, %b.ref) @@ -122,91 +127,96 @@ let negative: i32 = LeftShift(1, Negate(1)); // CHECK:STDOUT: --- fail_bad_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 31 [template] -// CHECK:STDOUT: %.3: i32 = int_literal -2147483648 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 32 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 33 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 1000 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.8: i32 = int_literal -1 [template] +// CHECK:STDOUT: %LeftShift: type = fn_type @LeftShift [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: LeftShift = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 31 [template] +// CHECK:STDOUT: %.4: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 32 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 33 [template] +// CHECK:STDOUT: %.7: i32 = int_literal 1000 [template] +// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.9: i32 = int_literal -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .LeftShift = %LeftShift -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .LeftShift = %LeftShift.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %LeftShift: = fn_decl @LeftShift [template] { +// CHECK:STDOUT: %LeftShift.decl: LeftShift = fn_decl @LeftShift [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc4_14.1: i32 = param a // CHECK:STDOUT: @LeftShift.%a: i32 = bind_name a, %a.loc4_14.1 // CHECK:STDOUT: %b.loc4_22.1: i32 = param b // CHECK:STDOUT: @LeftShift.%b: i32 = bind_name b, %b.loc4_22.1 // CHECK:STDOUT: @LeftShift.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc5_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc5_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %LeftShift.ref.loc8: = name_ref LeftShift, %LeftShift [template = %LeftShift] -// CHECK:STDOUT: %.loc8_29: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_32: i32 = int_literal 31 [template = constants.%.2] -// CHECK:STDOUT: %int.left_shift.loc8: init i32 = call %LeftShift.ref.loc8(%.loc8_29, %.loc8_32) [template = constants.%.3] -// CHECK:STDOUT: %.loc8_35.1: i32 = value_of_initializer %int.left_shift.loc8 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_35.2: i32 = converted %int.left_shift.loc8, %.loc8_35.1 [template = constants.%.3] +// CHECK:STDOUT: %LeftShift.ref.loc8: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc8_29: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_32: i32 = int_literal 31 [template = constants.%.3] +// CHECK:STDOUT: %int.left_shift.loc8: init i32 = call %LeftShift.ref.loc8(%.loc8_29, %.loc8_32) [template = constants.%.4] +// CHECK:STDOUT: %.loc8_35.1: i32 = value_of_initializer %int.left_shift.loc8 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_35.2: i32 = converted %int.left_shift.loc8, %.loc8_35.1 [template = constants.%.4] // CHECK:STDOUT: %size_1: i32 = bind_name size_1, %.loc8_35.2 -// CHECK:STDOUT: %LeftShift.ref.loc13: = name_ref LeftShift, %LeftShift [template = %LeftShift] -// CHECK:STDOUT: %.loc13_29: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc13_32: i32 = int_literal 32 [template = constants.%.4] +// CHECK:STDOUT: %LeftShift.ref.loc13: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc13_29: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_32: i32 = int_literal 32 [template = constants.%.5] // CHECK:STDOUT: %int.left_shift.loc13: init i32 = call %LeftShift.ref.loc13(%.loc13_29, %.loc13_32) [template = ] // CHECK:STDOUT: %.loc13_35.1: i32 = value_of_initializer %int.left_shift.loc13 [template = ] // CHECK:STDOUT: %.loc13_35.2: i32 = converted %int.left_shift.loc13, %.loc13_35.1 [template = ] // CHECK:STDOUT: %size_2: i32 = bind_name size_2, %.loc13_35.2 -// CHECK:STDOUT: %LeftShift.ref.loc18: = name_ref LeftShift, %LeftShift [template = %LeftShift] -// CHECK:STDOUT: %.loc18_29: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc18_32: i32 = int_literal 33 [template = constants.%.5] +// CHECK:STDOUT: %LeftShift.ref.loc18: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18_29: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc18_32: i32 = int_literal 33 [template = constants.%.6] // CHECK:STDOUT: %int.left_shift.loc18: init i32 = call %LeftShift.ref.loc18(%.loc18_29, %.loc18_32) [template = ] // CHECK:STDOUT: %.loc18_35.1: i32 = value_of_initializer %int.left_shift.loc18 [template = ] // CHECK:STDOUT: %.loc18_35.2: i32 = converted %int.left_shift.loc18, %.loc18_35.1 [template = ] // CHECK:STDOUT: %size_3: i32 = bind_name size_3, %.loc18_35.2 -// CHECK:STDOUT: %LeftShift.ref.loc21: = name_ref LeftShift, %LeftShift [template = %LeftShift] -// CHECK:STDOUT: %.loc21_33: i32 = int_literal 1000 [template = constants.%.6] -// CHECK:STDOUT: %.loc21_39: i32 = int_literal 31 [template = constants.%.2] -// CHECK:STDOUT: %int.left_shift.loc21: init i32 = call %LeftShift.ref.loc21(%.loc21_33, %.loc21_39) [template = constants.%.7] -// CHECK:STDOUT: %.loc21_42.1: i32 = value_of_initializer %int.left_shift.loc21 [template = constants.%.7] -// CHECK:STDOUT: %.loc21_42.2: i32 = converted %int.left_shift.loc21, %.loc21_42.1 [template = constants.%.7] +// CHECK:STDOUT: %LeftShift.ref.loc21: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc21_33: i32 = int_literal 1000 [template = constants.%.7] +// CHECK:STDOUT: %.loc21_39: i32 = int_literal 31 [template = constants.%.3] +// CHECK:STDOUT: %int.left_shift.loc21: init i32 = call %LeftShift.ref.loc21(%.loc21_33, %.loc21_39) [template = constants.%.8] +// CHECK:STDOUT: %.loc21_42.1: i32 = value_of_initializer %int.left_shift.loc21 [template = constants.%.8] +// CHECK:STDOUT: %.loc21_42.2: i32 = converted %int.left_shift.loc21, %.loc21_42.1 [template = constants.%.8] // CHECK:STDOUT: %overflow_1: i32 = bind_name overflow_1, %.loc21_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc26: = name_ref LeftShift, %LeftShift [template = %LeftShift] -// CHECK:STDOUT: %.loc26_33: i32 = int_literal 1000 [template = constants.%.6] -// CHECK:STDOUT: %.loc26_39: i32 = int_literal 32 [template = constants.%.4] +// CHECK:STDOUT: %LeftShift.ref.loc26: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc26_33: i32 = int_literal 1000 [template = constants.%.7] +// CHECK:STDOUT: %.loc26_39: i32 = int_literal 32 [template = constants.%.5] // CHECK:STDOUT: %int.left_shift.loc26: init i32 = call %LeftShift.ref.loc26(%.loc26_33, %.loc26_39) [template = ] // CHECK:STDOUT: %.loc26_42.1: i32 = value_of_initializer %int.left_shift.loc26 [template = ] // CHECK:STDOUT: %.loc26_42.2: i32 = converted %int.left_shift.loc26, %.loc26_42.1 [template = ] // CHECK:STDOUT: %overflow_2: i32 = bind_name overflow_2, %.loc26_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc29: = name_ref LeftShift, %LeftShift [template = %LeftShift] -// CHECK:STDOUT: %.loc29_36: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc29_39: i32 = int_literal 31 [template = constants.%.2] -// CHECK:STDOUT: %int.left_shift.loc29: init i32 = call %LeftShift.ref.loc29(%.loc29_36, %.loc29_39) [template = constants.%.7] -// CHECK:STDOUT: %.loc29_42.1: i32 = value_of_initializer %int.left_shift.loc29 [template = constants.%.7] -// CHECK:STDOUT: %.loc29_42.2: i32 = converted %int.left_shift.loc29, %.loc29_42.1 [template = constants.%.7] +// CHECK:STDOUT: %LeftShift.ref.loc29: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc29_36: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc29_39: i32 = int_literal 31 [template = constants.%.3] +// CHECK:STDOUT: %int.left_shift.loc29: init i32 = call %LeftShift.ref.loc29(%.loc29_36, %.loc29_39) [template = constants.%.8] +// CHECK:STDOUT: %.loc29_42.1: i32 = value_of_initializer %int.left_shift.loc29 [template = constants.%.8] +// CHECK:STDOUT: %.loc29_42.2: i32 = converted %int.left_shift.loc29, %.loc29_42.1 [template = constants.%.8] // CHECK:STDOUT: %no_overflow_1: i32 = bind_name no_overflow_1, %.loc29_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc34: = name_ref LeftShift, %LeftShift [template = %LeftShift] -// CHECK:STDOUT: %.loc34_36: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc34_39: i32 = int_literal 32 [template = constants.%.4] +// CHECK:STDOUT: %LeftShift.ref.loc34: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc34_36: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc34_39: i32 = int_literal 32 [template = constants.%.5] // CHECK:STDOUT: %int.left_shift.loc34: init i32 = call %LeftShift.ref.loc34(%.loc34_36, %.loc34_39) [template = ] // CHECK:STDOUT: %.loc34_42.1: i32 = value_of_initializer %int.left_shift.loc34 [template = ] // CHECK:STDOUT: %.loc34_42.2: i32 = converted %int.left_shift.loc34, %.loc34_42.1 [template = ] // CHECK:STDOUT: %no_overflow_2: i32 = bind_name no_overflow_2, %.loc34_42.2 -// CHECK:STDOUT: %LeftShift.ref.loc40: = name_ref LeftShift, %LeftShift [template = %LeftShift] -// CHECK:STDOUT: %.loc40_31: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc40_41: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc40_41) [template = constants.%.8] -// CHECK:STDOUT: %.loc40_30.1: i32 = value_of_initializer %int.snegate [template = constants.%.8] -// CHECK:STDOUT: %.loc40_30.2: i32 = converted %int.snegate, %.loc40_30.1 [template = constants.%.8] +// CHECK:STDOUT: %LeftShift.ref.loc40: LeftShift = name_ref LeftShift, %LeftShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc40_31: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc40_41: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc40_41) [template = constants.%.9] +// CHECK:STDOUT: %.loc40_30.1: i32 = value_of_initializer %int.snegate [template = constants.%.9] +// CHECK:STDOUT: %.loc40_30.2: i32 = converted %int.snegate, %.loc40_30.1 [template = constants.%.9] // CHECK:STDOUT: %int.left_shift.loc40: init i32 = call %LeftShift.ref.loc40(%.loc40_31, %.loc40_30.2) [template = ] // CHECK:STDOUT: %.loc40_44.1: i32 = value_of_initializer %int.left_shift.loc40 [template = ] // CHECK:STDOUT: %.loc40_44.2: i32 = converted %int.left_shift.loc40, %.loc40_44.1 [template = ] diff --git a/toolchain/check/testdata/builtins/int/less.carbon b/toolchain/check/testdata/builtins/int/less.carbon index aaf5cf7ab8b1..be28dce3503e 100644 --- a/toolchain/check/testdata/builtins/int/less.carbon +++ b/toolchain/check/testdata/builtins/int/less.carbon @@ -27,10 +27,16 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: --- int_less.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Less: type = fn_type @Less [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Less = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] @@ -38,34 +44,36 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.7: bool = bool_literal false [template] // CHECK:STDOUT: %.8: i32 = int_literal 0 [template] // CHECK:STDOUT: %.9: i32 = int_literal -1 [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Less = %Less -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Less = %Less.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Less: = fn_decl @Less [template] { +// CHECK:STDOUT: %Less.decl: Less = fn_decl @Less [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_9.1: i32 = param a // CHECK:STDOUT: @Less.%a: i32 = bind_name a, %a.loc2_9.1 // CHECK:STDOUT: %b.loc2_17.1: i32 = param b // CHECK:STDOUT: @Less.%b: i32 = bind_name b, %b.loc2_17.1 // CHECK:STDOUT: @Less.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc3_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc3_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -73,7 +81,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc16_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc16_16.1 // CHECK:STDOUT: %b.loc16_24.1: i32 = param b @@ -99,7 +107,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref.loc9: True = name_ref true_, %true_ -// CHECK:STDOUT: %Less.ref.loc9: = name_ref Less, file.%Less [template = file.%Less] +// CHECK:STDOUT: %Less.ref.loc9: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9_21: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_24: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %int.less.loc9: init bool = call %Less.ref.loc9(%.loc9_21, %.loc9_24) [template = constants.%.6] @@ -118,7 +126,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc10: False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc10: = name_ref Less, file.%Less [template = file.%Less] +// CHECK:STDOUT: %Less.ref.loc10: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_22: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_25: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.less.loc10: init bool = call %Less.ref.loc10(%.loc10_22, %.loc10_25) [template = constants.%.7] @@ -137,7 +145,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_14.3: type = block_arg !if.expr.result.loc10 [template = constants.%False] // CHECK:STDOUT: %false_.ref.loc11: False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc11: = name_ref Less, file.%Less [template = file.%Less] +// CHECK:STDOUT: %Less.ref.loc11: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc11_22: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_25: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %int.less.loc11: init bool = call %Less.ref.loc11(%.loc11_22, %.loc11_25) [template = constants.%.7] @@ -156,8 +164,8 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc12: True = name_ref true_, %true_ -// CHECK:STDOUT: %Less.ref.loc12: = name_ref Less, file.%Less [template = file.%Less] -// CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Less.ref.loc12: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_28: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_28) [template = constants.%.9] // CHECK:STDOUT: %.loc12_32: i32 = int_literal 0 [template = constants.%.8] @@ -179,9 +187,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc13: False = name_ref false_, %false_ -// CHECK:STDOUT: %Less.ref.loc13: = name_ref Less, file.%Less [template = file.%Less] +// CHECK:STDOUT: %Less.ref.loc13: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc13_22: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %Negate.ref.loc13: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_32: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_32) [template = constants.%.9] // CHECK:STDOUT: %.loc13_21.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.9] @@ -206,7 +214,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Less.ref: = name_ref Less, file.%Less [template = file.%Less] +// CHECK:STDOUT: %Less.ref: Less = name_ref Less, file.%Less.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.less: init bool = call %Less.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/less_eq.carbon b/toolchain/check/testdata/builtins/int/less_eq.carbon index 76796942efee..d195cd2f677a 100644 --- a/toolchain/check/testdata/builtins/int/less_eq.carbon +++ b/toolchain/check/testdata/builtins/int/less_eq.carbon @@ -27,10 +27,16 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: --- int_less_eq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %LessEq: type = fn_type @LessEq [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: LessEq = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] @@ -38,34 +44,36 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %.7: i32 = int_literal 0 [template] // CHECK:STDOUT: %.8: bool = bool_literal false [template] // CHECK:STDOUT: %.9: i32 = int_literal -1 [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.4: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .LessEq = %LessEq -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .LessEq = %LessEq.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %LessEq: = fn_decl @LessEq [template] { +// CHECK:STDOUT: %LessEq.decl: LessEq = fn_decl @LessEq [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_11.1: i32 = param a // CHECK:STDOUT: @LessEq.%a: i32 = bind_name a, %a.loc2_11.1 // CHECK:STDOUT: %b.loc2_19.1: i32 = param b // CHECK:STDOUT: @LessEq.%b: i32 = bind_name b, %b.loc2_19.1 // CHECK:STDOUT: @LessEq.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc3_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc3_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc8_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc8_6.1 @@ -73,7 +81,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.loc8_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc8_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc16_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc16_16.1 // CHECK:STDOUT: %b.loc16_24.1: i32 = param b @@ -99,7 +107,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %true_.ref.loc9: True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc9: = name_ref LessEq, file.%LessEq [template = file.%LessEq] +// CHECK:STDOUT: %LessEq.ref.loc9: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_26: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %int.less_eq.loc9: init bool = call %LessEq.ref.loc9(%.loc9_23, %.loc9_26) [template = constants.%.6] @@ -118,7 +126,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_13.3: type = block_arg !if.expr.result.loc9 [template = constants.%True] // CHECK:STDOUT: %true_.ref.loc10: True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc10: = name_ref LessEq, file.%LessEq [template = file.%LessEq] +// CHECK:STDOUT: %LessEq.ref.loc10: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_23: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_26: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.less_eq.loc10: init bool = call %LessEq.ref.loc10(%.loc10_23, %.loc10_26) [template = constants.%.6] @@ -137,7 +145,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc10: // CHECK:STDOUT: %.loc10_13.3: type = block_arg !if.expr.result.loc10 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc11: False = name_ref false_, %false_ -// CHECK:STDOUT: %LessEq.ref.loc11: = name_ref LessEq, file.%LessEq [template = file.%LessEq] +// CHECK:STDOUT: %LessEq.ref.loc11: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_27: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %int.less_eq.loc11: init bool = call %LessEq.ref.loc11(%.loc11_24, %.loc11_27) [template = constants.%.8] @@ -156,8 +164,8 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc11: // CHECK:STDOUT: %.loc11_14.3: type = block_arg !if.expr.result.loc11 [template = constants.%False] // CHECK:STDOUT: %true_.ref.loc12: True = name_ref true_, %true_ -// CHECK:STDOUT: %LessEq.ref.loc12: = name_ref LessEq, file.%LessEq [template = file.%LessEq] -// CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %LessEq.ref.loc12: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc12_30: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_30) [template = constants.%.9] // CHECK:STDOUT: %.loc12_34: i32 = int_literal 0 [template = constants.%.7] @@ -179,9 +187,9 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc12: // CHECK:STDOUT: %.loc12_13.3: type = block_arg !if.expr.result.loc12 [template = constants.%True] // CHECK:STDOUT: %false_.ref.loc13: False = name_ref false_, %false_ -// CHECK:STDOUT: %LessEq.ref.loc13: = name_ref LessEq, file.%LessEq [template = file.%LessEq] +// CHECK:STDOUT: %LessEq.ref.loc13: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc13_24: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %Negate.ref.loc13: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Negate.ref.loc13: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_34: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.snegate.loc13: init i32 = call %Negate.ref.loc13(%.loc13_34) [template = constants.%.9] // CHECK:STDOUT: %.loc13_23.1: i32 = value_of_initializer %int.snegate.loc13 [template = constants.%.9] @@ -206,7 +214,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %LessEq.ref: = name_ref LessEq, file.%LessEq [template = file.%LessEq] +// CHECK:STDOUT: %LessEq.ref: LessEq = name_ref LessEq, file.%LessEq.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.less_eq: init bool = call %LessEq.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/make_type_32.carbon b/toolchain/check/testdata/builtins/int/make_type_32.carbon index 71c0377d2d41..4d98a2376229 100644 --- a/toolchain/check/testdata/builtins/int/make_type_32.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_32.carbon @@ -20,13 +20,19 @@ var i: Int() = 0; // CHECK:STDOUT: --- types.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Int: type = fn_type @Int [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Int = %Int +// CHECK:STDOUT: .Int = %Int.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Int: = fn_decl @Int [template] { +// CHECK:STDOUT: %Int.decl: Int = fn_decl @Int [template = constants.%struct] { // CHECK:STDOUT: @Int.%return: ref type = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -36,7 +42,10 @@ var i: Int() = 0; // CHECK:STDOUT: --- use_types.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] +// CHECK:STDOUT: %Int: type = fn_type @Int [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -45,9 +54,9 @@ var i: Int() = 0; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .i = %i // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+3, loc_11 [template = imports.%Int] +// CHECK:STDOUT: %import_ref: Int = import_ref ir1, inst+3, loc_11 [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Int.ref: = name_ref Int, %import_ref [template = imports.%Int] +// CHECK:STDOUT: %Int.ref: Int = name_ref Int, %import_ref [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call %Int.ref() [template = i32] // CHECK:STDOUT: %.loc6_12.1: type = value_of_initializer %int.make_type_32 [template = i32] // CHECK:STDOUT: %.loc6_12.2: type = converted %int.make_type_32, %.loc6_12.1 [template = i32] @@ -59,7 +68,7 @@ var i: Int() = 0; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc6: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc6: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign file.%i.var, %.loc6 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/make_type_signed.carbon b/toolchain/check/testdata/builtins/int/make_type_signed.carbon index 6d068281ca8d..db0e077c1264 100644 --- a/toolchain/check/testdata/builtins/int/make_type_signed.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_signed.carbon @@ -67,13 +67,19 @@ var m: Int(1000000000); // CHECK:STDOUT: --- types.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Int: type = fn_type @Int [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Int = %Int +// CHECK:STDOUT: .Int = %Int.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Int: = fn_decl @Int [template] { +// CHECK:STDOUT: %Int.decl: Int = fn_decl @Int [template = constants.%struct] { // CHECK:STDOUT: %n.loc4_8.1: i32 = param n // CHECK:STDOUT: @Int.%n: i32 = bind_name n, %n.loc4_8.1 // CHECK:STDOUT: @Int.%return: ref type = var @@ -85,69 +91,78 @@ var m: Int(1000000000); // CHECK:STDOUT: --- use_types.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] -// CHECK:STDOUT: %.2: type = int_type signed, %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 13 [template] -// CHECK:STDOUT: %.4: type = int_type signed, %.3 [template] +// CHECK:STDOUT: %Int: type = fn_type @Int [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Int = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 64 [template] +// CHECK:STDOUT: %.3: type = int_type signed, %.2 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.4: i32 = int_literal 13 [template] +// CHECK:STDOUT: %.5: type = int_type signed, %.4 [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.3: G = struct_value () [template] // CHECK:STDOUT: %N: i32 = bind_symbolic_name N 0 [symbolic] -// CHECK:STDOUT: %.5: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %.6: type = int_type signed, %N [symbolic] +// CHECK:STDOUT: %Symbolic: type = fn_type @Symbolic [template] +// CHECK:STDOUT: %struct.4: Symbolic = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Int = %import_ref // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .Symbolic = %Symbolic +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .Symbolic = %Symbolic.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+5, loc_13 [template = imports.%Int] +// CHECK:STDOUT: %import_ref: Int = import_ref ir1, inst+5, loc_13 [template = constants.%struct.1] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %Int.ref.loc6_9: = name_ref Int, %import_ref [template = imports.%Int] -// CHECK:STDOUT: %.loc6_13: i32 = int_literal 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc6_12: init type = call %Int.ref.loc6_9(%.loc6_13) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_15.1: type = value_of_initializer %int.make_type_signed.loc6_12 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_15.2: type = converted %int.make_type_signed.loc6_12, %.loc6_15.1 [template = constants.%.2] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %Int.ref.loc6_9: Int = name_ref Int, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %.loc6_13: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_signed.loc6_12: init type = call %Int.ref.loc6_9(%.loc6_13) [template = constants.%.3] +// CHECK:STDOUT: %.loc6_15.1: type = value_of_initializer %int.make_type_signed.loc6_12 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_15.2: type = converted %int.make_type_signed.loc6_12, %.loc6_15.1 [template = constants.%.3] // CHECK:STDOUT: %n.loc6_6.1: i64 = param n // CHECK:STDOUT: @F.%n: i64 = bind_name n, %n.loc6_6.1 -// CHECK:STDOUT: %Int.ref.loc6_21: = name_ref Int, %import_ref [template = imports.%Int] -// CHECK:STDOUT: %.loc6_25: i32 = int_literal 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_signed.loc6_24: init type = call %Int.ref.loc6_21(%.loc6_25) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_27.1: type = value_of_initializer %int.make_type_signed.loc6_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_27.2: type = converted %int.make_type_signed.loc6_24, %.loc6_27.1 [template = constants.%.2] +// CHECK:STDOUT: %Int.ref.loc6_21: Int = name_ref Int, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %.loc6_25: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_signed.loc6_24: init type = call %Int.ref.loc6_21(%.loc6_25) [template = constants.%.3] +// CHECK:STDOUT: %.loc6_27.1: type = value_of_initializer %int.make_type_signed.loc6_24 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_27.2: type = converted %int.make_type_signed.loc6_24, %.loc6_27.1 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref i64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { -// CHECK:STDOUT: %Int.ref.loc10_9: = name_ref Int, %import_ref [template = imports.%Int] -// CHECK:STDOUT: %.loc10_13: i32 = int_literal 13 [template = constants.%.3] -// CHECK:STDOUT: %int.make_type_signed.loc10_12: init type = call %Int.ref.loc10_9(%.loc10_13) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_15.1: type = value_of_initializer %int.make_type_signed.loc10_12 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_15.2: type = converted %int.make_type_signed.loc10_12, %.loc10_15.1 [template = constants.%.4] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { +// CHECK:STDOUT: %Int.ref.loc10_9: Int = name_ref Int, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %.loc10_13: i32 = int_literal 13 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_signed.loc10_12: init type = call %Int.ref.loc10_9(%.loc10_13) [template = constants.%.5] +// CHECK:STDOUT: %.loc10_15.1: type = value_of_initializer %int.make_type_signed.loc10_12 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_15.2: type = converted %int.make_type_signed.loc10_12, %.loc10_15.1 [template = constants.%.5] // CHECK:STDOUT: %n.loc10_6.1: i13 = param n // CHECK:STDOUT: @G.%n: i13 = bind_name n, %n.loc10_6.1 -// CHECK:STDOUT: %Int.ref.loc10_21: = name_ref Int, %import_ref [template = imports.%Int] -// CHECK:STDOUT: %.loc10_25: i32 = int_literal 13 [template = constants.%.3] -// CHECK:STDOUT: %int.make_type_signed.loc10_24: init type = call %Int.ref.loc10_21(%.loc10_25) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_27.1: type = value_of_initializer %int.make_type_signed.loc10_24 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_27.2: type = converted %int.make_type_signed.loc10_24, %.loc10_27.1 [template = constants.%.4] +// CHECK:STDOUT: %Int.ref.loc10_21: Int = name_ref Int, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %.loc10_25: i32 = int_literal 13 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_signed.loc10_24: init type = call %Int.ref.loc10_21(%.loc10_25) [template = constants.%.5] +// CHECK:STDOUT: %.loc10_27.1: type = value_of_initializer %int.make_type_signed.loc10_24 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_27.2: type = converted %int.make_type_signed.loc10_24, %.loc10_27.1 [template = constants.%.5] // CHECK:STDOUT: @G.%return: ref i13 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Symbolic: = fn_decl @Symbolic [template] { +// CHECK:STDOUT: %Symbolic.decl: Symbolic = fn_decl @Symbolic [template = constants.%struct.4] { // CHECK:STDOUT: %N.loc14_13.1: i32 = param N // CHECK:STDOUT: @Symbolic.%N: i32 = bind_symbolic_name N 0, %N.loc14_13.1 [symbolic = constants.%N] -// CHECK:STDOUT: %Int.ref.loc14_25: = name_ref Int, %import_ref [template = imports.%Int] +// CHECK:STDOUT: %Int.ref.loc14_25: Int = name_ref Int, %import_ref [template = constants.%struct.1] // CHECK:STDOUT: %N.ref.loc14_29: i32 = name_ref N, @Symbolic.%N [symbolic = constants.%N] -// CHECK:STDOUT: %int.make_type_signed.loc14_28: init type = call %Int.ref.loc14_25(%N.ref.loc14_29) [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_30.1: type = value_of_initializer %int.make_type_signed.loc14_28 [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_30.2: type = converted %int.make_type_signed.loc14_28, %.loc14_30.1 [symbolic = constants.%.5] +// CHECK:STDOUT: %int.make_type_signed.loc14_28: init type = call %Int.ref.loc14_25(%N.ref.loc14_29) [symbolic = constants.%.6] +// CHECK:STDOUT: %.loc14_30.1: type = value_of_initializer %int.make_type_signed.loc14_28 [symbolic = constants.%.6] +// CHECK:STDOUT: %.loc14_30.2: type = converted %int.make_type_signed.loc14_28, %.loc14_30.1 [symbolic = constants.%.6] // CHECK:STDOUT: %x.loc14_22.1: Core.Int(N) = param x // CHECK:STDOUT: @Symbolic.%x: Core.Int(N) = bind_name x, %x.loc14_22.1 -// CHECK:STDOUT: %Int.ref.loc14_36: = name_ref Int, %import_ref [template = imports.%Int] +// CHECK:STDOUT: %Int.ref.loc14_36: Int = name_ref Int, %import_ref [template = constants.%struct.1] // CHECK:STDOUT: %N.ref.loc14_40: i32 = name_ref N, @Symbolic.%N [symbolic = constants.%N] -// CHECK:STDOUT: %int.make_type_signed.loc14_39: init type = call %Int.ref.loc14_36(%N.ref.loc14_40) [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_41.1: type = value_of_initializer %int.make_type_signed.loc14_39 [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_41.2: type = converted %int.make_type_signed.loc14_39, %.loc14_41.1 [symbolic = constants.%.5] +// CHECK:STDOUT: %int.make_type_signed.loc14_39: init type = call %Int.ref.loc14_36(%N.ref.loc14_40) [symbolic = constants.%.6] +// CHECK:STDOUT: %.loc14_41.1: type = value_of_initializer %int.make_type_signed.loc14_39 [symbolic = constants.%.6] +// CHECK:STDOUT: %.loc14_41.2: type = converted %int.make_type_signed.loc14_39, %.loc14_41.1 [symbolic = constants.%.6] // CHECK:STDOUT: @Symbolic.%return: ref Core.Int(N) = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -175,7 +190,10 @@ var m: Int(1000000000); // CHECK:STDOUT: --- fail_zero_size.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] +// CHECK:STDOUT: %Int: type = fn_type @Int [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -184,10 +202,10 @@ var m: Int(1000000000); // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .n = %n // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+5, loc_11 [template = imports.%Int] +// CHECK:STDOUT: %import_ref: Int = import_ref ir1, inst+5, loc_11 [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Int.ref: = name_ref Int, %import_ref [template = imports.%Int] -// CHECK:STDOUT: %.loc10_12: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %Int.ref: Int = name_ref Int, %import_ref [template = constants.%struct] +// CHECK:STDOUT: %.loc10_12: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_signed: init type = call %Int.ref(%.loc10_12) [template = ] // CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %int.make_type_signed [template = ] // CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_signed, %.loc10_13.1 [template = ] @@ -200,30 +218,35 @@ var m: Int(1000000000); // CHECK:STDOUT: --- fail_negative_size.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -1 [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Negate = struct_value () [template] +// CHECK:STDOUT: %Int: type = fn_type @Int [template] +// CHECK:STDOUT: %struct.2: Int = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Int = %import_ref // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .n = %n.loc12 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+5, loc_23 [template = imports.%Int] +// CHECK:STDOUT: %import_ref: Int = import_ref ir1, inst+5, loc_23 [template = constants.%struct.2] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { // CHECK:STDOUT: %n.loc6_11.1: i32 = param n // CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc6_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Int.ref: = name_ref Int, %import_ref [template = imports.%Int] -// CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc12_19: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_19) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_11.1: i32 = value_of_initializer %int.snegate [template = constants.%.2] -// CHECK:STDOUT: %.loc12_11.2: i32 = converted %int.snegate, %.loc12_11.1 [template = constants.%.2] +// CHECK:STDOUT: %Int.ref: Int = name_ref Int, %import_ref [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc12_19: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_19) [template = constants.%.3] +// CHECK:STDOUT: %.loc12_11.1: i32 = value_of_initializer %int.snegate [template = constants.%.3] +// CHECK:STDOUT: %.loc12_11.2: i32 = converted %int.snegate, %.loc12_11.1 [template = constants.%.3] // CHECK:STDOUT: %int.make_type_signed: init type = call %Int.ref(%.loc12_11.2) [template = ] // CHECK:STDOUT: %.loc12_21.1: type = value_of_initializer %int.make_type_signed [template = ] // CHECK:STDOUT: %.loc12_21.2: type = converted %int.make_type_signed, %.loc12_21.1 [template = ] @@ -238,7 +261,10 @@ var m: Int(1000000000); // CHECK:STDOUT: --- fail_oversized.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1000000000 [template] +// CHECK:STDOUT: %Int: type = fn_type @Int [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Int = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1000000000 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -247,10 +273,10 @@ var m: Int(1000000000); // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .m = %m // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+5, loc_11 [template = imports.%Int] +// CHECK:STDOUT: %import_ref: Int = import_ref ir1, inst+5, loc_11 [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Int.ref: = name_ref Int, %import_ref [template = imports.%Int] -// CHECK:STDOUT: %.loc9_12: i32 = int_literal 1000000000 [template = constants.%.1] +// CHECK:STDOUT: %Int.ref: Int = name_ref Int, %import_ref [template = constants.%struct] +// CHECK:STDOUT: %.loc9_12: i32 = int_literal 1000000000 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_signed: init type = call %Int.ref(%.loc9_12) [template = ] // CHECK:STDOUT: %.loc9_22.1: type = value_of_initializer %int.make_type_signed [template = ] // CHECK:STDOUT: %.loc9_22.2: type = converted %int.make_type_signed, %.loc9_22.1 [template = ] diff --git a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon index 3a105421ab74..fad3f7a8d2b1 100644 --- a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon @@ -67,13 +67,19 @@ var m: UInt(1000000000); // CHECK:STDOUT: --- types.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %UInt: type = fn_type @UInt [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: UInt = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .UInt = %UInt +// CHECK:STDOUT: .UInt = %UInt.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %UInt: = fn_decl @UInt [template] { +// CHECK:STDOUT: %UInt.decl: UInt = fn_decl @UInt [template = constants.%struct] { // CHECK:STDOUT: %n.loc4_9.1: i32 = param n // CHECK:STDOUT: @UInt.%n: i32 = bind_name n, %n.loc4_9.1 // CHECK:STDOUT: @UInt.%return: ref type = var @@ -85,69 +91,78 @@ var m: UInt(1000000000); // CHECK:STDOUT: --- use_types.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 64 [template] -// CHECK:STDOUT: %.2: type = int_type unsigned, %.1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 13 [template] -// CHECK:STDOUT: %.4: type = int_type unsigned, %.3 [template] +// CHECK:STDOUT: %UInt: type = fn_type @UInt [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: UInt = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 64 [template] +// CHECK:STDOUT: %.3: type = int_type unsigned, %.2 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.4: i32 = int_literal 13 [template] +// CHECK:STDOUT: %.5: type = int_type unsigned, %.4 [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.3: G = struct_value () [template] // CHECK:STDOUT: %N: i32 = bind_symbolic_name N 0 [symbolic] -// CHECK:STDOUT: %.5: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %.6: type = int_type unsigned, %N [symbolic] +// CHECK:STDOUT: %Symbolic: type = fn_type @Symbolic [template] +// CHECK:STDOUT: %struct.4: Symbolic = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .UInt = %import_ref // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .Symbolic = %Symbolic +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .Symbolic = %Symbolic.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+5, loc_13 [template = imports.%UInt] +// CHECK:STDOUT: %import_ref: UInt = import_ref ir1, inst+5, loc_13 [template = constants.%struct.1] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %UInt.ref.loc6_9: = name_ref UInt, %import_ref [template = imports.%UInt] -// CHECK:STDOUT: %.loc6_14: i32 = int_literal 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_unsigned.loc6_13: init type = call %UInt.ref.loc6_9(%.loc6_14) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %int.make_type_unsigned.loc6_13 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_16.2: type = converted %int.make_type_unsigned.loc6_13, %.loc6_16.1 [template = constants.%.2] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { +// CHECK:STDOUT: %UInt.ref.loc6_9: UInt = name_ref UInt, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %.loc6_14: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_unsigned.loc6_13: init type = call %UInt.ref.loc6_9(%.loc6_14) [template = constants.%.3] +// CHECK:STDOUT: %.loc6_16.1: type = value_of_initializer %int.make_type_unsigned.loc6_13 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_16.2: type = converted %int.make_type_unsigned.loc6_13, %.loc6_16.1 [template = constants.%.3] // CHECK:STDOUT: %n.loc6_6.1: u64 = param n // CHECK:STDOUT: @F.%n: u64 = bind_name n, %n.loc6_6.1 -// CHECK:STDOUT: %UInt.ref.loc6_22: = name_ref UInt, %import_ref [template = imports.%UInt] -// CHECK:STDOUT: %.loc6_27: i32 = int_literal 64 [template = constants.%.1] -// CHECK:STDOUT: %int.make_type_unsigned.loc6_26: init type = call %UInt.ref.loc6_22(%.loc6_27) [template = constants.%.2] -// CHECK:STDOUT: %.loc6_29.1: type = value_of_initializer %int.make_type_unsigned.loc6_26 [template = constants.%.2] -// CHECK:STDOUT: %.loc6_29.2: type = converted %int.make_type_unsigned.loc6_26, %.loc6_29.1 [template = constants.%.2] +// CHECK:STDOUT: %UInt.ref.loc6_22: UInt = name_ref UInt, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %.loc6_27: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_unsigned.loc6_26: init type = call %UInt.ref.loc6_22(%.loc6_27) [template = constants.%.3] +// CHECK:STDOUT: %.loc6_29.1: type = value_of_initializer %int.make_type_unsigned.loc6_26 [template = constants.%.3] +// CHECK:STDOUT: %.loc6_29.2: type = converted %int.make_type_unsigned.loc6_26, %.loc6_29.1 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref u64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { -// CHECK:STDOUT: %UInt.ref.loc10_9: = name_ref UInt, %import_ref [template = imports.%UInt] -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 13 [template = constants.%.3] -// CHECK:STDOUT: %int.make_type_unsigned.loc10_13: init type = call %UInt.ref.loc10_9(%.loc10_14) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_16.1: type = value_of_initializer %int.make_type_unsigned.loc10_13 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_16.2: type = converted %int.make_type_unsigned.loc10_13, %.loc10_16.1 [template = constants.%.4] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { +// CHECK:STDOUT: %UInt.ref.loc10_9: UInt = name_ref UInt, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 13 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_unsigned.loc10_13: init type = call %UInt.ref.loc10_9(%.loc10_14) [template = constants.%.5] +// CHECK:STDOUT: %.loc10_16.1: type = value_of_initializer %int.make_type_unsigned.loc10_13 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_16.2: type = converted %int.make_type_unsigned.loc10_13, %.loc10_16.1 [template = constants.%.5] // CHECK:STDOUT: %n.loc10_6.1: u13 = param n // CHECK:STDOUT: @G.%n: u13 = bind_name n, %n.loc10_6.1 -// CHECK:STDOUT: %UInt.ref.loc10_22: = name_ref UInt, %import_ref [template = imports.%UInt] -// CHECK:STDOUT: %.loc10_27: i32 = int_literal 13 [template = constants.%.3] -// CHECK:STDOUT: %int.make_type_unsigned.loc10_26: init type = call %UInt.ref.loc10_22(%.loc10_27) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_29.1: type = value_of_initializer %int.make_type_unsigned.loc10_26 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_29.2: type = converted %int.make_type_unsigned.loc10_26, %.loc10_29.1 [template = constants.%.4] +// CHECK:STDOUT: %UInt.ref.loc10_22: UInt = name_ref UInt, %import_ref [template = constants.%struct.1] +// CHECK:STDOUT: %.loc10_27: i32 = int_literal 13 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_unsigned.loc10_26: init type = call %UInt.ref.loc10_22(%.loc10_27) [template = constants.%.5] +// CHECK:STDOUT: %.loc10_29.1: type = value_of_initializer %int.make_type_unsigned.loc10_26 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_29.2: type = converted %int.make_type_unsigned.loc10_26, %.loc10_29.1 [template = constants.%.5] // CHECK:STDOUT: @G.%return: ref u13 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Symbolic: = fn_decl @Symbolic [template] { +// CHECK:STDOUT: %Symbolic.decl: Symbolic = fn_decl @Symbolic [template = constants.%struct.4] { // CHECK:STDOUT: %N.loc14_13.1: i32 = param N // CHECK:STDOUT: @Symbolic.%N: i32 = bind_symbolic_name N 0, %N.loc14_13.1 [symbolic = constants.%N] -// CHECK:STDOUT: %UInt.ref.loc14_25: = name_ref UInt, %import_ref [template = imports.%UInt] +// CHECK:STDOUT: %UInt.ref.loc14_25: UInt = name_ref UInt, %import_ref [template = constants.%struct.1] // CHECK:STDOUT: %N.ref.loc14_30: i32 = name_ref N, @Symbolic.%N [symbolic = constants.%N] -// CHECK:STDOUT: %int.make_type_unsigned.loc14_29: init type = call %UInt.ref.loc14_25(%N.ref.loc14_30) [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_31.1: type = value_of_initializer %int.make_type_unsigned.loc14_29 [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_31.2: type = converted %int.make_type_unsigned.loc14_29, %.loc14_31.1 [symbolic = constants.%.5] +// CHECK:STDOUT: %int.make_type_unsigned.loc14_29: init type = call %UInt.ref.loc14_25(%N.ref.loc14_30) [symbolic = constants.%.6] +// CHECK:STDOUT: %.loc14_31.1: type = value_of_initializer %int.make_type_unsigned.loc14_29 [symbolic = constants.%.6] +// CHECK:STDOUT: %.loc14_31.2: type = converted %int.make_type_unsigned.loc14_29, %.loc14_31.1 [symbolic = constants.%.6] // CHECK:STDOUT: %x.loc14_22.1: Core.UInt(N) = param x // CHECK:STDOUT: @Symbolic.%x: Core.UInt(N) = bind_name x, %x.loc14_22.1 -// CHECK:STDOUT: %UInt.ref.loc14_37: = name_ref UInt, %import_ref [template = imports.%UInt] +// CHECK:STDOUT: %UInt.ref.loc14_37: UInt = name_ref UInt, %import_ref [template = constants.%struct.1] // CHECK:STDOUT: %N.ref.loc14_42: i32 = name_ref N, @Symbolic.%N [symbolic = constants.%N] -// CHECK:STDOUT: %int.make_type_unsigned.loc14_41: init type = call %UInt.ref.loc14_37(%N.ref.loc14_42) [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_43.1: type = value_of_initializer %int.make_type_unsigned.loc14_41 [symbolic = constants.%.5] -// CHECK:STDOUT: %.loc14_43.2: type = converted %int.make_type_unsigned.loc14_41, %.loc14_43.1 [symbolic = constants.%.5] +// CHECK:STDOUT: %int.make_type_unsigned.loc14_41: init type = call %UInt.ref.loc14_37(%N.ref.loc14_42) [symbolic = constants.%.6] +// CHECK:STDOUT: %.loc14_43.1: type = value_of_initializer %int.make_type_unsigned.loc14_41 [symbolic = constants.%.6] +// CHECK:STDOUT: %.loc14_43.2: type = converted %int.make_type_unsigned.loc14_41, %.loc14_43.1 [symbolic = constants.%.6] // CHECK:STDOUT: @Symbolic.%return: ref Core.UInt(N) = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -175,7 +190,10 @@ var m: UInt(1000000000); // CHECK:STDOUT: --- fail_zero_size.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] +// CHECK:STDOUT: %UInt: type = fn_type @UInt [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: UInt = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -184,10 +202,10 @@ var m: UInt(1000000000); // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .n = %n // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+5, loc_11 [template = imports.%UInt] +// CHECK:STDOUT: %import_ref: UInt = import_ref ir1, inst+5, loc_11 [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %UInt.ref: = name_ref UInt, %import_ref [template = imports.%UInt] -// CHECK:STDOUT: %.loc10_13: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %UInt.ref: UInt = name_ref UInt, %import_ref [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_unsigned: init type = call %UInt.ref(%.loc10_13) [template = ] // CHECK:STDOUT: %.loc10_14.1: type = value_of_initializer %int.make_type_unsigned [template = ] // CHECK:STDOUT: %.loc10_14.2: type = converted %int.make_type_unsigned, %.loc10_14.1 [template = ] @@ -200,30 +218,35 @@ var m: UInt(1000000000); // CHECK:STDOUT: --- fail_negative_size.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -1 [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Negate = struct_value () [template] +// CHECK:STDOUT: %UInt: type = fn_type @UInt [template] +// CHECK:STDOUT: %struct.2: UInt = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .UInt = %import_ref // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .n = %n.loc12 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+5, loc_23 [template = imports.%UInt] +// CHECK:STDOUT: %import_ref: UInt = import_ref ir1, inst+5, loc_23 [template = constants.%struct.2] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { // CHECK:STDOUT: %n.loc6_11.1: i32 = param n // CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc6_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %UInt.ref: = name_ref UInt, %import_ref [template = imports.%UInt] -// CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc12_20: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_20) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_12.1: i32 = value_of_initializer %int.snegate [template = constants.%.2] -// CHECK:STDOUT: %.loc12_12.2: i32 = converted %int.snegate, %.loc12_12.1 [template = constants.%.2] +// CHECK:STDOUT: %UInt.ref: UInt = name_ref UInt, %import_ref [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc12_20: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_20) [template = constants.%.3] +// CHECK:STDOUT: %.loc12_12.1: i32 = value_of_initializer %int.snegate [template = constants.%.3] +// CHECK:STDOUT: %.loc12_12.2: i32 = converted %int.snegate, %.loc12_12.1 [template = constants.%.3] // CHECK:STDOUT: %int.make_type_unsigned: init type = call %UInt.ref(%.loc12_12.2) [template = ] // CHECK:STDOUT: %.loc12_22.1: type = value_of_initializer %int.make_type_unsigned [template = ] // CHECK:STDOUT: %.loc12_22.2: type = converted %int.make_type_unsigned, %.loc12_22.1 [template = ] @@ -238,7 +261,10 @@ var m: UInt(1000000000); // CHECK:STDOUT: --- fail_oversized.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1000000000 [template] +// CHECK:STDOUT: %UInt: type = fn_type @UInt [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: UInt = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1000000000 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -247,10 +273,10 @@ var m: UInt(1000000000); // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .m = %m // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+5, loc_11 [template = imports.%UInt] +// CHECK:STDOUT: %import_ref: UInt = import_ref ir1, inst+5, loc_11 [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %UInt.ref: = name_ref UInt, %import_ref [template = imports.%UInt] -// CHECK:STDOUT: %.loc9_13: i32 = int_literal 1000000000 [template = constants.%.1] +// CHECK:STDOUT: %UInt.ref: UInt = name_ref UInt, %import_ref [template = constants.%struct] +// CHECK:STDOUT: %.loc9_13: i32 = int_literal 1000000000 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_unsigned: init type = call %UInt.ref(%.loc9_13) [template = ] // CHECK:STDOUT: %.loc9_23.1: type = value_of_initializer %int.make_type_unsigned [template = ] // CHECK:STDOUT: %.loc9_23.2: type = converted %int.make_type_unsigned, %.loc9_23.1 [template = ] diff --git a/toolchain/check/testdata/builtins/int/neq.carbon b/toolchain/check/testdata/builtins/int/neq.carbon index 223432d3fff4..da15567bac77 100644 --- a/toolchain/check/testdata/builtins/int/neq.carbon +++ b/toolchain/check/testdata/builtins/int/neq.carbon @@ -23,28 +23,34 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: --- int_neq.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Neq: type = fn_type @Neq [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Neq = struct_value () [template] // CHECK:STDOUT: %True: type = class_type @True [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %False: type = class_type @False [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: bool = bool_literal false [template] // CHECK:STDOUT: %.6: i32 = int_literal 2 [template] // CHECK:STDOUT: %.7: bool = bool_literal true [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.3: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Neq = %Neq +// CHECK:STDOUT: .Neq = %Neq.decl // CHECK:STDOUT: .True = %True.decl // CHECK:STDOUT: .False = %False.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Neq: = fn_decl @Neq [template] { +// CHECK:STDOUT: %Neq.decl: Neq = fn_decl @Neq [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Neq.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b @@ -53,7 +59,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: %True.decl: type = class_decl @True [template = constants.%True] {} // CHECK:STDOUT: %False.decl: type = class_decl @False [template = constants.%False] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %True.ref: type = name_ref True, %True.decl [template = constants.%True] // CHECK:STDOUT: %true_.loc7_6.1: True = param true_ // CHECK:STDOUT: @F.%true_: True = bind_name true_, %true_.loc7_6.1 @@ -61,7 +67,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: %false_.loc7_19.1: False = param false_ // CHECK:STDOUT: @F.%false_: False = bind_name false_, %false_.loc7_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc12_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc12_16.1 // CHECK:STDOUT: %b.loc12_24.1: i32 = param b @@ -85,7 +91,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: fn @F(%true_: True, %false_: False) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %false_.ref: False = name_ref false_, %false_ -// CHECK:STDOUT: %Neq.ref.loc8: = name_ref Neq, file.%Neq [template = file.%Neq] +// CHECK:STDOUT: %Neq.ref.loc8: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc8_21: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc8_24: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %int.neq.loc8: init bool = call %Neq.ref.loc8(%.loc8_21, %.loc8_24) [template = constants.%.5] @@ -104,7 +110,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: !if.expr.result.loc8: // CHECK:STDOUT: %.loc8_14.3: type = block_arg !if.expr.result.loc8 [template = constants.%False] // CHECK:STDOUT: %true_.ref: True = name_ref true_, %true_ -// CHECK:STDOUT: %Neq.ref.loc9: = name_ref Neq, file.%Neq [template = file.%Neq] +// CHECK:STDOUT: %Neq.ref.loc9: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9_20: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc9_23: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %int.neq.loc9: init bool = call %Neq.ref.loc9(%.loc9_20, %.loc9_23) [template = constants.%.7] @@ -127,7 +133,7 @@ fn RuntimeCall(a: i32, b: i32) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Neq.ref: = name_ref Neq, file.%Neq [template = file.%Neq] +// CHECK:STDOUT: %Neq.ref: Neq = name_ref Neq, file.%Neq.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.neq: init bool = call %Neq.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/or.carbon b/toolchain/check/testdata/builtins/int/or.carbon index 64a099e45abe..1be60c8ccbc8 100644 --- a/toolchain/check/testdata/builtins/int/or.carbon +++ b/toolchain/check/testdata/builtins/int/or.carbon @@ -18,42 +18,47 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: --- int_or.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 10 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 14 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 14] [template] +// CHECK:STDOUT: %Or: type = fn_type @Or [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Or = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 10 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 14 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 14] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Or = %Or +// CHECK:STDOUT: .Or = %Or.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Or: = fn_decl @Or [template] { +// CHECK:STDOUT: %Or.decl: Or = fn_decl @Or [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_7.1: i32 = param a // CHECK:STDOUT: @Or.%a: i32 = bind_name a, %a.loc2_7.1 // CHECK:STDOUT: %b.loc2_15.1: i32 = param b // CHECK:STDOUT: @Or.%b: i32 = bind_name b, %b.loc2_15.1 // CHECK:STDOUT: @Or.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Or.ref: = name_ref Or, %Or [template = %Or] -// CHECK:STDOUT: %.loc4_19: i32 = int_literal 12 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_literal 10 [template = constants.%.2] -// CHECK:STDOUT: %int.or: init i32 = call %Or.ref(%.loc4_19, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_26: type = array_type %int.or, i32 [template = constants.%.4] +// CHECK:STDOUT: %Or.ref: Or = name_ref Or, %Or.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_19: i32 = int_literal 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_23: i32 = int_literal 10 [template = constants.%.3] +// CHECK:STDOUT: %int.or: init i32 = call %Or.ref(%.loc4_19, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_26: type = array_type %int.or, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 14] = var arr // CHECK:STDOUT: %arr: ref [i32; 14] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 14 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_20: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_21: type = ptr_type [i32; 14] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 14 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_20: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_21: type = ptr_type [i32; 14] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 14] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_25: [i32; 14]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 14]* = bind_name arr_p, %.loc5_25 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -66,7 +71,7 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Or.ref: = name_ref Or, file.%Or [template = file.%Or] +// CHECK:STDOUT: %Or.ref: Or = name_ref Or, file.%Or.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.or: init i32 = call %Or.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/builtins/int/right_shift.carbon b/toolchain/check/testdata/builtins/int/right_shift.carbon index 1cb9304ede4c..d223fd1d9dec 100644 --- a/toolchain/check/testdata/builtins/int/right_shift.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift.carbon @@ -63,42 +63,47 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: --- int_right_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 22 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 5] [template] +// CHECK:STDOUT: %RightShift: type = fn_type @RightShift [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: RightShift = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 22 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 5] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .RightShift = %RightShift +// CHECK:STDOUT: .RightShift = %RightShift.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %RightShift: = fn_decl @RightShift [template] { +// CHECK:STDOUT: %RightShift.decl: RightShift = fn_decl @RightShift [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_15.1: i32 = param a // CHECK:STDOUT: @RightShift.%a: i32 = bind_name a, %a.loc2_15.1 // CHECK:STDOUT: %b.loc2_23.1: i32 = param b // CHECK:STDOUT: @RightShift.%b: i32 = bind_name b, %b.loc2_23.1 // CHECK:STDOUT: @RightShift.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RightShift.ref: = name_ref RightShift, %RightShift [template = %RightShift] -// CHECK:STDOUT: %.loc4_27: i32 = int_literal 22 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_31: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.right_shift: init i32 = call %RightShift.ref(%.loc4_27, %.loc4_31) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_33: type = array_type %int.right_shift, i32 [template = constants.%.4] +// CHECK:STDOUT: %RightShift.ref: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_27: i32 = int_literal 22 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_31: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.right_shift: init i32 = call %RightShift.ref(%.loc4_27, %.loc4_31) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_33: type = array_type %int.right_shift, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 5] = var arr // CHECK:STDOUT: %arr: ref [i32; 5] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 5 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 5] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 5 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 5] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 5] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 5]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 5]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -111,7 +116,7 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %RightShift.ref: = name_ref RightShift, file.%RightShift [template = file.%RightShift] +// CHECK:STDOUT: %RightShift.ref: RightShift = name_ref RightShift, file.%RightShift.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.right_shift: init i32 = call %RightShift.ref(%a.ref, %b.ref) @@ -123,79 +128,84 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: --- arith_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -1 [template] -// CHECK:STDOUT: %.3: type = array_type %.1, i32 [template] -// CHECK:STDOUT: %.4: type = ptr_type [i32; 1] [template] -// CHECK:STDOUT: %.5: i32 = int_literal 10 [template] -// CHECK:STDOUT: %.6: i32 = int_literal -10 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.8: i32 = int_literal -3 [template] -// CHECK:STDOUT: %.9: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.10: type = array_type %.9, i32 [template] -// CHECK:STDOUT: %.11: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %RightShift: type = fn_type @RightShift [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: RightShift = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -1 [template] +// CHECK:STDOUT: %.4: type = array_type %.2, i32 [template] +// CHECK:STDOUT: %.5: type = ptr_type [i32; 1] [template] +// CHECK:STDOUT: %.6: i32 = int_literal 10 [template] +// CHECK:STDOUT: %.7: i32 = int_literal -10 [template] +// CHECK:STDOUT: %.8: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.9: i32 = int_literal -3 [template] +// CHECK:STDOUT: %.10: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.11: type = array_type %.10, i32 [template] +// CHECK:STDOUT: %.12: type = ptr_type [i32; 3] [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .RightShift = %RightShift -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .RightShift = %RightShift.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .arr1 = %arr1 // CHECK:STDOUT: .arr2 = %arr2 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %RightShift: = fn_decl @RightShift [template] { +// CHECK:STDOUT: %RightShift.decl: RightShift = fn_decl @RightShift [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc6_15.1: i32 = param a // CHECK:STDOUT: @RightShift.%a: i32 = bind_name a, %a.loc6_15.1 // CHECK:STDOUT: %b.loc6_23.1: i32 = param b // CHECK:STDOUT: @RightShift.%b: i32 = bind_name b, %b.loc6_23.1 // CHECK:STDOUT: @RightShift.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc7_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref.loc10_17: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %RightShift.ref.loc10: = name_ref RightShift, %RightShift [template = %RightShift] -// CHECK:STDOUT: %Negate.ref.loc10_35: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc10_42: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc10_41: init i32 = call %Negate.ref.loc10_35(%.loc10_42) [template = constants.%.2] -// CHECK:STDOUT: %.loc10_46: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_34.1: i32 = value_of_initializer %int.snegate.loc10_41 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_34.2: i32 = converted %int.snegate.loc10_41, %.loc10_34.1 [template = constants.%.2] -// CHECK:STDOUT: %int.right_shift.loc10: init i32 = call %RightShift.ref.loc10(%.loc10_34.2, %.loc10_46) [template = constants.%.2] -// CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %int.right_shift.loc10 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_23.2: i32 = converted %int.right_shift.loc10, %.loc10_23.1 [template = constants.%.2] -// CHECK:STDOUT: %int.snegate.loc10_23: init i32 = call %Negate.ref.loc10_17(%.loc10_23.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc10_49: type = array_type %int.snegate.loc10_23, i32 [template = constants.%.3] +// CHECK:STDOUT: %Negate.ref.loc10_17: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %RightShift.ref.loc10: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc10_35: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc10_42: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc10_41: init i32 = call %Negate.ref.loc10_35(%.loc10_42) [template = constants.%.3] +// CHECK:STDOUT: %.loc10_46: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_34.1: i32 = value_of_initializer %int.snegate.loc10_41 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_34.2: i32 = converted %int.snegate.loc10_41, %.loc10_34.1 [template = constants.%.3] +// CHECK:STDOUT: %int.right_shift.loc10: init i32 = call %RightShift.ref.loc10(%.loc10_34.2, %.loc10_46) [template = constants.%.3] +// CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %int.right_shift.loc10 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_23.2: i32 = converted %int.right_shift.loc10, %.loc10_23.1 [template = constants.%.3] +// CHECK:STDOUT: %int.snegate.loc10_23: init i32 = call %Negate.ref.loc10_17(%.loc10_23.2) [template = constants.%.2] +// CHECK:STDOUT: %.loc10_49: type = array_type %int.snegate.loc10_23, i32 [template = constants.%.4] // CHECK:STDOUT: %arr1.var: ref [i32; 1] = var arr1 // CHECK:STDOUT: %arr1: ref [i32; 1] = bind_name arr1, %arr1.var -// CHECK:STDOUT: %.loc11_19: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_20: type = array_type %.loc11_19, i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_21: type = ptr_type [i32; 1] [template = constants.%.4] +// CHECK:STDOUT: %.loc11_19: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_20: type = array_type %.loc11_19, i32 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_21: type = ptr_type [i32; 1] [template = constants.%.5] // CHECK:STDOUT: %arr1.ref: ref [i32; 1] = name_ref arr1, %arr1 // CHECK:STDOUT: %.loc11_25: [i32; 1]* = addr_of %arr1.ref // CHECK:STDOUT: %arr1_p: [i32; 1]* = bind_name arr1_p, %.loc11_25 -// CHECK:STDOUT: %Negate.ref.loc14_17: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %RightShift.ref.loc14: = name_ref RightShift, %RightShift [template = %RightShift] -// CHECK:STDOUT: %Negate.ref.loc14_35: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc14_42: i32 = int_literal 10 [template = constants.%.5] -// CHECK:STDOUT: %int.snegate.loc14_41: init i32 = call %Negate.ref.loc14_35(%.loc14_42) [template = constants.%.6] -// CHECK:STDOUT: %.loc14_47: i32 = int_literal 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc14_34.1: i32 = value_of_initializer %int.snegate.loc14_41 [template = constants.%.6] -// CHECK:STDOUT: %.loc14_34.2: i32 = converted %int.snegate.loc14_41, %.loc14_34.1 [template = constants.%.6] -// CHECK:STDOUT: %int.right_shift.loc14: init i32 = call %RightShift.ref.loc14(%.loc14_34.2, %.loc14_47) [template = constants.%.8] -// CHECK:STDOUT: %.loc14_23.1: i32 = value_of_initializer %int.right_shift.loc14 [template = constants.%.8] -// CHECK:STDOUT: %.loc14_23.2: i32 = converted %int.right_shift.loc14, %.loc14_23.1 [template = constants.%.8] -// CHECK:STDOUT: %int.snegate.loc14_23: init i32 = call %Negate.ref.loc14_17(%.loc14_23.2) [template = constants.%.9] -// CHECK:STDOUT: %.loc14_50: type = array_type %int.snegate.loc14_23, i32 [template = constants.%.10] +// CHECK:STDOUT: %Negate.ref.loc14_17: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %RightShift.ref.loc14: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc14_35: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc14_42: i32 = int_literal 10 [template = constants.%.6] +// CHECK:STDOUT: %int.snegate.loc14_41: init i32 = call %Negate.ref.loc14_35(%.loc14_42) [template = constants.%.7] +// CHECK:STDOUT: %.loc14_47: i32 = int_literal 2 [template = constants.%.8] +// CHECK:STDOUT: %.loc14_34.1: i32 = value_of_initializer %int.snegate.loc14_41 [template = constants.%.7] +// CHECK:STDOUT: %.loc14_34.2: i32 = converted %int.snegate.loc14_41, %.loc14_34.1 [template = constants.%.7] +// CHECK:STDOUT: %int.right_shift.loc14: init i32 = call %RightShift.ref.loc14(%.loc14_34.2, %.loc14_47) [template = constants.%.9] +// CHECK:STDOUT: %.loc14_23.1: i32 = value_of_initializer %int.right_shift.loc14 [template = constants.%.9] +// CHECK:STDOUT: %.loc14_23.2: i32 = converted %int.right_shift.loc14, %.loc14_23.1 [template = constants.%.9] +// CHECK:STDOUT: %int.snegate.loc14_23: init i32 = call %Negate.ref.loc14_17(%.loc14_23.2) [template = constants.%.10] +// CHECK:STDOUT: %.loc14_50: type = array_type %int.snegate.loc14_23, i32 [template = constants.%.11] // CHECK:STDOUT: %arr2.var: ref [i32; 3] = var arr2 // CHECK:STDOUT: %arr2: ref [i32; 3] = bind_name arr2, %arr2.var -// CHECK:STDOUT: %.loc15_19: i32 = int_literal 3 [template = constants.%.9] -// CHECK:STDOUT: %.loc15_20: type = array_type %.loc15_19, i32 [template = constants.%.10] -// CHECK:STDOUT: %.loc15_21: type = ptr_type [i32; 3] [template = constants.%.11] +// CHECK:STDOUT: %.loc15_19: i32 = int_literal 3 [template = constants.%.10] +// CHECK:STDOUT: %.loc15_20: type = array_type %.loc15_19, i32 [template = constants.%.11] +// CHECK:STDOUT: %.loc15_21: type = ptr_type [i32; 3] [template = constants.%.12] // CHECK:STDOUT: %arr2.ref: ref [i32; 3] = name_ref arr2, %arr2 // CHECK:STDOUT: %.loc15_25: [i32; 3]* = addr_of %arr2.ref // CHECK:STDOUT: %arr2_p: [i32; 3]* = bind_name arr2_p, %.loc15_25 @@ -208,61 +218,66 @@ let negative: i32 = RightShift(1, Negate(1)); // CHECK:STDOUT: --- fail_bad_shift.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 31 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 32 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 33 [template] -// CHECK:STDOUT: %.6: i32 = int_literal -1 [template] +// CHECK:STDOUT: %RightShift: type = fn_type @RightShift [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: RightShift = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.2: Negate = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 31 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 32 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 33 [template] +// CHECK:STDOUT: %.7: i32 = int_literal -1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .RightShift = %RightShift -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .RightShift = %RightShift.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %RightShift: = fn_decl @RightShift [template] { +// CHECK:STDOUT: %RightShift.decl: RightShift = fn_decl @RightShift [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc4_15.1: i32 = param a // CHECK:STDOUT: @RightShift.%a: i32 = bind_name a, %a.loc4_15.1 // CHECK:STDOUT: %b.loc4_23.1: i32 = param b // CHECK:STDOUT: @RightShift.%b: i32 = bind_name b, %b.loc4_23.1 // CHECK:STDOUT: @RightShift.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc5_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc5_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RightShift.ref.loc8: = name_ref RightShift, %RightShift [template = %RightShift] -// CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_33: i32 = int_literal 31 [template = constants.%.2] -// CHECK:STDOUT: %int.right_shift.loc8: init i32 = call %RightShift.ref.loc8(%.loc8_30, %.loc8_33) [template = constants.%.3] -// CHECK:STDOUT: %.loc8_36.1: i32 = value_of_initializer %int.right_shift.loc8 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_36.2: i32 = converted %int.right_shift.loc8, %.loc8_36.1 [template = constants.%.3] +// CHECK:STDOUT: %RightShift.ref.loc8: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_33: i32 = int_literal 31 [template = constants.%.3] +// CHECK:STDOUT: %int.right_shift.loc8: init i32 = call %RightShift.ref.loc8(%.loc8_30, %.loc8_33) [template = constants.%.4] +// CHECK:STDOUT: %.loc8_36.1: i32 = value_of_initializer %int.right_shift.loc8 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_36.2: i32 = converted %int.right_shift.loc8, %.loc8_36.1 [template = constants.%.4] // CHECK:STDOUT: %size_1: i32 = bind_name size_1, %.loc8_36.2 -// CHECK:STDOUT: %RightShift.ref.loc13: = name_ref RightShift, %RightShift [template = %RightShift] -// CHECK:STDOUT: %.loc13_30: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc13_33: i32 = int_literal 32 [template = constants.%.4] +// CHECK:STDOUT: %RightShift.ref.loc13: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc13_30: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_33: i32 = int_literal 32 [template = constants.%.5] // CHECK:STDOUT: %int.right_shift.loc13: init i32 = call %RightShift.ref.loc13(%.loc13_30, %.loc13_33) [template = ] // CHECK:STDOUT: %.loc13_36.1: i32 = value_of_initializer %int.right_shift.loc13 [template = ] // CHECK:STDOUT: %.loc13_36.2: i32 = converted %int.right_shift.loc13, %.loc13_36.1 [template = ] // CHECK:STDOUT: %size_2: i32 = bind_name size_2, %.loc13_36.2 -// CHECK:STDOUT: %RightShift.ref.loc18: = name_ref RightShift, %RightShift [template = %RightShift] -// CHECK:STDOUT: %.loc18_30: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc18_33: i32 = int_literal 33 [template = constants.%.5] +// CHECK:STDOUT: %RightShift.ref.loc18: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18_30: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc18_33: i32 = int_literal 33 [template = constants.%.6] // CHECK:STDOUT: %int.right_shift.loc18: init i32 = call %RightShift.ref.loc18(%.loc18_30, %.loc18_33) [template = ] // CHECK:STDOUT: %.loc18_36.1: i32 = value_of_initializer %int.right_shift.loc18 [template = ] // CHECK:STDOUT: %.loc18_36.2: i32 = converted %int.right_shift.loc18, %.loc18_36.1 [template = ] // CHECK:STDOUT: %size_3: i32 = bind_name size_3, %.loc18_36.2 -// CHECK:STDOUT: %RightShift.ref.loc24: = name_ref RightShift, %RightShift [template = %RightShift] -// CHECK:STDOUT: %.loc24_32: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %Negate.ref: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc24_42: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc24_42) [template = constants.%.6] -// CHECK:STDOUT: %.loc24_31.1: i32 = value_of_initializer %int.snegate [template = constants.%.6] -// CHECK:STDOUT: %.loc24_31.2: i32 = converted %int.snegate, %.loc24_31.1 [template = constants.%.6] +// CHECK:STDOUT: %RightShift.ref.loc24: RightShift = name_ref RightShift, %RightShift.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc24_32: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc24_42: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc24_42) [template = constants.%.7] +// CHECK:STDOUT: %.loc24_31.1: i32 = value_of_initializer %int.snegate [template = constants.%.7] +// CHECK:STDOUT: %.loc24_31.2: i32 = converted %int.snegate, %.loc24_31.1 [template = constants.%.7] // CHECK:STDOUT: %int.right_shift.loc24: init i32 = call %RightShift.ref.loc24(%.loc24_32, %.loc24_31.2) [template = ] // CHECK:STDOUT: %.loc24_45.1: i32 = value_of_initializer %int.right_shift.loc24 [template = ] // CHECK:STDOUT: %.loc24_45.2: i32 = converted %int.right_shift.loc24, %.loc24_45.1 [template = ] diff --git a/toolchain/check/testdata/builtins/int/sadd.carbon b/toolchain/check/testdata/builtins/int/sadd.carbon index 8831c6c8483c..5d70428ad174 100644 --- a/toolchain/check/testdata/builtins/int/sadd.carbon +++ b/toolchain/check/testdata/builtins/int/sadd.carbon @@ -88,42 +88,47 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: --- int_add.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %Add: type = fn_type @Add [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Add = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Add = %Add +// CHECK:STDOUT: .Add = %Add.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Add: = fn_decl @Add [template] { +// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Add.ref: = name_ref Add, %Add [template = %Add] -// CHECK:STDOUT: %.loc4_20: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %int.sadd, i32 [template = constants.%.4] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_20: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.sadd, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 3] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 3] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 3] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 3]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 3]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -136,7 +141,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Add.ref: = name_ref Add, file.%Add [template = file.%Add] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, file.%Add.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%a.ref, %b.ref) @@ -148,33 +153,48 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] +// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] +// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] +// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] +// CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] +// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] +// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] +// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .TooFew = %TooFew -// CHECK:STDOUT: .TooMany = %TooMany -// CHECK:STDOUT: .BadReturnType = %BadReturnType -// CHECK:STDOUT: .JustRight = %JustRight +// CHECK:STDOUT: .TooFew = %TooFew.decl +// CHECK:STDOUT: .TooMany = %TooMany.decl +// CHECK:STDOUT: .BadReturnType = %BadReturnType.decl +// CHECK:STDOUT: .JustRight = %JustRight.decl // CHECK:STDOUT: .too_few = %too_few // CHECK:STDOUT: .too_many = %too_many // CHECK:STDOUT: .bad_return_type = %bad_return_type // CHECK:STDOUT: .bad_call = %bad_call -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType +// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl +// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl +// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew: = fn_decl @TooFew [template] { +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc8_11.1: i32 = param a // CHECK:STDOUT: @TooFew.%a: i32 = bind_name a, %a.loc8_11.1 // CHECK:STDOUT: @TooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany: = fn_decl @TooMany [template] { +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc13_12.1: i32 = param a // CHECK:STDOUT: @TooMany.%a: i32 = bind_name a, %a.loc13_12.1 // CHECK:STDOUT: %b.loc13_20.1: i32 = param b @@ -183,52 +203,52 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: @TooMany.%c: i32 = bind_name c, %c.loc13_28.1 // CHECK:STDOUT: @TooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType: = fn_decl @BadReturnType [template] { +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc18_18.1: i32 = param a // CHECK:STDOUT: @BadReturnType.%a: i32 = bind_name a, %a.loc18_18.1 // CHECK:STDOUT: %b.loc18_26.1: i32 = param b // CHECK:STDOUT: @BadReturnType.%b: i32 = bind_name b, %b.loc18_26.1 // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight: = fn_decl @JustRight [template] { +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc19_14.1: i32 = param a // CHECK:STDOUT: @JustRight.%a: i32 = bind_name a, %a.loc19_14.1 // CHECK:STDOUT: %b.loc19_22.1: i32 = param b // CHECK:STDOUT: @JustRight.%b: i32 = bind_name b, %b.loc19_22.1 // CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, %TooFew [template = %TooFew] -// CHECK:STDOUT: %.loc25: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, %TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc25: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%.loc25) // CHECK:STDOUT: %too_few.var: ref = var too_few // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, %TooMany [template = %TooMany] -// CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc30_35: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, %TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc30_35: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32, %.loc30_35) // CHECK:STDOUT: %too_many.var: ref = var too_many // CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, %BadReturnType [template = %BadReturnType] -// CHECK:STDOUT: %.loc35_42: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc35_45: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, %BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc35_42: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc35_45: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35_42, %.loc35_45) // CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type // CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var -// CHECK:STDOUT: %JustRight.ref: = name_ref JustRight, %JustRight [template = %JustRight] -// CHECK:STDOUT: %.loc44_31: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc44_34: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc44_37: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: %JustRight.ref: JustRight = name_ref JustRight, %JustRight.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc44_31: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc44_34: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc44_37: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: %int.sadd: init i32 = call %JustRight.ref() [template = ] // CHECK:STDOUT: %.loc44_39: type = array_type %int.sadd, i32 [template = ] // CHECK:STDOUT: %bad_call.var: ref = var bad_call // CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var -// CHECK:STDOUT: %RuntimeCallTooFew: = fn_decl @RuntimeCallTooFew [template] { +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { // CHECK:STDOUT: %a.loc46_22.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: i32 = bind_name a, %a.loc46_22.1 // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany: = fn_decl @RuntimeCallTooMany [template] { +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { // CHECK:STDOUT: %a.loc50_23.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: i32 = bind_name a, %a.loc50_23.1 // CHECK:STDOUT: %b.loc50_31.1: i32 = param b @@ -237,7 +257,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: @RuntimeCallTooMany.%c: i32 = bind_name c, %c.loc50_39.1 // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType: = fn_decl @RuntimeCallBadReturnType [template] { +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { // CHECK:STDOUT: %a.loc54_29.1: i32 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: i32 = bind_name a, %a.loc54_29.1 // CHECK:STDOUT: %b.loc54_37.1: i32 = param b @@ -256,7 +276,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%a.ref) // CHECK:STDOUT: %.loc47_19.1: i32 = value_of_initializer %TooFew.call @@ -266,7 +286,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: i32, %b: i32, %c: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, file.%TooMany [template = file.%TooMany] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %c.ref: i32 = name_ref c, %c @@ -278,7 +298,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) @@ -290,38 +310,41 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: --- fail_overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %Add: type = fn_type @Add [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Add = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Add = %Add +// CHECK:STDOUT: .Add = %Add.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Add: = fn_decl @Add [template] { +// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Add.ref.loc6: = name_ref Add, %Add [template = %Add] -// CHECK:STDOUT: %.loc6_18: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_30: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %int.sadd.loc6: init i32 = call %Add.ref.loc6(%.loc6_18, %.loc6_30) [template = constants.%.1] -// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.sadd.loc6 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.sadd.loc6, %.loc6_32.1 [template = constants.%.1] +// CHECK:STDOUT: %Add.ref.loc6: Add = name_ref Add, %Add.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc6_18: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_30: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %int.sadd.loc6: init i32 = call %Add.ref.loc6(%.loc6_18, %.loc6_30) [template = constants.%.2] +// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.sadd.loc6 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.sadd.loc6, %.loc6_32.1 [template = constants.%.2] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_32.2 -// CHECK:STDOUT: %Add.ref.loc10: = name_ref Add, %Add [template = %Add] -// CHECK:STDOUT: %.loc10_18: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_30: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %int.sadd.loc10: init i32 = call %Add.ref.loc10(%.loc10_18, %.loc10_30) [template = constants.%.4] -// CHECK:STDOUT: %.loc10_32.1: i32 = value_of_initializer %int.sadd.loc10 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_32.2: i32 = converted %int.sadd.loc10, %.loc10_32.1 [template = constants.%.4] +// CHECK:STDOUT: %Add.ref.loc10: Add = name_ref Add, %Add.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc10_18: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_30: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %int.sadd.loc10: init i32 = call %Add.ref.loc10(%.loc10_18, %.loc10_30) [template = constants.%.5] +// CHECK:STDOUT: %.loc10_32.1: i32 = value_of_initializer %int.sadd.loc10 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_32.2: i32 = converted %int.sadd.loc10, %.loc10_32.1 [template = constants.%.5] // CHECK:STDOUT: %b.loc10: i32 = bind_name b, %.loc10_32.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/sdiv.carbon b/toolchain/check/testdata/builtins/int/sdiv.carbon index 8b8862b8d682..88e903dff310 100644 --- a/toolchain/check/testdata/builtins/int/sdiv.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv.carbon @@ -56,42 +56,47 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: --- int_div.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 1] [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Div = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 1] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Div = %Div +// CHECK:STDOUT: .Div = %Div.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div: = fn_decl @Div [template] { +// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Div.ref: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.sdiv: init i32 = call %Div.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %int.sdiv, i32 [template = constants.%.4] +// CHECK:STDOUT: %Div.ref: Div = name_ref Div, %Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.sdiv: init i32 = call %Div.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.sdiv, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 1] = var arr // CHECK:STDOUT: %arr: ref [i32; 1] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 1] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 1] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 1] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 1]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 1]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -104,7 +109,7 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref: = name_ref Div, file.%Div [template = file.%Div] +// CHECK:STDOUT: %Div.ref: Div = name_ref Div, file.%Div.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.sdiv: init i32 = call %Div.ref(%a.ref, %b.ref) @@ -116,90 +121,97 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: --- fail_overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal -1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Div = struct_value () [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.3: Negate = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal -1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Div = %Div -// CHECK:STDOUT: .Sub = %Sub -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Div = %Div.decl +// CHECK:STDOUT: .Sub = %Sub.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div: = fn_decl @Div [template] { +// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { +// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc6_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc6_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Div.ref.loc9: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %Negate.ref.loc9_18: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] -// CHECK:STDOUT: %Negate.ref.loc9_39: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %int.snegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.snegate.loc9_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.2: i32 = converted %int.snegate.loc9_24, %.loc9_17.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %int.snegate.loc9_45 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.4: i32 = converted %int.snegate.loc9_45, %.loc9_17.3 [template = constants.%.4] -// CHECK:STDOUT: %int.sdiv.loc9: init i32 = call %Div.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.1] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.sdiv.loc9 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.sdiv.loc9, %.loc9_49.1 [template = constants.%.1] +// CHECK:STDOUT: %Div.ref.loc9: Div = name_ref Div, %Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc9_18: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.3] +// CHECK:STDOUT: %Negate.ref.loc9_39: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %int.snegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.5] +// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.snegate.loc9_24 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_17.2: i32 = converted %int.snegate.loc9_24, %.loc9_17.1 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %int.snegate.loc9_45 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_17.4: i32 = converted %int.snegate.loc9_45, %.loc9_17.3 [template = constants.%.5] +// CHECK:STDOUT: %int.sdiv.loc9: init i32 = call %Div.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.2] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.sdiv.loc9 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.sdiv.loc9, %.loc9_49.1 [template = constants.%.2] // CHECK:STDOUT: %a.loc9: i32 = bind_name a, %.loc9_49.2 -// CHECK:STDOUT: %Div.ref.loc12: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %Sub.ref.loc12: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.snegate.loc12, %.loc12_21.1 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.5] -// CHECK:STDOUT: %.loc12_47: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %int.ssub.loc12 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_17.2: i32 = converted %int.ssub.loc12, %.loc12_17.1 [template = constants.%.5] -// CHECK:STDOUT: %int.sdiv.loc12: init i32 = call %Div.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.5] -// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.sdiv.loc12 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.sdiv.loc12, %.loc12_49.1 [template = constants.%.5] +// CHECK:STDOUT: %Div.ref.loc12: Div = name_ref Div, %Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref.loc12: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.3] +// CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.snegate.loc12, %.loc12_21.1 [template = constants.%.3] +// CHECK:STDOUT: %int.ssub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.6] +// CHECK:STDOUT: %.loc12_47: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %int.ssub.loc12 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_17.2: i32 = converted %int.ssub.loc12, %.loc12_17.1 [template = constants.%.6] +// CHECK:STDOUT: %int.sdiv.loc12: init i32 = call %Div.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.6] +// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.sdiv.loc12 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.sdiv.loc12, %.loc12_49.1 [template = constants.%.6] // CHECK:STDOUT: %b.loc12: i32 = bind_name b, %.loc12_49.2 -// CHECK:STDOUT: %Div.ref.loc19: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %Sub.ref.loc19: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Negate.ref.loc19_22: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc19_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc19_28: init i32 = call %Negate.ref.loc19_22(%.loc19_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc19_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc19_21.1: i32 = value_of_initializer %int.snegate.loc19_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc19_21.2: i32 = converted %int.snegate.loc19_28, %.loc19_21.1 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc19: init i32 = call %Sub.ref.loc19(%.loc19_21.2, %.loc19_43) [template = constants.%.5] -// CHECK:STDOUT: %Negate.ref.loc19_47: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc19_54: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %int.snegate.loc19_53: init i32 = call %Negate.ref.loc19_47(%.loc19_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc19_17.1: i32 = value_of_initializer %int.ssub.loc19 [template = constants.%.5] -// CHECK:STDOUT: %.loc19_17.2: i32 = converted %int.ssub.loc19, %.loc19_17.1 [template = constants.%.5] -// CHECK:STDOUT: %.loc19_17.3: i32 = value_of_initializer %int.snegate.loc19_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc19_17.4: i32 = converted %int.snegate.loc19_53, %.loc19_17.3 [template = constants.%.4] -// CHECK:STDOUT: %int.sdiv.loc19: init i32 = call %Div.ref.loc19(%.loc19_17.2, %.loc19_17.4) [template = constants.%.5] -// CHECK:STDOUT: %.loc19_57.1: i32 = value_of_initializer %int.sdiv.loc19 [template = constants.%.5] -// CHECK:STDOUT: %.loc19_57.2: i32 = converted %int.sdiv.loc19, %.loc19_57.1 [template = constants.%.5] +// CHECK:STDOUT: %Div.ref.loc19: Div = name_ref Div, %Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref.loc19: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc19_22: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_29: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc19_28: init i32 = call %Negate.ref.loc19_22(%.loc19_29) [template = constants.%.3] +// CHECK:STDOUT: %.loc19_43: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc19_21.1: i32 = value_of_initializer %int.snegate.loc19_28 [template = constants.%.3] +// CHECK:STDOUT: %.loc19_21.2: i32 = converted %int.snegate.loc19_28, %.loc19_21.1 [template = constants.%.3] +// CHECK:STDOUT: %int.ssub.loc19: init i32 = call %Sub.ref.loc19(%.loc19_21.2, %.loc19_43) [template = constants.%.6] +// CHECK:STDOUT: %Negate.ref.loc19_47: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_54: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %int.snegate.loc19_53: init i32 = call %Negate.ref.loc19_47(%.loc19_54) [template = constants.%.5] +// CHECK:STDOUT: %.loc19_17.1: i32 = value_of_initializer %int.ssub.loc19 [template = constants.%.6] +// CHECK:STDOUT: %.loc19_17.2: i32 = converted %int.ssub.loc19, %.loc19_17.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc19_17.3: i32 = value_of_initializer %int.snegate.loc19_53 [template = constants.%.5] +// CHECK:STDOUT: %.loc19_17.4: i32 = converted %int.snegate.loc19_53, %.loc19_17.3 [template = constants.%.5] +// CHECK:STDOUT: %int.sdiv.loc19: init i32 = call %Div.ref.loc19(%.loc19_17.2, %.loc19_17.4) [template = constants.%.6] +// CHECK:STDOUT: %.loc19_57.1: i32 = value_of_initializer %int.sdiv.loc19 [template = constants.%.6] +// CHECK:STDOUT: %.loc19_57.2: i32 = converted %int.sdiv.loc19, %.loc19_57.1 [template = constants.%.6] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc19_57.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -212,33 +224,36 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: --- fail_div_by_zero.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Div = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Div = %Div +// CHECK:STDOUT: .Div = %Div.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div: = fn_decl @Div [template] { +// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Div.ref.loc10: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %.loc10_18: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_21: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %Div.ref.loc10: Div = name_ref Div, %Div.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc10_18: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.sdiv.loc10: init i32 = call %Div.ref.loc10(%.loc10_18, %.loc10_21) [template = ] // CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %int.sdiv.loc10 [template = ] // CHECK:STDOUT: %.loc10_23.2: i32 = converted %int.sdiv.loc10, %.loc10_23.1 [template = ] // CHECK:STDOUT: %a.loc10: i32 = bind_name a, %.loc10_23.2 -// CHECK:STDOUT: %Div.ref.loc15: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %.loc15_18: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %Div.ref.loc15: Div = name_ref Div, %Div.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc15_18: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.sdiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_18, %.loc15_21) [template = ] // CHECK:STDOUT: %.loc15_23.1: i32 = value_of_initializer %int.sdiv.loc15 [template = ] // CHECK:STDOUT: %.loc15_23.2: i32 = converted %int.sdiv.loc15, %.loc15_23.1 [template = ] diff --git a/toolchain/check/testdata/builtins/int/smod.carbon b/toolchain/check/testdata/builtins/int/smod.carbon index 26a9263af007..9c2ac109e23f 100644 --- a/toolchain/check/testdata/builtins/int/smod.carbon +++ b/toolchain/check/testdata/builtins/int/smod.carbon @@ -59,42 +59,47 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: --- int_div.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 2] [template] +// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Mod = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 2] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Mod = %Mod +// CHECK:STDOUT: .Mod = %Mod.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mod: = fn_decl @Mod [template] { +// CHECK:STDOUT: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mod.ref: = name_ref Mod, %Mod [template = %Mod] -// CHECK:STDOUT: %.loc4_20: i32 = int_literal 5 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %int.smod: init i32 = call %Mod.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %int.smod, i32 [template = constants.%.4] +// CHECK:STDOUT: %Mod.ref: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_20: i32 = int_literal 5 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_23: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: %int.smod: init i32 = call %Mod.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.smod, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 2] = var arr // CHECK:STDOUT: %arr: ref [i32; 2] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 2] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 2] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 2] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 2]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 2]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -107,7 +112,7 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mod.ref: = name_ref Mod, file.%Mod [template = file.%Mod] +// CHECK:STDOUT: %Mod.ref: Mod = name_ref Mod, file.%Mod.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.smod: init i32 = call %Mod.ref(%a.ref, %b.ref) @@ -119,91 +124,98 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: --- fail_overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal -1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.6: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Mod = struct_value () [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.3: Negate = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal -1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.7: i32 = int_literal -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Mod = %Mod -// CHECK:STDOUT: .Sub = %Sub -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Mod = %Mod.decl +// CHECK:STDOUT: .Sub = %Sub.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mod: = fn_decl @Mod [template] { +// CHECK:STDOUT: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { +// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc6_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc6_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mod.ref.loc9: = name_ref Mod, %Mod [template = %Mod] -// CHECK:STDOUT: %Negate.ref.loc9_18: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] -// CHECK:STDOUT: %Negate.ref.loc9_39: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %int.snegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.snegate.loc9_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.2: i32 = converted %int.snegate.loc9_24, %.loc9_17.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %int.snegate.loc9_45 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.4: i32 = converted %int.snegate.loc9_45, %.loc9_17.3 [template = constants.%.4] -// CHECK:STDOUT: %int.smod.loc9: init i32 = call %Mod.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.smod.loc9 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.smod.loc9, %.loc9_49.1 [template = constants.%.5] +// CHECK:STDOUT: %Mod.ref.loc9: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc9_18: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.3] +// CHECK:STDOUT: %Negate.ref.loc9_39: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %int.snegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.5] +// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.snegate.loc9_24 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_17.2: i32 = converted %int.snegate.loc9_24, %.loc9_17.1 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %int.snegate.loc9_45 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_17.4: i32 = converted %int.snegate.loc9_45, %.loc9_17.3 [template = constants.%.5] +// CHECK:STDOUT: %int.smod.loc9: init i32 = call %Mod.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.6] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.smod.loc9 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.smod.loc9, %.loc9_49.1 [template = constants.%.6] // CHECK:STDOUT: %a.loc9: i32 = bind_name a, %.loc9_49.2 -// CHECK:STDOUT: %Mod.ref.loc12: = name_ref Mod, %Mod [template = %Mod] -// CHECK:STDOUT: %Sub.ref.loc12: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.snegate.loc12, %.loc12_21.1 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_47: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %int.ssub.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_17.2: i32 = converted %int.ssub.loc12, %.loc12_17.1 [template = constants.%.6] -// CHECK:STDOUT: %int.smod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.5] -// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.smod.loc12 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.smod.loc12, %.loc12_49.1 [template = constants.%.5] +// CHECK:STDOUT: %Mod.ref.loc12: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref.loc12: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.3] +// CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.snegate.loc12 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.snegate.loc12, %.loc12_21.1 [template = constants.%.3] +// CHECK:STDOUT: %int.ssub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.7] +// CHECK:STDOUT: %.loc12_47: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %int.ssub.loc12 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_17.2: i32 = converted %int.ssub.loc12, %.loc12_17.1 [template = constants.%.7] +// CHECK:STDOUT: %int.smod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.6] +// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.smod.loc12 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.smod.loc12, %.loc12_49.1 [template = constants.%.6] // CHECK:STDOUT: %b.loc12: i32 = bind_name b, %.loc12_49.2 -// CHECK:STDOUT: %Mod.ref.loc20: = name_ref Mod, %Mod [template = %Mod] -// CHECK:STDOUT: %Sub.ref.loc20: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Negate.ref.loc20_22: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc20_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc20_28: init i32 = call %Negate.ref.loc20_22(%.loc20_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc20_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc20_21.1: i32 = value_of_initializer %int.snegate.loc20_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc20_21.2: i32 = converted %int.snegate.loc20_28, %.loc20_21.1 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc20: init i32 = call %Sub.ref.loc20(%.loc20_21.2, %.loc20_43) [template = constants.%.6] -// CHECK:STDOUT: %Negate.ref.loc20_47: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc20_54: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %int.snegate.loc20_53: init i32 = call %Negate.ref.loc20_47(%.loc20_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc20_17.1: i32 = value_of_initializer %int.ssub.loc20 [template = constants.%.6] -// CHECK:STDOUT: %.loc20_17.2: i32 = converted %int.ssub.loc20, %.loc20_17.1 [template = constants.%.6] -// CHECK:STDOUT: %.loc20_17.3: i32 = value_of_initializer %int.snegate.loc20_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc20_17.4: i32 = converted %int.snegate.loc20_53, %.loc20_17.3 [template = constants.%.4] -// CHECK:STDOUT: %int.smod.loc20: init i32 = call %Mod.ref.loc20(%.loc20_17.2, %.loc20_17.4) [template = constants.%.5] -// CHECK:STDOUT: %.loc20_57.1: i32 = value_of_initializer %int.smod.loc20 [template = constants.%.5] -// CHECK:STDOUT: %.loc20_57.2: i32 = converted %int.smod.loc20, %.loc20_57.1 [template = constants.%.5] +// CHECK:STDOUT: %Mod.ref.loc20: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref.loc20: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc20_22: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc20_29: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc20_28: init i32 = call %Negate.ref.loc20_22(%.loc20_29) [template = constants.%.3] +// CHECK:STDOUT: %.loc20_43: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc20_21.1: i32 = value_of_initializer %int.snegate.loc20_28 [template = constants.%.3] +// CHECK:STDOUT: %.loc20_21.2: i32 = converted %int.snegate.loc20_28, %.loc20_21.1 [template = constants.%.3] +// CHECK:STDOUT: %int.ssub.loc20: init i32 = call %Sub.ref.loc20(%.loc20_21.2, %.loc20_43) [template = constants.%.7] +// CHECK:STDOUT: %Negate.ref.loc20_47: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc20_54: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %int.snegate.loc20_53: init i32 = call %Negate.ref.loc20_47(%.loc20_54) [template = constants.%.5] +// CHECK:STDOUT: %.loc20_17.1: i32 = value_of_initializer %int.ssub.loc20 [template = constants.%.7] +// CHECK:STDOUT: %.loc20_17.2: i32 = converted %int.ssub.loc20, %.loc20_17.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc20_17.3: i32 = value_of_initializer %int.snegate.loc20_53 [template = constants.%.5] +// CHECK:STDOUT: %.loc20_17.4: i32 = converted %int.snegate.loc20_53, %.loc20_17.3 [template = constants.%.5] +// CHECK:STDOUT: %int.smod.loc20: init i32 = call %Mod.ref.loc20(%.loc20_17.2, %.loc20_17.4) [template = constants.%.6] +// CHECK:STDOUT: %.loc20_57.1: i32 = value_of_initializer %int.smod.loc20 [template = constants.%.6] +// CHECK:STDOUT: %.loc20_57.2: i32 = converted %int.smod.loc20, %.loc20_57.1 [template = constants.%.6] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc20_57.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -216,33 +228,36 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: --- fail_div_by_zero.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Mod = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Mod = %Mod +// CHECK:STDOUT: .Mod = %Mod.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mod: = fn_decl @Mod [template] { +// CHECK:STDOUT: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mod.ref.loc12: = name_ref Mod, %Mod [template = %Mod] -// CHECK:STDOUT: %.loc12_18: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_21: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %Mod.ref.loc12: Mod = name_ref Mod, %Mod.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc12_18: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.smod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_18, %.loc12_21) [template = ] // CHECK:STDOUT: %.loc12_23.1: i32 = value_of_initializer %int.smod.loc12 [template = ] // CHECK:STDOUT: %.loc12_23.2: i32 = converted %int.smod.loc12, %.loc12_23.1 [template = ] // CHECK:STDOUT: %a.loc12: i32 = bind_name a, %.loc12_23.2 -// CHECK:STDOUT: %Mod.ref.loc17: = name_ref Mod, %Mod [template = %Mod] -// CHECK:STDOUT: %.loc17_18: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc17_21: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %Mod.ref.loc17: Mod = name_ref Mod, %Mod.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc17_18: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc17_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.smod.loc17: init i32 = call %Mod.ref.loc17(%.loc17_18, %.loc17_21) [template = ] // CHECK:STDOUT: %.loc17_23.1: i32 = value_of_initializer %int.smod.loc17 [template = ] // CHECK:STDOUT: %.loc17_23.2: i32 = converted %int.smod.loc17, %.loc17_23.1 [template = ] diff --git a/toolchain/check/testdata/builtins/int/smul.carbon b/toolchain/check/testdata/builtins/int/smul.carbon index 015d19ffc2d9..b537ccfaf8f3 100644 --- a/toolchain/check/testdata/builtins/int/smul.carbon +++ b/toolchain/check/testdata/builtins/int/smul.carbon @@ -30,42 +30,47 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: --- int_mul.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 6 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 6] [template] +// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Mul = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 6 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 6] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Mul = %Mul +// CHECK:STDOUT: .Mul = %Mul.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mul: = fn_decl @Mul [template] { +// CHECK:STDOUT: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Mul.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Mul.%b: i32 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Mul.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mul.ref: = name_ref Mul, %Mul [template = %Mul] -// CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.smul: init i32 = call %Mul.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %int.smul, i32 [template = constants.%.4] +// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, %Mul.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.smul: init i32 = call %Mul.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.smul, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 6] = var arr // CHECK:STDOUT: %arr: ref [i32; 6] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 6 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 6] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 6 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 6] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 6] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 6]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 6]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -78,7 +83,7 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mul.ref: = name_ref Mul, file.%Mul [template = file.%Mul] +// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, file.%Mul.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.smul: init i32 = call %Mul.ref(%a.ref, %b.ref) @@ -90,39 +95,42 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: --- fail_overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 32767 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 65536 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2147418112 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 32768 [template] -// CHECK:STDOUT: %.5: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Mul = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 32767 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 65536 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2147418112 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 32768 [template] +// CHECK:STDOUT: %.6: i32 = int_literal -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Mul = %Mul +// CHECK:STDOUT: .Mul = %Mul.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mul: = fn_decl @Mul [template] { +// CHECK:STDOUT: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Mul.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mul.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Mul.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mul.ref.loc6: = name_ref Mul, %Mul [template = %Mul] -// CHECK:STDOUT: %.loc6_18: i32 = int_literal 32767 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_26: i32 = int_literal 65536 [template = constants.%.2] -// CHECK:STDOUT: %int.smul.loc6: init i32 = call %Mul.ref.loc6(%.loc6_18, %.loc6_26) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %int.smul.loc6 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_34.2: i32 = converted %int.smul.loc6, %.loc6_34.1 [template = constants.%.3] +// CHECK:STDOUT: %Mul.ref.loc6: Mul = name_ref Mul, %Mul.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc6_18: i32 = int_literal 32767 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_26: i32 = int_literal 65536 [template = constants.%.3] +// CHECK:STDOUT: %int.smul.loc6: init i32 = call %Mul.ref.loc6(%.loc6_18, %.loc6_26) [template = constants.%.4] +// CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %int.smul.loc6 [template = constants.%.4] +// CHECK:STDOUT: %.loc6_34.2: i32 = converted %int.smul.loc6, %.loc6_34.1 [template = constants.%.4] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_34.2 -// CHECK:STDOUT: %Mul.ref.loc10: = name_ref Mul, %Mul [template = %Mul] -// CHECK:STDOUT: %.loc10_18: i32 = int_literal 32768 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_26: i32 = int_literal 65536 [template = constants.%.2] -// CHECK:STDOUT: %int.smul.loc10: init i32 = call %Mul.ref.loc10(%.loc10_18, %.loc10_26) [template = constants.%.5] -// CHECK:STDOUT: %.loc10_34.1: i32 = value_of_initializer %int.smul.loc10 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_34.2: i32 = converted %int.smul.loc10, %.loc10_34.1 [template = constants.%.5] +// CHECK:STDOUT: %Mul.ref.loc10: Mul = name_ref Mul, %Mul.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc10_18: i32 = int_literal 32768 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_26: i32 = int_literal 65536 [template = constants.%.3] +// CHECK:STDOUT: %int.smul.loc10: init i32 = call %Mul.ref.loc10(%.loc10_18, %.loc10_26) [template = constants.%.6] +// CHECK:STDOUT: %.loc10_34.1: i32 = value_of_initializer %int.smul.loc10 [template = constants.%.6] +// CHECK:STDOUT: %.loc10_34.2: i32 = converted %int.smul.loc10, %.loc10_34.1 [template = constants.%.6] // CHECK:STDOUT: %b.loc10: i32 = bind_name b, %.loc10_34.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/snegate.carbon b/toolchain/check/testdata/builtins/int/snegate.carbon index bbb90d039983..5c88bfa59093 100644 --- a/toolchain/check/testdata/builtins/int/snegate.carbon +++ b/toolchain/check/testdata/builtins/int/snegate.carbon @@ -115,50 +115,55 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- int_negate.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 123 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -123 [template] -// CHECK:STDOUT: %.3: type = array_type %.1, i32 [template] -// CHECK:STDOUT: %.4: type = ptr_type [i32; 123] [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.6: i32 = int_literal -1 [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Negate = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 123 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -123 [template] +// CHECK:STDOUT: %.4: type = array_type %.2, i32 [template] +// CHECK:STDOUT: %.5: type = ptr_type [i32; 123] [template] +// CHECK:STDOUT: %.6: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.7: i32 = int_literal -1 [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc2_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref.loc4_16: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %Negate.ref.loc4_23: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc4_30: i32 = int_literal 123 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30) [template = constants.%.2] -// CHECK:STDOUT: %.loc4_22.1: i32 = value_of_initializer %int.snegate.loc4_29 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_22.2: i32 = converted %int.snegate.loc4_29, %.loc4_22.1 [template = constants.%.2] -// CHECK:STDOUT: %int.snegate.loc4_22: init i32 = call %Negate.ref.loc4_16(%.loc4_22.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc4_35: type = array_type %int.snegate.loc4_22, i32 [template = constants.%.3] +// CHECK:STDOUT: %Negate.ref.loc4_16: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc4_23: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_30: i32 = int_literal 123 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_22.1: i32 = value_of_initializer %int.snegate.loc4_29 [template = constants.%.3] +// CHECK:STDOUT: %.loc4_22.2: i32 = converted %int.snegate.loc4_29, %.loc4_22.1 [template = constants.%.3] +// CHECK:STDOUT: %int.snegate.loc4_22: init i32 = call %Negate.ref.loc4_16(%.loc4_22.2) [template = constants.%.2] +// CHECK:STDOUT: %.loc4_35: type = array_type %int.snegate.loc4_22, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 123] = var arr // CHECK:STDOUT: %arr: ref [i32; 123] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 123 [template = constants.%.1] -// CHECK:STDOUT: %.loc5_21: type = array_type %.loc5_18, i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_22: type = ptr_type [i32; 123] [template = constants.%.4] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 123 [template = constants.%.2] +// CHECK:STDOUT: %.loc5_21: type = array_type %.loc5_18, i32 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_22: type = ptr_type [i32; 123] [template = constants.%.5] // CHECK:STDOUT: %arr.ref: ref [i32; 123] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_26: [i32; 123]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 123]* = bind_name arr_p, %.loc5_26 -// CHECK:STDOUT: %Negate.ref.loc7: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc7_21: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %int.snegate.loc7: init i32 = call %Negate.ref.loc7(%.loc7_21) [template = constants.%.6] -// CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %int.snegate.loc7 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_23.2: i32 = converted %int.snegate.loc7, %.loc7_23.1 [template = constants.%.6] +// CHECK:STDOUT: %Negate.ref.loc7: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc7_21: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %int.snegate.loc7: init i32 = call %Negate.ref.loc7(%.loc7_21) [template = constants.%.7] +// CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %int.snegate.loc7 [template = constants.%.7] +// CHECK:STDOUT: %.loc7_23.2: i32 = converted %int.snegate.loc7, %.loc7_23.1 [template = constants.%.7] // CHECK:STDOUT: %n: i32 = bind_name n, %.loc7_23.2 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc9_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc9_16.1 // CHECK:STDOUT: %b.loc9_24.1: i32 = param b @@ -171,7 +176,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Negate.ref: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%a.ref) // CHECK:STDOUT: %.loc10_19.1: i32 = value_of_initializer %int.snegate @@ -182,74 +187,89 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] +// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] +// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] +// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] +// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] +// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] +// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .TooFew = %TooFew -// CHECK:STDOUT: .TooMany = %TooMany -// CHECK:STDOUT: .BadReturnType = %BadReturnType -// CHECK:STDOUT: .JustRight = %JustRight +// CHECK:STDOUT: .TooFew = %TooFew.decl +// CHECK:STDOUT: .TooMany = %TooMany.decl +// CHECK:STDOUT: .BadReturnType = %BadReturnType.decl +// CHECK:STDOUT: .JustRight = %JustRight.decl // CHECK:STDOUT: .too_few = %too_few // CHECK:STDOUT: .too_many = %too_many // CHECK:STDOUT: .bad_return_type = %bad_return_type // CHECK:STDOUT: .bad_call = %bad_call -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType +// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl +// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl +// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew: = fn_decl @TooFew [template] { +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { // CHECK:STDOUT: @TooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany: = fn_decl @TooMany [template] { +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc13_12.1: i32 = param a // CHECK:STDOUT: @TooMany.%a: i32 = bind_name a, %a.loc13_12.1 // CHECK:STDOUT: %b.loc13_20.1: i32 = param b // CHECK:STDOUT: @TooMany.%b: i32 = bind_name b, %b.loc13_20.1 // CHECK:STDOUT: @TooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType: = fn_decl @BadReturnType [template] { +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc18_18.1: i32 = param a // CHECK:STDOUT: @BadReturnType.%a: i32 = bind_name a, %a.loc18_18.1 // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight: = fn_decl @JustRight [template] { +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc19_14.1: i32 = param a // CHECK:STDOUT: @JustRight.%a: i32 = bind_name a, %a.loc19_14.1 // CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, %TooFew [template = %TooFew] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, %TooFew.decl [template = constants.%struct.1] // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref() // CHECK:STDOUT: %too_few.var: ref = var too_few // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, %TooMany [template = %TooMany] -// CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, %TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32) // CHECK:STDOUT: %too_many.var: ref = var too_many // CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, %BadReturnType [template = %BadReturnType] -// CHECK:STDOUT: %.loc35: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, %BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc35: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35) // CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type // CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var -// CHECK:STDOUT: %JustRight.ref: = name_ref JustRight, %JustRight [template = %JustRight] -// CHECK:STDOUT: %.loc44_31: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc44_34: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %JustRight.ref: JustRight = name_ref JustRight, %JustRight.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc44_31: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc44_34: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.snegate: init i32 = call %JustRight.ref() [template = ] // CHECK:STDOUT: %.loc44_36: type = array_type %int.snegate, i32 [template = ] // CHECK:STDOUT: %bad_call.var: ref = var bad_call // CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var -// CHECK:STDOUT: %RuntimeCallTooFew: = fn_decl @RuntimeCallTooFew [template] { +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { // CHECK:STDOUT: %a.loc46_22.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: i32 = bind_name a, %a.loc46_22.1 // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany: = fn_decl @RuntimeCallTooMany [template] { +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { // CHECK:STDOUT: %a.loc57_23.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: i32 = bind_name a, %a.loc57_23.1 // CHECK:STDOUT: %b.loc57_31.1: i32 = param b @@ -258,7 +278,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: @RuntimeCallTooMany.%c: i32 = bind_name c, %c.loc57_39.1 // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType: = fn_decl @RuntimeCallBadReturnType [template] { +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { // CHECK:STDOUT: %a.loc68_29.1: i32 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: i32 = bind_name a, %a.loc68_29.1 // CHECK:STDOUT: %b.loc68_37.1: i32 = param b @@ -277,7 +297,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref() [template = ] // CHECK:STDOUT: %.loc54_19.1: i32 = value_of_initializer %TooFew.call [template = ] @@ -287,7 +307,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: i32, %b: i32, %c: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, file.%TooMany [template = file.%TooMany] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %c.ref: i32 = name_ref c, %c @@ -299,7 +319,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref() [template = ] @@ -311,55 +331,60 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- fail_overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Negate = struct_value () [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Negate = %Negate -// CHECK:STDOUT: .Sub = %Sub +// CHECK:STDOUT: .Negate = %Negate.decl +// CHECK:STDOUT: .Sub = %Sub.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc4_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc4_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { +// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref.loc8_14: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %Negate.ref.loc8_21: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc8_28: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28) [template = constants.%.2] -// CHECK:STDOUT: %.loc8_20.1: i32 = value_of_initializer %int.snegate.loc8_27 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_20.2: i32 = converted %int.snegate.loc8_27, %.loc8_20.1 [template = constants.%.2] -// CHECK:STDOUT: %int.snegate.loc8_20: init i32 = call %Negate.ref.loc8_14(%.loc8_20.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.snegate.loc8_20 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.snegate.loc8_20, %.loc8_40.1 [template = constants.%.1] +// CHECK:STDOUT: %Negate.ref.loc8_14: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc8_21: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc8_28: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28) [template = constants.%.3] +// CHECK:STDOUT: %.loc8_20.1: i32 = value_of_initializer %int.snegate.loc8_27 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_20.2: i32 = converted %int.snegate.loc8_27, %.loc8_20.1 [template = constants.%.3] +// CHECK:STDOUT: %int.snegate.loc8_20: init i32 = call %Negate.ref.loc8_14(%.loc8_20.2) [template = constants.%.2] +// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.snegate.loc8_20 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.snegate.loc8_20, %.loc8_40.1 [template = constants.%.2] // CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8_40.2 -// CHECK:STDOUT: %Negate.ref.loc14_14: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %Sub.ref: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Negate.ref.loc14_25: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc14_32: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.snegate.loc14_31: init i32 = call %Negate.ref.loc14_25(%.loc14_32) [template = constants.%.2] -// CHECK:STDOUT: %.loc14_45: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_24.1: i32 = value_of_initializer %int.snegate.loc14_31 [template = constants.%.2] -// CHECK:STDOUT: %.loc14_24.2: i32 = converted %int.snegate.loc14_31, %.loc14_24.1 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%.loc14_24.2, %.loc14_45) [template = constants.%.4] -// CHECK:STDOUT: %.loc14_20.1: i32 = value_of_initializer %int.ssub [template = constants.%.4] -// CHECK:STDOUT: %.loc14_20.2: i32 = converted %int.ssub, %.loc14_20.1 [template = constants.%.4] -// CHECK:STDOUT: %int.snegate.loc14_20: init i32 = call %Negate.ref.loc14_14(%.loc14_20.2) [template = constants.%.4] -// CHECK:STDOUT: %.loc14_48.1: i32 = value_of_initializer %int.snegate.loc14_20 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_48.2: i32 = converted %int.snegate.loc14_20, %.loc14_48.1 [template = constants.%.4] +// CHECK:STDOUT: %Negate.ref.loc14_14: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc14_25: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc14_32: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate.loc14_31: init i32 = call %Negate.ref.loc14_25(%.loc14_32) [template = constants.%.3] +// CHECK:STDOUT: %.loc14_45: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_24.1: i32 = value_of_initializer %int.snegate.loc14_31 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_24.2: i32 = converted %int.snegate.loc14_31, %.loc14_24.1 [template = constants.%.3] +// CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%.loc14_24.2, %.loc14_45) [template = constants.%.5] +// CHECK:STDOUT: %.loc14_20.1: i32 = value_of_initializer %int.ssub [template = constants.%.5] +// CHECK:STDOUT: %.loc14_20.2: i32 = converted %int.ssub, %.loc14_20.1 [template = constants.%.5] +// CHECK:STDOUT: %int.snegate.loc14_20: init i32 = call %Negate.ref.loc14_14(%.loc14_20.2) [template = constants.%.5] +// CHECK:STDOUT: %.loc14_48.1: i32 = value_of_initializer %int.snegate.loc14_20 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_48.2: i32 = converted %int.snegate.loc14_20, %.loc14_48.1 [template = constants.%.5] // CHECK:STDOUT: %b.loc14: i32 = bind_name b, %.loc14_48.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/ssub.carbon b/toolchain/check/testdata/builtins/int/ssub.carbon index 21e69183d6c4..7197b15330f1 100644 --- a/toolchain/check/testdata/builtins/int/ssub.carbon +++ b/toolchain/check/testdata/builtins/int/ssub.carbon @@ -31,42 +31,47 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: --- int_sub.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 1] [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Sub = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 1] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Sub = %Sub +// CHECK:STDOUT: .Sub = %Sub.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { +// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.ref: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %int.ssub, i32 [template = constants.%.4] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.ssub, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 1] = var arr // CHECK:STDOUT: %arr: ref [i32; 1] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 1] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 1] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 1] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 1]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 1]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -79,7 +84,7 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Sub.ref: = name_ref Sub, file.%Sub [template = file.%Sub] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, file.%Sub.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.ssub: init i32 = call %Sub.ref(%a.ref, %b.ref) @@ -91,57 +96,60 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: --- fail_overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal -2147483648 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Sub = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2147483647 [template] +// CHECK:STDOUT: %.4: i32 = int_literal -2147483647 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %.7: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Sub = %Sub +// CHECK:STDOUT: .Sub = %Sub.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { +// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.ref.loc6: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %.loc6_18: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_21: i32 = int_literal 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc6: init i32 = call %Sub.ref.loc6(%.loc6_18, %.loc6_21) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.ssub.loc6 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.ssub.loc6, %.loc6_32.1 [template = constants.%.3] +// CHECK:STDOUT: %Sub.ref.loc6: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc6_18: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_21: i32 = int_literal 2147483647 [template = constants.%.3] +// CHECK:STDOUT: %int.ssub.loc6: init i32 = call %Sub.ref.loc6(%.loc6_18, %.loc6_21) [template = constants.%.4] +// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.ssub.loc6 [template = constants.%.4] +// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.ssub.loc6, %.loc6_32.1 [template = constants.%.4] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_32.2 -// CHECK:STDOUT: %Sub.ref.loc7_14: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Sub.ref.loc7_18: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_25: i32 = int_literal 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22, %.loc7_25) [template = constants.%.3] -// CHECK:STDOUT: %.loc7_38: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_17.1: i32 = value_of_initializer %int.ssub.loc7_21 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_17.2: i32 = converted %int.ssub.loc7_21, %.loc7_17.1 [template = constants.%.3] -// CHECK:STDOUT: %int.ssub.loc7_17: init i32 = call %Sub.ref.loc7_14(%.loc7_17.2, %.loc7_38) [template = constants.%.5] -// CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %int.ssub.loc7_17 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_40.2: i32 = converted %int.ssub.loc7_17, %.loc7_40.1 [template = constants.%.5] +// CHECK:STDOUT: %Sub.ref.loc7_14: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %Sub.ref.loc7_18: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_25: i32 = int_literal 2147483647 [template = constants.%.3] +// CHECK:STDOUT: %int.ssub.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22, %.loc7_25) [template = constants.%.4] +// CHECK:STDOUT: %.loc7_38: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_17.1: i32 = value_of_initializer %int.ssub.loc7_21 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_17.2: i32 = converted %int.ssub.loc7_21, %.loc7_17.1 [template = constants.%.4] +// CHECK:STDOUT: %int.ssub.loc7_17: init i32 = call %Sub.ref.loc7_14(%.loc7_17.2, %.loc7_38) [template = constants.%.6] +// CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %int.ssub.loc7_17 [template = constants.%.6] +// CHECK:STDOUT: %.loc7_40.2: i32 = converted %int.ssub.loc7_17, %.loc7_40.1 [template = constants.%.6] // CHECK:STDOUT: %b.loc7: i32 = bind_name b, %.loc7_40.2 -// CHECK:STDOUT: %Sub.ref.loc11_14: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Sub.ref.loc11_18: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %.loc11_22: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_25: i32 = int_literal 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.ssub.loc11_21: init i32 = call %Sub.ref.loc11_18(%.loc11_22, %.loc11_25) [template = constants.%.3] -// CHECK:STDOUT: %.loc11_38: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc11_17.1: i32 = value_of_initializer %int.ssub.loc11_21 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_17.2: i32 = converted %int.ssub.loc11_21, %.loc11_17.1 [template = constants.%.3] -// CHECK:STDOUT: %int.ssub.loc11_17: init i32 = call %Sub.ref.loc11_14(%.loc11_17.2, %.loc11_38) [template = constants.%.2] -// CHECK:STDOUT: %.loc11_40.1: i32 = value_of_initializer %int.ssub.loc11_17 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_40.2: i32 = converted %int.ssub.loc11_17, %.loc11_40.1 [template = constants.%.2] +// CHECK:STDOUT: %Sub.ref.loc11_14: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %Sub.ref.loc11_18: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc11_22: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_25: i32 = int_literal 2147483647 [template = constants.%.3] +// CHECK:STDOUT: %int.ssub.loc11_21: init i32 = call %Sub.ref.loc11_18(%.loc11_22, %.loc11_25) [template = constants.%.4] +// CHECK:STDOUT: %.loc11_38: i32 = int_literal 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_17.1: i32 = value_of_initializer %int.ssub.loc11_21 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_17.2: i32 = converted %int.ssub.loc11_21, %.loc11_17.1 [template = constants.%.4] +// CHECK:STDOUT: %int.ssub.loc11_17: init i32 = call %Sub.ref.loc11_14(%.loc11_17.2, %.loc11_38) [template = constants.%.3] +// CHECK:STDOUT: %.loc11_40.1: i32 = value_of_initializer %int.ssub.loc11_17 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_40.2: i32 = converted %int.ssub.loc11_17, %.loc11_40.1 [template = constants.%.3] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc11_40.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/uadd.carbon b/toolchain/check/testdata/builtins/int/uadd.carbon index 259680c870b7..66f0c43be040 100644 --- a/toolchain/check/testdata/builtins/int/uadd.carbon +++ b/toolchain/check/testdata/builtins/int/uadd.carbon @@ -85,42 +85,47 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: --- int_add.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %Add: type = fn_type @Add [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Add = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Add = %Add +// CHECK:STDOUT: .Add = %Add.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Add: = fn_decl @Add [template] { +// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Add.ref: = name_ref Add, %Add [template = %Add] -// CHECK:STDOUT: %.loc4_20: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.uadd: init i32 = call %Add.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %int.uadd, i32 [template = constants.%.4] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_20: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.uadd: init i32 = call %Add.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.uadd, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 3] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 3] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 3] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 3]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 3]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -133,7 +138,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Add.ref: = name_ref Add, file.%Add [template = file.%Add] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, file.%Add.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.uadd: init i32 = call %Add.ref(%a.ref, %b.ref) @@ -145,33 +150,48 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] +// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] +// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] +// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] +// CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] +// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] +// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] +// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .TooFew = %TooFew -// CHECK:STDOUT: .TooMany = %TooMany -// CHECK:STDOUT: .BadReturnType = %BadReturnType -// CHECK:STDOUT: .JustRight = %JustRight +// CHECK:STDOUT: .TooFew = %TooFew.decl +// CHECK:STDOUT: .TooMany = %TooMany.decl +// CHECK:STDOUT: .BadReturnType = %BadReturnType.decl +// CHECK:STDOUT: .JustRight = %JustRight.decl // CHECK:STDOUT: .too_few = %too_few // CHECK:STDOUT: .too_many = %too_many // CHECK:STDOUT: .bad_return_type = %bad_return_type // CHECK:STDOUT: .bad_call = %bad_call -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType +// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl +// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl +// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew: = fn_decl @TooFew [template] { +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc8_11.1: i32 = param a // CHECK:STDOUT: @TooFew.%a: i32 = bind_name a, %a.loc8_11.1 // CHECK:STDOUT: @TooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany: = fn_decl @TooMany [template] { +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc13_12.1: i32 = param a // CHECK:STDOUT: @TooMany.%a: i32 = bind_name a, %a.loc13_12.1 // CHECK:STDOUT: %b.loc13_20.1: i32 = param b @@ -180,52 +200,52 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: @TooMany.%c: i32 = bind_name c, %c.loc13_28.1 // CHECK:STDOUT: @TooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType: = fn_decl @BadReturnType [template] { +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc18_18.1: i32 = param a // CHECK:STDOUT: @BadReturnType.%a: i32 = bind_name a, %a.loc18_18.1 // CHECK:STDOUT: %b.loc18_26.1: i32 = param b // CHECK:STDOUT: @BadReturnType.%b: i32 = bind_name b, %b.loc18_26.1 // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight: = fn_decl @JustRight [template] { +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc19_14.1: i32 = param a // CHECK:STDOUT: @JustRight.%a: i32 = bind_name a, %a.loc19_14.1 // CHECK:STDOUT: %b.loc19_22.1: i32 = param b // CHECK:STDOUT: @JustRight.%b: i32 = bind_name b, %b.loc19_22.1 // CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, %TooFew [template = %TooFew] -// CHECK:STDOUT: %.loc25: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, %TooFew.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc25: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%.loc25) // CHECK:STDOUT: %too_few.var: ref = var too_few // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, %TooMany [template = %TooMany] -// CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc30_35: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, %TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc30_35: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32, %.loc30_35) // CHECK:STDOUT: %too_many.var: ref = var too_many // CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, %BadReturnType [template = %BadReturnType] -// CHECK:STDOUT: %.loc35_42: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc35_45: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, %BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc35_42: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc35_45: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35_42, %.loc35_45) // CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type // CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var -// CHECK:STDOUT: %JustRight.ref: = name_ref JustRight, %JustRight [template = %JustRight] -// CHECK:STDOUT: %.loc43_31: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc43_34: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc43_37: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: %JustRight.ref: JustRight = name_ref JustRight, %JustRight.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc43_31: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc43_34: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc43_37: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: %int.uadd: init i32 = call %JustRight.ref() [template = ] // CHECK:STDOUT: %.loc43_39: type = array_type %int.uadd, i32 [template = ] // CHECK:STDOUT: %bad_call.var: ref = var bad_call // CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var -// CHECK:STDOUT: %RuntimeCallTooFew: = fn_decl @RuntimeCallTooFew [template] { +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { // CHECK:STDOUT: %a.loc45_22.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: i32 = bind_name a, %a.loc45_22.1 // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany: = fn_decl @RuntimeCallTooMany [template] { +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { // CHECK:STDOUT: %a.loc49_23.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: i32 = bind_name a, %a.loc49_23.1 // CHECK:STDOUT: %b.loc49_31.1: i32 = param b @@ -234,7 +254,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: @RuntimeCallTooMany.%c: i32 = bind_name c, %c.loc49_39.1 // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType: = fn_decl @RuntimeCallBadReturnType [template] { +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { // CHECK:STDOUT: %a.loc53_29.1: i32 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: i32 = bind_name a, %a.loc53_29.1 // CHECK:STDOUT: %b.loc53_37.1: i32 = param b @@ -253,7 +273,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref(%a.ref) // CHECK:STDOUT: %.loc46_19.1: i32 = value_of_initializer %TooFew.call @@ -263,7 +283,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: i32, %b: i32, %c: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, file.%TooMany [template = file.%TooMany] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %c.ref: i32 = name_ref c, %c @@ -275,7 +295,7 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%a.ref, %b.ref) @@ -287,38 +307,41 @@ let b: i32 = Add(0x7FFFFFFF, 1); // CHECK:STDOUT: --- overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %Add: type = fn_type @Add [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Add = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Add = %Add +// CHECK:STDOUT: .Add = %Add.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Add: = fn_decl @Add [template] { +// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Add.ref.loc7: = name_ref Add, %Add [template = %Add] -// CHECK:STDOUT: %.loc7_18: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_30: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %int.uadd.loc7: init i32 = call %Add.ref.loc7(%.loc7_18, %.loc7_30) [template = constants.%.1] -// CHECK:STDOUT: %.loc7_32.1: i32 = value_of_initializer %int.uadd.loc7 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_32.2: i32 = converted %int.uadd.loc7, %.loc7_32.1 [template = constants.%.1] +// CHECK:STDOUT: %Add.ref.loc7: Add = name_ref Add, %Add.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc7_18: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_30: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %int.uadd.loc7: init i32 = call %Add.ref.loc7(%.loc7_18, %.loc7_30) [template = constants.%.2] +// CHECK:STDOUT: %.loc7_32.1: i32 = value_of_initializer %int.uadd.loc7 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_32.2: i32 = converted %int.uadd.loc7, %.loc7_32.1 [template = constants.%.2] // CHECK:STDOUT: %a.loc7: i32 = bind_name a, %.loc7_32.2 -// CHECK:STDOUT: %Add.ref.loc8: = name_ref Add, %Add [template = %Add] -// CHECK:STDOUT: %.loc8_18: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %int.uadd.loc8: init i32 = call %Add.ref.loc8(%.loc8_18, %.loc8_30) [template = constants.%.4] -// CHECK:STDOUT: %.loc8_32.1: i32 = value_of_initializer %int.uadd.loc8 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_32.2: i32 = converted %int.uadd.loc8, %.loc8_32.1 [template = constants.%.4] +// CHECK:STDOUT: %Add.ref.loc8: Add = name_ref Add, %Add.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc8_18: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %int.uadd.loc8: init i32 = call %Add.ref.loc8(%.loc8_18, %.loc8_30) [template = constants.%.5] +// CHECK:STDOUT: %.loc8_32.1: i32 = value_of_initializer %int.uadd.loc8 [template = constants.%.5] +// CHECK:STDOUT: %.loc8_32.2: i32 = converted %int.uadd.loc8, %.loc8_32.1 [template = constants.%.5] // CHECK:STDOUT: %b.loc8: i32 = bind_name b, %.loc8_32.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/udiv.carbon b/toolchain/check/testdata/builtins/int/udiv.carbon index 7c0847d23085..3f5a18e21509 100644 --- a/toolchain/check/testdata/builtins/int/udiv.carbon +++ b/toolchain/check/testdata/builtins/int/udiv.carbon @@ -52,42 +52,47 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: --- int_div.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 1] [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Div = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 1] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Div = %Div +// CHECK:STDOUT: .Div = %Div.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div: = fn_decl @Div [template] { +// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Div.ref: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.udiv: init i32 = call %Div.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %int.udiv, i32 [template = constants.%.4] +// CHECK:STDOUT: %Div.ref: Div = name_ref Div, %Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.udiv: init i32 = call %Div.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.udiv, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 1] = var arr // CHECK:STDOUT: %arr: ref [i32; 1] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 1] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 1] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 1] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 1]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 1]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -100,7 +105,7 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Div.ref: = name_ref Div, file.%Div [template = file.%Div] +// CHECK:STDOUT: %Div.ref: Div = name_ref Div, file.%Div.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.udiv: init i32 = call %Div.ref(%a.ref, %b.ref) @@ -112,91 +117,98 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: --- overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal -1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.6: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Div = struct_value () [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.3: Negate = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal -1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.7: i32 = int_literal -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Div = %Div -// CHECK:STDOUT: .Sub = %Sub -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Div = %Div.decl +// CHECK:STDOUT: .Sub = %Sub.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div: = fn_decl @Div [template] { +// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { +// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc6_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc6_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Div.ref.loc9: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %Negate.ref.loc9_18: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] -// CHECK:STDOUT: %Negate.ref.loc9_39: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %int.unegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.unegate.loc9_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.2: i32 = converted %int.unegate.loc9_24, %.loc9_17.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %int.unegate.loc9_45 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.4: i32 = converted %int.unegate.loc9_45, %.loc9_17.3 [template = constants.%.4] -// CHECK:STDOUT: %int.udiv.loc9: init i32 = call %Div.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.udiv.loc9 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.udiv.loc9, %.loc9_49.1 [template = constants.%.5] +// CHECK:STDOUT: %Div.ref.loc9: Div = name_ref Div, %Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc9_18: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.3] +// CHECK:STDOUT: %Negate.ref.loc9_39: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %int.unegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.5] +// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.unegate.loc9_24 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_17.2: i32 = converted %int.unegate.loc9_24, %.loc9_17.1 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %int.unegate.loc9_45 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_17.4: i32 = converted %int.unegate.loc9_45, %.loc9_17.3 [template = constants.%.5] +// CHECK:STDOUT: %int.udiv.loc9: init i32 = call %Div.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.6] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.udiv.loc9 [template = constants.%.6] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.udiv.loc9, %.loc9_49.1 [template = constants.%.6] // CHECK:STDOUT: %a.loc9: i32 = bind_name a, %.loc9_49.2 -// CHECK:STDOUT: %Div.ref.loc12: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %Sub.ref.loc12: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.unegate.loc12 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.unegate.loc12, %.loc12_21.1 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_47: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %int.usub.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_17.2: i32 = converted %int.usub.loc12, %.loc12_17.1 [template = constants.%.6] -// CHECK:STDOUT: %int.udiv.loc12: init i32 = call %Div.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.udiv.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.udiv.loc12, %.loc12_49.1 [template = constants.%.6] +// CHECK:STDOUT: %Div.ref.loc12: Div = name_ref Div, %Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref.loc12: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.3] +// CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.unegate.loc12 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.unegate.loc12, %.loc12_21.1 [template = constants.%.3] +// CHECK:STDOUT: %int.usub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.7] +// CHECK:STDOUT: %.loc12_47: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %int.usub.loc12 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_17.2: i32 = converted %int.usub.loc12, %.loc12_17.1 [template = constants.%.7] +// CHECK:STDOUT: %int.udiv.loc12: init i32 = call %Div.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.7] +// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.udiv.loc12 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.udiv.loc12, %.loc12_49.1 [template = constants.%.7] // CHECK:STDOUT: %b.loc12: i32 = bind_name b, %.loc12_49.2 -// CHECK:STDOUT: %Div.ref.loc15: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %Sub.ref.loc15: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Negate.ref.loc15_22: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc15_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc15_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_21.2: i32 = converted %int.unegate.loc15_28, %.loc15_21.1 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc15: init i32 = call %Sub.ref.loc15(%.loc15_21.2, %.loc15_43) [template = constants.%.6] -// CHECK:STDOUT: %Negate.ref.loc15_47: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc15_54: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %int.unegate.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc15_17.1: i32 = value_of_initializer %int.usub.loc15 [template = constants.%.6] -// CHECK:STDOUT: %.loc15_17.2: i32 = converted %int.usub.loc15, %.loc15_17.1 [template = constants.%.6] -// CHECK:STDOUT: %.loc15_17.3: i32 = value_of_initializer %int.unegate.loc15_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc15_17.4: i32 = converted %int.unegate.loc15_53, %.loc15_17.3 [template = constants.%.4] -// CHECK:STDOUT: %int.udiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_17.2, %.loc15_17.4) [template = constants.%.5] -// CHECK:STDOUT: %.loc15_57.1: i32 = value_of_initializer %int.udiv.loc15 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_57.2: i32 = converted %int.udiv.loc15, %.loc15_57.1 [template = constants.%.5] +// CHECK:STDOUT: %Div.ref.loc15: Div = name_ref Div, %Div.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref.loc15: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc15_22: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc15_29: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29) [template = constants.%.3] +// CHECK:STDOUT: %.loc15_43: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_21.2: i32 = converted %int.unegate.loc15_28, %.loc15_21.1 [template = constants.%.3] +// CHECK:STDOUT: %int.usub.loc15: init i32 = call %Sub.ref.loc15(%.loc15_21.2, %.loc15_43) [template = constants.%.7] +// CHECK:STDOUT: %Negate.ref.loc15_47: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc15_54: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %int.unegate.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54) [template = constants.%.5] +// CHECK:STDOUT: %.loc15_17.1: i32 = value_of_initializer %int.usub.loc15 [template = constants.%.7] +// CHECK:STDOUT: %.loc15_17.2: i32 = converted %int.usub.loc15, %.loc15_17.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc15_17.3: i32 = value_of_initializer %int.unegate.loc15_53 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_17.4: i32 = converted %int.unegate.loc15_53, %.loc15_17.3 [template = constants.%.5] +// CHECK:STDOUT: %int.udiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_17.2, %.loc15_17.4) [template = constants.%.6] +// CHECK:STDOUT: %.loc15_57.1: i32 = value_of_initializer %int.udiv.loc15 [template = constants.%.6] +// CHECK:STDOUT: %.loc15_57.2: i32 = converted %int.udiv.loc15, %.loc15_57.1 [template = constants.%.6] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc15_57.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -209,33 +221,36 @@ let b: i32 = Div(0, 0); // CHECK:STDOUT: --- fail_div_by_zero.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %Div: type = fn_type @Div [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Div = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Div = %Div +// CHECK:STDOUT: .Div = %Div.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Div: = fn_decl @Div [template] { +// CHECK:STDOUT: %Div.decl: Div = fn_decl @Div [template = constants.%struct] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Div.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Div.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Div.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Div.ref.loc10: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %.loc10_18: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_21: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %Div.ref.loc10: Div = name_ref Div, %Div.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc10_18: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.udiv.loc10: init i32 = call %Div.ref.loc10(%.loc10_18, %.loc10_21) [template = ] // CHECK:STDOUT: %.loc10_23.1: i32 = value_of_initializer %int.udiv.loc10 [template = ] // CHECK:STDOUT: %.loc10_23.2: i32 = converted %int.udiv.loc10, %.loc10_23.1 [template = ] // CHECK:STDOUT: %a.loc10: i32 = bind_name a, %.loc10_23.2 -// CHECK:STDOUT: %Div.ref.loc15: = name_ref Div, %Div [template = %Div] -// CHECK:STDOUT: %.loc15_18: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %Div.ref.loc15: Div = name_ref Div, %Div.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc15_18: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.udiv.loc15: init i32 = call %Div.ref.loc15(%.loc15_18, %.loc15_21) [template = ] // CHECK:STDOUT: %.loc15_23.1: i32 = value_of_initializer %int.udiv.loc15 [template = ] // CHECK:STDOUT: %.loc15_23.2: i32 = converted %int.udiv.loc15, %.loc15_23.1 [template = ] diff --git a/toolchain/check/testdata/builtins/int/umod.carbon b/toolchain/check/testdata/builtins/int/umod.carbon index 8c06062942bd..305dbf472622 100644 --- a/toolchain/check/testdata/builtins/int/umod.carbon +++ b/toolchain/check/testdata/builtins/int/umod.carbon @@ -54,42 +54,47 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: --- int_div.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 2] [template] +// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Mod = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 2] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Mod = %Mod +// CHECK:STDOUT: .Mod = %Mod.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mod: = fn_decl @Mod [template] { +// CHECK:STDOUT: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mod.ref: = name_ref Mod, %Mod [template = %Mod] -// CHECK:STDOUT: %.loc4_20: i32 = int_literal 5 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %int.umod: init i32 = call %Mod.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %int.umod, i32 [template = constants.%.4] +// CHECK:STDOUT: %Mod.ref: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_20: i32 = int_literal 5 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_23: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: %int.umod: init i32 = call %Mod.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.umod, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 2] = var arr // CHECK:STDOUT: %arr: ref [i32; 2] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 2] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 2] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 2] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 2]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 2]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -102,7 +107,7 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mod.ref: = name_ref Mod, file.%Mod [template = file.%Mod] +// CHECK:STDOUT: %Mod.ref: Mod = name_ref Mod, file.%Mod.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.umod: init i32 = call %Mod.ref(%a.ref, %b.ref) @@ -114,91 +119,98 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: --- overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal -1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal -2147483648 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] +// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Mod = struct_value () [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %struct.3: Negate = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal -1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Mod = %Mod -// CHECK:STDOUT: .Sub = %Sub -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Mod = %Mod.decl +// CHECK:STDOUT: .Sub = %Sub.decl +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mod: = fn_decl @Mod [template] { +// CHECK:STDOUT: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { +// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc6_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc6_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mod.ref.loc9: = name_ref Mod, %Mod [template = %Mod] -// CHECK:STDOUT: %Negate.ref.loc9_18: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.2] -// CHECK:STDOUT: %Negate.ref.loc9_39: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %int.unegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.unegate.loc9_24 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.2: i32 = converted %int.unegate.loc9_24, %.loc9_17.1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %int.unegate.loc9_45 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_17.4: i32 = converted %int.unegate.loc9_45, %.loc9_17.3 [template = constants.%.4] -// CHECK:STDOUT: %int.umod.loc9: init i32 = call %Mod.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.2] -// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.umod.loc9 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.umod.loc9, %.loc9_49.1 [template = constants.%.2] +// CHECK:STDOUT: %Mod.ref.loc9: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc9_18: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_25: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc9_24: init i32 = call %Negate.ref.loc9_18(%.loc9_25) [template = constants.%.3] +// CHECK:STDOUT: %Negate.ref.loc9_39: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_46: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %int.unegate.loc9_45: init i32 = call %Negate.ref.loc9_39(%.loc9_46) [template = constants.%.5] +// CHECK:STDOUT: %.loc9_17.1: i32 = value_of_initializer %int.unegate.loc9_24 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_17.2: i32 = converted %int.unegate.loc9_24, %.loc9_17.1 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_17.3: i32 = value_of_initializer %int.unegate.loc9_45 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_17.4: i32 = converted %int.unegate.loc9_45, %.loc9_17.3 [template = constants.%.5] +// CHECK:STDOUT: %int.umod.loc9: init i32 = call %Mod.ref.loc9(%.loc9_17.2, %.loc9_17.4) [template = constants.%.3] +// CHECK:STDOUT: %.loc9_49.1: i32 = value_of_initializer %int.umod.loc9 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_49.2: i32 = converted %int.umod.loc9, %.loc9_49.1 [template = constants.%.3] // CHECK:STDOUT: %a.loc9: i32 = bind_name a, %.loc9_49.2 -// CHECK:STDOUT: %Mod.ref.loc12: = name_ref Mod, %Mod [template = %Mod] -// CHECK:STDOUT: %Sub.ref.loc12: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Negate.ref.loc12: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.unegate.loc12 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.unegate.loc12, %.loc12_21.1 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.5] -// CHECK:STDOUT: %.loc12_47: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %int.usub.loc12 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_17.2: i32 = converted %int.usub.loc12, %.loc12_17.1 [template = constants.%.5] -// CHECK:STDOUT: %int.umod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.6] -// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.umod.loc12 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.umod.loc12, %.loc12_49.1 [template = constants.%.6] +// CHECK:STDOUT: %Mod.ref.loc12: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref.loc12: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc12: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc12_29: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc12: init i32 = call %Negate.ref.loc12(%.loc12_29) [template = constants.%.3] +// CHECK:STDOUT: %.loc12_43: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_21.1: i32 = value_of_initializer %int.unegate.loc12 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_21.2: i32 = converted %int.unegate.loc12, %.loc12_21.1 [template = constants.%.3] +// CHECK:STDOUT: %int.usub.loc12: init i32 = call %Sub.ref.loc12(%.loc12_21.2, %.loc12_43) [template = constants.%.6] +// CHECK:STDOUT: %.loc12_47: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_17.1: i32 = value_of_initializer %int.usub.loc12 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_17.2: i32 = converted %int.usub.loc12, %.loc12_17.1 [template = constants.%.6] +// CHECK:STDOUT: %int.umod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_17.2, %.loc12_47) [template = constants.%.7] +// CHECK:STDOUT: %.loc12_49.1: i32 = value_of_initializer %int.umod.loc12 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_49.2: i32 = converted %int.umod.loc12, %.loc12_49.1 [template = constants.%.7] // CHECK:STDOUT: %b.loc12: i32 = bind_name b, %.loc12_49.2 -// CHECK:STDOUT: %Mod.ref.loc15: = name_ref Mod, %Mod [template = %Mod] -// CHECK:STDOUT: %Sub.ref.loc15: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Negate.ref.loc15_22: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc15_29: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29) [template = constants.%.2] -// CHECK:STDOUT: %.loc15_43: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_21.2: i32 = converted %int.unegate.loc15_28, %.loc15_21.1 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc15: init i32 = call %Sub.ref.loc15(%.loc15_21.2, %.loc15_43) [template = constants.%.5] -// CHECK:STDOUT: %Negate.ref.loc15_47: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc15_54: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %int.unegate.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54) [template = constants.%.4] -// CHECK:STDOUT: %.loc15_17.1: i32 = value_of_initializer %int.usub.loc15 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_17.2: i32 = converted %int.usub.loc15, %.loc15_17.1 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_17.3: i32 = value_of_initializer %int.unegate.loc15_53 [template = constants.%.4] -// CHECK:STDOUT: %.loc15_17.4: i32 = converted %int.unegate.loc15_53, %.loc15_17.3 [template = constants.%.4] -// CHECK:STDOUT: %int.umod.loc15: init i32 = call %Mod.ref.loc15(%.loc15_17.2, %.loc15_17.4) [template = constants.%.5] -// CHECK:STDOUT: %.loc15_57.1: i32 = value_of_initializer %int.umod.loc15 [template = constants.%.5] -// CHECK:STDOUT: %.loc15_57.2: i32 = converted %int.umod.loc15, %.loc15_57.1 [template = constants.%.5] +// CHECK:STDOUT: %Mod.ref.loc15: Mod = name_ref Mod, %Mod.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref.loc15: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc15_22: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc15_29: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc15_28: init i32 = call %Negate.ref.loc15_22(%.loc15_29) [template = constants.%.3] +// CHECK:STDOUT: %.loc15_43: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %int.unegate.loc15_28 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_21.2: i32 = converted %int.unegate.loc15_28, %.loc15_21.1 [template = constants.%.3] +// CHECK:STDOUT: %int.usub.loc15: init i32 = call %Sub.ref.loc15(%.loc15_21.2, %.loc15_43) [template = constants.%.6] +// CHECK:STDOUT: %Negate.ref.loc15_47: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc15_54: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %int.unegate.loc15_53: init i32 = call %Negate.ref.loc15_47(%.loc15_54) [template = constants.%.5] +// CHECK:STDOUT: %.loc15_17.1: i32 = value_of_initializer %int.usub.loc15 [template = constants.%.6] +// CHECK:STDOUT: %.loc15_17.2: i32 = converted %int.usub.loc15, %.loc15_17.1 [template = constants.%.6] +// CHECK:STDOUT: %.loc15_17.3: i32 = value_of_initializer %int.unegate.loc15_53 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_17.4: i32 = converted %int.unegate.loc15_53, %.loc15_17.3 [template = constants.%.5] +// CHECK:STDOUT: %int.umod.loc15: init i32 = call %Mod.ref.loc15(%.loc15_17.2, %.loc15_17.4) [template = constants.%.6] +// CHECK:STDOUT: %.loc15_57.1: i32 = value_of_initializer %int.umod.loc15 [template = constants.%.6] +// CHECK:STDOUT: %.loc15_57.2: i32 = converted %int.umod.loc15, %.loc15_57.1 [template = constants.%.6] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc15_57.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -211,33 +223,36 @@ let b: i32 = Mod(0, 0); // CHECK:STDOUT: --- fail_div_by_zero.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %Mod: type = fn_type @Mod [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Mod = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Mod = %Mod +// CHECK:STDOUT: .Mod = %Mod.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mod: = fn_decl @Mod [template] { +// CHECK:STDOUT: %Mod.decl: Mod = fn_decl @Mod [template = constants.%struct] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Mod.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mod.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Mod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mod.ref.loc12: = name_ref Mod, %Mod [template = %Mod] -// CHECK:STDOUT: %.loc12_18: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc12_21: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %Mod.ref.loc12: Mod = name_ref Mod, %Mod.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc12_18: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.umod.loc12: init i32 = call %Mod.ref.loc12(%.loc12_18, %.loc12_21) [template = ] // CHECK:STDOUT: %.loc12_23.1: i32 = value_of_initializer %int.umod.loc12 [template = ] // CHECK:STDOUT: %.loc12_23.2: i32 = converted %int.umod.loc12, %.loc12_23.1 [template = ] // CHECK:STDOUT: %a.loc12: i32 = bind_name a, %.loc12_23.2 -// CHECK:STDOUT: %Mod.ref.loc17: = name_ref Mod, %Mod [template = %Mod] -// CHECK:STDOUT: %.loc17_18: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc17_21: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %Mod.ref.loc17: Mod = name_ref Mod, %Mod.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc17_18: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc17_21: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %int.umod.loc17: init i32 = call %Mod.ref.loc17(%.loc17_18, %.loc17_21) [template = ] // CHECK:STDOUT: %.loc17_23.1: i32 = value_of_initializer %int.umod.loc17 [template = ] // CHECK:STDOUT: %.loc17_23.2: i32 = converted %int.umod.loc17, %.loc17_23.1 [template = ] diff --git a/toolchain/check/testdata/builtins/int/umul.carbon b/toolchain/check/testdata/builtins/int/umul.carbon index fdbbea802f9d..792630216c20 100644 --- a/toolchain/check/testdata/builtins/int/umul.carbon +++ b/toolchain/check/testdata/builtins/int/umul.carbon @@ -27,42 +27,47 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: --- int_mul.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 6 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 6] [template] +// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Mul = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 6 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 6] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Mul = %Mul +// CHECK:STDOUT: .Mul = %Mul.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mul: = fn_decl @Mul [template] { +// CHECK:STDOUT: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Mul.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Mul.%b: i32 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Mul.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mul.ref: = name_ref Mul, %Mul [template = %Mul] -// CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.umul: init i32 = call %Mul.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %int.umul, i32 [template = constants.%.4] +// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, %Mul.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.umul: init i32 = call %Mul.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.umul, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 6] = var arr // CHECK:STDOUT: %arr: ref [i32; 6] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 6 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 6] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 6 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 6] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 6] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 6]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 6]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -75,7 +80,7 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Mul.ref: = name_ref Mul, file.%Mul [template = file.%Mul] +// CHECK:STDOUT: %Mul.ref: Mul = name_ref Mul, file.%Mul.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.umul: init i32 = call %Mul.ref(%a.ref, %b.ref) @@ -87,39 +92,42 @@ let b: i32 = Mul(0x8000, 0x10000); // CHECK:STDOUT: --- overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 32767 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 65536 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2147418112 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 32768 [template] -// CHECK:STDOUT: %.5: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %Mul: type = fn_type @Mul [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Mul = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 32767 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 65536 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2147418112 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 32768 [template] +// CHECK:STDOUT: %.6: i32 = int_literal -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Mul = %Mul +// CHECK:STDOUT: .Mul = %Mul.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mul: = fn_decl @Mul [template] { +// CHECK:STDOUT: %Mul.decl: Mul = fn_decl @Mul [template = constants.%struct] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Mul.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Mul.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Mul.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Mul.ref.loc6: = name_ref Mul, %Mul [template = %Mul] -// CHECK:STDOUT: %.loc6_18: i32 = int_literal 32767 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_26: i32 = int_literal 65536 [template = constants.%.2] -// CHECK:STDOUT: %int.umul.loc6: init i32 = call %Mul.ref.loc6(%.loc6_18, %.loc6_26) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %int.umul.loc6 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_34.2: i32 = converted %int.umul.loc6, %.loc6_34.1 [template = constants.%.3] +// CHECK:STDOUT: %Mul.ref.loc6: Mul = name_ref Mul, %Mul.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc6_18: i32 = int_literal 32767 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_26: i32 = int_literal 65536 [template = constants.%.3] +// CHECK:STDOUT: %int.umul.loc6: init i32 = call %Mul.ref.loc6(%.loc6_18, %.loc6_26) [template = constants.%.4] +// CHECK:STDOUT: %.loc6_34.1: i32 = value_of_initializer %int.umul.loc6 [template = constants.%.4] +// CHECK:STDOUT: %.loc6_34.2: i32 = converted %int.umul.loc6, %.loc6_34.1 [template = constants.%.4] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_34.2 -// CHECK:STDOUT: %Mul.ref.loc7: = name_ref Mul, %Mul [template = %Mul] -// CHECK:STDOUT: %.loc7_18: i32 = int_literal 32768 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 65536 [template = constants.%.2] -// CHECK:STDOUT: %int.umul.loc7: init i32 = call %Mul.ref.loc7(%.loc7_18, %.loc7_26) [template = constants.%.5] -// CHECK:STDOUT: %.loc7_34.1: i32 = value_of_initializer %int.umul.loc7 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_34.2: i32 = converted %int.umul.loc7, %.loc7_34.1 [template = constants.%.5] +// CHECK:STDOUT: %Mul.ref.loc7: Mul = name_ref Mul, %Mul.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc7_18: i32 = int_literal 32768 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 65536 [template = constants.%.3] +// CHECK:STDOUT: %int.umul.loc7: init i32 = call %Mul.ref.loc7(%.loc7_18, %.loc7_26) [template = constants.%.6] +// CHECK:STDOUT: %.loc7_34.1: i32 = value_of_initializer %int.umul.loc7 [template = constants.%.6] +// CHECK:STDOUT: %.loc7_34.2: i32 = converted %int.umul.loc7, %.loc7_34.1 [template = constants.%.6] // CHECK:STDOUT: %b.loc7: i32 = bind_name b, %.loc7_34.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/unegate.carbon b/toolchain/check/testdata/builtins/int/unegate.carbon index ebf198b88675..8b30041b807f 100644 --- a/toolchain/check/testdata/builtins/int/unegate.carbon +++ b/toolchain/check/testdata/builtins/int/unegate.carbon @@ -111,50 +111,55 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- int_negate.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 123 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -123 [template] -// CHECK:STDOUT: %.3: type = array_type %.1, i32 [template] -// CHECK:STDOUT: %.4: type = ptr_type [i32; 123] [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.6: i32 = int_literal -1 [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Negate = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 123 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -123 [template] +// CHECK:STDOUT: %.4: type = array_type %.2, i32 [template] +// CHECK:STDOUT: %.5: type = ptr_type [i32; 123] [template] +// CHECK:STDOUT: %.6: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.7: i32 = int_literal -1 [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Negate = %Negate +// CHECK:STDOUT: .Negate = %Negate.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc2_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref.loc4_16: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %Negate.ref.loc4_23: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc4_30: i32 = int_literal 123 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30) [template = constants.%.2] -// CHECK:STDOUT: %.loc4_22.1: i32 = value_of_initializer %int.unegate.loc4_29 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_22.2: i32 = converted %int.unegate.loc4_29, %.loc4_22.1 [template = constants.%.2] -// CHECK:STDOUT: %int.unegate.loc4_22: init i32 = call %Negate.ref.loc4_16(%.loc4_22.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc4_35: type = array_type %int.unegate.loc4_22, i32 [template = constants.%.3] +// CHECK:STDOUT: %Negate.ref.loc4_16: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc4_23: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_30: i32 = int_literal 123 [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc4_29: init i32 = call %Negate.ref.loc4_23(%.loc4_30) [template = constants.%.3] +// CHECK:STDOUT: %.loc4_22.1: i32 = value_of_initializer %int.unegate.loc4_29 [template = constants.%.3] +// CHECK:STDOUT: %.loc4_22.2: i32 = converted %int.unegate.loc4_29, %.loc4_22.1 [template = constants.%.3] +// CHECK:STDOUT: %int.unegate.loc4_22: init i32 = call %Negate.ref.loc4_16(%.loc4_22.2) [template = constants.%.2] +// CHECK:STDOUT: %.loc4_35: type = array_type %int.unegate.loc4_22, i32 [template = constants.%.4] // CHECK:STDOUT: %arr.var: ref [i32; 123] = var arr // CHECK:STDOUT: %arr: ref [i32; 123] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 123 [template = constants.%.1] -// CHECK:STDOUT: %.loc5_21: type = array_type %.loc5_18, i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_22: type = ptr_type [i32; 123] [template = constants.%.4] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 123 [template = constants.%.2] +// CHECK:STDOUT: %.loc5_21: type = array_type %.loc5_18, i32 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_22: type = ptr_type [i32; 123] [template = constants.%.5] // CHECK:STDOUT: %arr.ref: ref [i32; 123] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_26: [i32; 123]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 123]* = bind_name arr_p, %.loc5_26 -// CHECK:STDOUT: %Negate.ref.loc7: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc7_21: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %int.unegate.loc7: init i32 = call %Negate.ref.loc7(%.loc7_21) [template = constants.%.6] -// CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %int.unegate.loc7 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_23.2: i32 = converted %int.unegate.loc7, %.loc7_23.1 [template = constants.%.6] +// CHECK:STDOUT: %Negate.ref.loc7: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc7_21: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %int.unegate.loc7: init i32 = call %Negate.ref.loc7(%.loc7_21) [template = constants.%.7] +// CHECK:STDOUT: %.loc7_23.1: i32 = value_of_initializer %int.unegate.loc7 [template = constants.%.7] +// CHECK:STDOUT: %.loc7_23.2: i32 = converted %int.unegate.loc7, %.loc7_23.1 [template = constants.%.7] // CHECK:STDOUT: %n: i32 = bind_name n, %.loc7_23.2 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc9_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc9_16.1 // CHECK:STDOUT: %b.loc9_24.1: i32 = param b @@ -167,7 +172,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Negate.ref: = name_ref Negate, file.%Negate [template = file.%Negate] +// CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, file.%Negate.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %int.unegate: init i32 = call %Negate.ref(%a.ref) // CHECK:STDOUT: %.loc10_19.1: i32 = value_of_initializer %int.unegate @@ -178,74 +183,89 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- fail_bad_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] +// CHECK:STDOUT: %TooFew: type = fn_type @TooFew [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: TooFew = struct_value () [template] +// CHECK:STDOUT: %TooMany: type = fn_type @TooMany [template] +// CHECK:STDOUT: %struct.2: TooMany = struct_value () [template] +// CHECK:STDOUT: %BadReturnType: type = fn_type @BadReturnType [template] +// CHECK:STDOUT: %struct.3: BadReturnType = struct_value () [template] +// CHECK:STDOUT: %JustRight: type = fn_type @JustRight [template] +// CHECK:STDOUT: %struct.4: JustRight = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %RuntimeCallTooFew: type = fn_type @RuntimeCallTooFew [template] +// CHECK:STDOUT: %struct.5: RuntimeCallTooFew = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallTooMany: type = fn_type @RuntimeCallTooMany [template] +// CHECK:STDOUT: %struct.6: RuntimeCallTooMany = struct_value () [template] +// CHECK:STDOUT: %RuntimeCallBadReturnType: type = fn_type @RuntimeCallBadReturnType [template] +// CHECK:STDOUT: %struct.7: RuntimeCallBadReturnType = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .TooFew = %TooFew -// CHECK:STDOUT: .TooMany = %TooMany -// CHECK:STDOUT: .BadReturnType = %BadReturnType -// CHECK:STDOUT: .JustRight = %JustRight +// CHECK:STDOUT: .TooFew = %TooFew.decl +// CHECK:STDOUT: .TooMany = %TooMany.decl +// CHECK:STDOUT: .BadReturnType = %BadReturnType.decl +// CHECK:STDOUT: .JustRight = %JustRight.decl // CHECK:STDOUT: .too_few = %too_few // CHECK:STDOUT: .too_many = %too_many // CHECK:STDOUT: .bad_return_type = %bad_return_type // CHECK:STDOUT: .bad_call = %bad_call -// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew -// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany -// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType +// CHECK:STDOUT: .RuntimeCallTooFew = %RuntimeCallTooFew.decl +// CHECK:STDOUT: .RuntimeCallTooMany = %RuntimeCallTooMany.decl +// CHECK:STDOUT: .RuntimeCallBadReturnType = %RuntimeCallBadReturnType.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %TooFew: = fn_decl @TooFew [template] { +// CHECK:STDOUT: %TooFew.decl: TooFew = fn_decl @TooFew [template = constants.%struct.1] { // CHECK:STDOUT: @TooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooMany: = fn_decl @TooMany [template] { +// CHECK:STDOUT: %TooMany.decl: TooMany = fn_decl @TooMany [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc13_12.1: i32 = param a // CHECK:STDOUT: @TooMany.%a: i32 = bind_name a, %a.loc13_12.1 // CHECK:STDOUT: %b.loc13_20.1: i32 = param b // CHECK:STDOUT: @TooMany.%b: i32 = bind_name b, %b.loc13_20.1 // CHECK:STDOUT: @TooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %BadReturnType: = fn_decl @BadReturnType [template] { +// CHECK:STDOUT: %BadReturnType.decl: BadReturnType = fn_decl @BadReturnType [template = constants.%struct.3] { // CHECK:STDOUT: %a.loc18_18.1: i32 = param a // CHECK:STDOUT: @BadReturnType.%a: i32 = bind_name a, %a.loc18_18.1 // CHECK:STDOUT: @BadReturnType.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %JustRight: = fn_decl @JustRight [template] { +// CHECK:STDOUT: %JustRight.decl: JustRight = fn_decl @JustRight [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc19_14.1: i32 = param a // CHECK:STDOUT: @JustRight.%a: i32 = bind_name a, %a.loc19_14.1 // CHECK:STDOUT: @JustRight.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, %TooFew [template = %TooFew] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, %TooFew.decl [template = constants.%struct.1] // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref() // CHECK:STDOUT: %too_few.var: ref = var too_few // CHECK:STDOUT: %too_few: ref = bind_name too_few, %too_few.var -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, %TooMany [template = %TooMany] -// CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, %TooMany.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc30_29: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc30_32: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %TooMany.call: init i32 = call %TooMany.ref(%.loc30_29, %.loc30_32) // CHECK:STDOUT: %too_many.var: ref = var too_many // CHECK:STDOUT: %too_many: ref = bind_name too_many, %too_many.var -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, %BadReturnType [template = %BadReturnType] -// CHECK:STDOUT: %.loc35: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, %BadReturnType.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc35: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref(%.loc35) // CHECK:STDOUT: %bad_return_type.var: ref = var bad_return_type // CHECK:STDOUT: %bad_return_type: ref = bind_name bad_return_type, %bad_return_type.var -// CHECK:STDOUT: %JustRight.ref: = name_ref JustRight, %JustRight [template = %JustRight] -// CHECK:STDOUT: %.loc44_31: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc44_34: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %JustRight.ref: JustRight = name_ref JustRight, %JustRight.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc44_31: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc44_34: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %int.unegate: init i32 = call %JustRight.ref() [template = ] // CHECK:STDOUT: %.loc44_36: type = array_type %int.unegate, i32 [template = ] // CHECK:STDOUT: %bad_call.var: ref = var bad_call // CHECK:STDOUT: %bad_call: ref = bind_name bad_call, %bad_call.var -// CHECK:STDOUT: %RuntimeCallTooFew: = fn_decl @RuntimeCallTooFew [template] { +// CHECK:STDOUT: %RuntimeCallTooFew.decl: RuntimeCallTooFew = fn_decl @RuntimeCallTooFew [template = constants.%struct.5] { // CHECK:STDOUT: %a.loc46_22.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooFew.%a: i32 = bind_name a, %a.loc46_22.1 // CHECK:STDOUT: @RuntimeCallTooFew.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallTooMany: = fn_decl @RuntimeCallTooMany [template] { +// CHECK:STDOUT: %RuntimeCallTooMany.decl: RuntimeCallTooMany = fn_decl @RuntimeCallTooMany [template = constants.%struct.6] { // CHECK:STDOUT: %a.loc57_23.1: i32 = param a // CHECK:STDOUT: @RuntimeCallTooMany.%a: i32 = bind_name a, %a.loc57_23.1 // CHECK:STDOUT: %b.loc57_31.1: i32 = param b @@ -254,7 +274,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: @RuntimeCallTooMany.%c: i32 = bind_name c, %c.loc57_39.1 // CHECK:STDOUT: @RuntimeCallTooMany.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %RuntimeCallBadReturnType: = fn_decl @RuntimeCallBadReturnType [template] { +// CHECK:STDOUT: %RuntimeCallBadReturnType.decl: RuntimeCallBadReturnType = fn_decl @RuntimeCallBadReturnType [template = constants.%struct.7] { // CHECK:STDOUT: %a.loc68_29.1: i32 = param a // CHECK:STDOUT: @RuntimeCallBadReturnType.%a: i32 = bind_name a, %a.loc68_29.1 // CHECK:STDOUT: %b.loc68_37.1: i32 = param b @@ -273,7 +293,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooFew(%a: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooFew.ref: = name_ref TooFew, file.%TooFew [template = file.%TooFew] +// CHECK:STDOUT: %TooFew.ref: TooFew = name_ref TooFew, file.%TooFew.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %TooFew.call: init i32 = call %TooFew.ref() [template = ] // CHECK:STDOUT: %.loc54_19.1: i32 = value_of_initializer %TooFew.call [template = ] @@ -283,7 +303,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallTooMany(%a: i32, %b: i32, %c: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TooMany.ref: = name_ref TooMany, file.%TooMany [template = file.%TooMany] +// CHECK:STDOUT: %TooMany.ref: TooMany = name_ref TooMany, file.%TooMany.decl [template = constants.%struct.2] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %c.ref: i32 = name_ref c, %c @@ -295,7 +315,7 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCallBadReturnType(%a: i32, %b: i32) -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %BadReturnType.ref: = name_ref BadReturnType, file.%BadReturnType [template = file.%BadReturnType] +// CHECK:STDOUT: %BadReturnType.ref: BadReturnType = name_ref BadReturnType, file.%BadReturnType.decl [template = constants.%struct.3] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %BadReturnType.call: init bool = call %BadReturnType.ref() [template = ] @@ -307,55 +327,60 @@ let b: i32 = Negate(Sub(Negate(0x7FFFFFFF), 1)); // CHECK:STDOUT: --- overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 2147483647 [template] -// CHECK:STDOUT: %.2: i32 = int_literal -2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %Negate: type = fn_type @Negate [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Negate = struct_value () [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %struct.2: Sub = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] +// CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal -2147483648 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Negate = %Negate -// CHECK:STDOUT: .Sub = %Sub +// CHECK:STDOUT: .Negate = %Negate.decl +// CHECK:STDOUT: .Sub = %Sub.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Negate: = fn_decl @Negate [template] { +// CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc4_11.1: i32 = param a // CHECK:STDOUT: @Negate.%a: i32 = bind_name a, %a.loc4_11.1 // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { +// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc5_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc5_8.1 // CHECK:STDOUT: %b.loc5_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc5_16.1 // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Negate.ref.loc8_14: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %Negate.ref.loc8_21: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc8_28: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28) [template = constants.%.2] -// CHECK:STDOUT: %.loc8_20.1: i32 = value_of_initializer %int.unegate.loc8_27 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_20.2: i32 = converted %int.unegate.loc8_27, %.loc8_20.1 [template = constants.%.2] -// CHECK:STDOUT: %int.unegate.loc8_20: init i32 = call %Negate.ref.loc8_14(%.loc8_20.2) [template = constants.%.1] -// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.unegate.loc8_20 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.unegate.loc8_20, %.loc8_40.1 [template = constants.%.1] +// CHECK:STDOUT: %Negate.ref.loc8_14: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Negate.ref.loc8_21: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc8_28: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc8_27: init i32 = call %Negate.ref.loc8_21(%.loc8_28) [template = constants.%.3] +// CHECK:STDOUT: %.loc8_20.1: i32 = value_of_initializer %int.unegate.loc8_27 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_20.2: i32 = converted %int.unegate.loc8_27, %.loc8_20.1 [template = constants.%.3] +// CHECK:STDOUT: %int.unegate.loc8_20: init i32 = call %Negate.ref.loc8_14(%.loc8_20.2) [template = constants.%.2] +// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.unegate.loc8_20 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.unegate.loc8_20, %.loc8_40.1 [template = constants.%.2] // CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8_40.2 -// CHECK:STDOUT: %Negate.ref.loc11_14: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %Sub.ref: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Negate.ref.loc11_25: = name_ref Negate, %Negate [template = %Negate] -// CHECK:STDOUT: %.loc11_32: i32 = int_literal 2147483647 [template = constants.%.1] -// CHECK:STDOUT: %int.unegate.loc11_31: init i32 = call %Negate.ref.loc11_25(%.loc11_32) [template = constants.%.2] -// CHECK:STDOUT: %.loc11_45: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %int.unegate.loc11_31 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_24.2: i32 = converted %int.unegate.loc11_31, %.loc11_24.1 [template = constants.%.2] -// CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%.loc11_24.2, %.loc11_45) [template = constants.%.4] -// CHECK:STDOUT: %.loc11_20.1: i32 = value_of_initializer %int.usub [template = constants.%.4] -// CHECK:STDOUT: %.loc11_20.2: i32 = converted %int.usub, %.loc11_20.1 [template = constants.%.4] -// CHECK:STDOUT: %int.unegate.loc11_20: init i32 = call %Negate.ref.loc11_14(%.loc11_20.2) [template = constants.%.4] -// CHECK:STDOUT: %.loc11_48.1: i32 = value_of_initializer %int.unegate.loc11_20 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_48.2: i32 = converted %int.unegate.loc11_20, %.loc11_48.1 [template = constants.%.4] +// CHECK:STDOUT: %Negate.ref.loc11_14: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.2] +// CHECK:STDOUT: %Negate.ref.loc11_25: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc11_32: i32 = int_literal 2147483647 [template = constants.%.2] +// CHECK:STDOUT: %int.unegate.loc11_31: init i32 = call %Negate.ref.loc11_25(%.loc11_32) [template = constants.%.3] +// CHECK:STDOUT: %.loc11_45: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %int.unegate.loc11_31 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_24.2: i32 = converted %int.unegate.loc11_31, %.loc11_24.1 [template = constants.%.3] +// CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%.loc11_24.2, %.loc11_45) [template = constants.%.5] +// CHECK:STDOUT: %.loc11_20.1: i32 = value_of_initializer %int.usub [template = constants.%.5] +// CHECK:STDOUT: %.loc11_20.2: i32 = converted %int.usub, %.loc11_20.1 [template = constants.%.5] +// CHECK:STDOUT: %int.unegate.loc11_20: init i32 = call %Negate.ref.loc11_14(%.loc11_20.2) [template = constants.%.5] +// CHECK:STDOUT: %.loc11_48.1: i32 = value_of_initializer %int.unegate.loc11_20 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_48.2: i32 = converted %int.unegate.loc11_20, %.loc11_48.1 [template = constants.%.5] // CHECK:STDOUT: %b.loc11: i32 = bind_name b, %.loc11_48.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/usub.carbon b/toolchain/check/testdata/builtins/int/usub.carbon index 867fc891748c..563a8b8efa1a 100644 --- a/toolchain/check/testdata/builtins/int/usub.carbon +++ b/toolchain/check/testdata/builtins/int/usub.carbon @@ -28,42 +28,47 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: --- int_sub.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 1] [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Sub = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 1] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Sub = %Sub +// CHECK:STDOUT: .Sub = %Sub.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { +// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.ref: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%.loc4_20, %.loc4_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_25: type = array_type %int.usub, i32 [template = constants.%.4] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, %Sub.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_20: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_23: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%.loc4_20, %.loc4_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_25: type = array_type %int.usub, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 1] = var arr // CHECK:STDOUT: %arr: ref [i32; 1] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 1] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 1] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 1] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 1]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 1]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -76,7 +81,7 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Sub.ref: = name_ref Sub, file.%Sub [template = file.%Sub] +// CHECK:STDOUT: %Sub.ref: Sub = name_ref Sub, file.%Sub.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.usub: init i32 = call %Sub.ref(%a.ref, %b.ref) @@ -88,57 +93,60 @@ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); // CHECK:STDOUT: --- overflow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2147483647 [template] -// CHECK:STDOUT: %.3: i32 = int_literal -2147483647 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal -2147483648 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %Sub: type = fn_type @Sub [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Sub = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2147483647 [template] +// CHECK:STDOUT: %.4: i32 = int_literal -2147483647 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal -2147483648 [template] +// CHECK:STDOUT: %.7: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Sub = %Sub +// CHECK:STDOUT: .Sub = %Sub.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Sub: = fn_decl @Sub [template] { +// CHECK:STDOUT: %Sub.decl: Sub = fn_decl @Sub [template = constants.%struct] { // CHECK:STDOUT: %a.loc4_8.1: i32 = param a // CHECK:STDOUT: @Sub.%a: i32 = bind_name a, %a.loc4_8.1 // CHECK:STDOUT: %b.loc4_16.1: i32 = param b // CHECK:STDOUT: @Sub.%b: i32 = bind_name b, %b.loc4_16.1 // CHECK:STDOUT: @Sub.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Sub.ref.loc6: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %.loc6_18: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc6_21: i32 = int_literal 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc6: init i32 = call %Sub.ref.loc6(%.loc6_18, %.loc6_21) [template = constants.%.3] -// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.usub.loc6 [template = constants.%.3] -// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.usub.loc6, %.loc6_32.1 [template = constants.%.3] +// CHECK:STDOUT: %Sub.ref.loc6: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc6_18: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_21: i32 = int_literal 2147483647 [template = constants.%.3] +// CHECK:STDOUT: %int.usub.loc6: init i32 = call %Sub.ref.loc6(%.loc6_18, %.loc6_21) [template = constants.%.4] +// CHECK:STDOUT: %.loc6_32.1: i32 = value_of_initializer %int.usub.loc6 [template = constants.%.4] +// CHECK:STDOUT: %.loc6_32.2: i32 = converted %int.usub.loc6, %.loc6_32.1 [template = constants.%.4] // CHECK:STDOUT: %a.loc6: i32 = bind_name a, %.loc6_32.2 -// CHECK:STDOUT: %Sub.ref.loc7_14: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Sub.ref.loc7_18: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_25: i32 = int_literal 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22, %.loc7_25) [template = constants.%.3] -// CHECK:STDOUT: %.loc7_38: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_17.1: i32 = value_of_initializer %int.usub.loc7_21 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_17.2: i32 = converted %int.usub.loc7_21, %.loc7_17.1 [template = constants.%.3] -// CHECK:STDOUT: %int.usub.loc7_17: init i32 = call %Sub.ref.loc7_14(%.loc7_17.2, %.loc7_38) [template = constants.%.5] -// CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %int.usub.loc7_17 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_40.2: i32 = converted %int.usub.loc7_17, %.loc7_40.1 [template = constants.%.5] +// CHECK:STDOUT: %Sub.ref.loc7_14: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %Sub.ref.loc7_18: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_25: i32 = int_literal 2147483647 [template = constants.%.3] +// CHECK:STDOUT: %int.usub.loc7_21: init i32 = call %Sub.ref.loc7_18(%.loc7_22, %.loc7_25) [template = constants.%.4] +// CHECK:STDOUT: %.loc7_38: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_17.1: i32 = value_of_initializer %int.usub.loc7_21 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_17.2: i32 = converted %int.usub.loc7_21, %.loc7_17.1 [template = constants.%.4] +// CHECK:STDOUT: %int.usub.loc7_17: init i32 = call %Sub.ref.loc7_14(%.loc7_17.2, %.loc7_38) [template = constants.%.6] +// CHECK:STDOUT: %.loc7_40.1: i32 = value_of_initializer %int.usub.loc7_17 [template = constants.%.6] +// CHECK:STDOUT: %.loc7_40.2: i32 = converted %int.usub.loc7_17, %.loc7_40.1 [template = constants.%.6] // CHECK:STDOUT: %b.loc7: i32 = bind_name b, %.loc7_40.2 -// CHECK:STDOUT: %Sub.ref.loc8_14: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %Sub.ref.loc8_18: = name_ref Sub, %Sub [template = %Sub] -// CHECK:STDOUT: %.loc8_22: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_25: i32 = int_literal 2147483647 [template = constants.%.2] -// CHECK:STDOUT: %int.usub.loc8_21: init i32 = call %Sub.ref.loc8_18(%.loc8_22, %.loc8_25) [template = constants.%.3] -// CHECK:STDOUT: %.loc8_38: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc8_17.1: i32 = value_of_initializer %int.usub.loc8_21 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_17.2: i32 = converted %int.usub.loc8_21, %.loc8_17.1 [template = constants.%.3] -// CHECK:STDOUT: %int.usub.loc8_17: init i32 = call %Sub.ref.loc8_14(%.loc8_17.2, %.loc8_38) [template = constants.%.2] -// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.usub.loc8_17 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.usub.loc8_17, %.loc8_40.1 [template = constants.%.2] +// CHECK:STDOUT: %Sub.ref.loc8_14: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %Sub.ref.loc8_18: Sub = name_ref Sub, %Sub.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc8_22: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_25: i32 = int_literal 2147483647 [template = constants.%.3] +// CHECK:STDOUT: %int.usub.loc8_21: init i32 = call %Sub.ref.loc8_18(%.loc8_22, %.loc8_25) [template = constants.%.4] +// CHECK:STDOUT: %.loc8_38: i32 = int_literal 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc8_17.1: i32 = value_of_initializer %int.usub.loc8_21 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_17.2: i32 = converted %int.usub.loc8_21, %.loc8_17.1 [template = constants.%.4] +// CHECK:STDOUT: %int.usub.loc8_17: init i32 = call %Sub.ref.loc8_14(%.loc8_17.2, %.loc8_38) [template = constants.%.3] +// CHECK:STDOUT: %.loc8_40.1: i32 = value_of_initializer %int.usub.loc8_17 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_40.2: i32 = converted %int.usub.loc8_17, %.loc8_40.1 [template = constants.%.3] // CHECK:STDOUT: %c: i32 = bind_name c, %.loc8_40.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/int/xor.carbon b/toolchain/check/testdata/builtins/int/xor.carbon index 08d1f443dac2..a8cd87882782 100644 --- a/toolchain/check/testdata/builtins/int/xor.carbon +++ b/toolchain/check/testdata/builtins/int/xor.carbon @@ -18,42 +18,47 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: --- int_xor.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 10 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 6 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 6] [template] +// CHECK:STDOUT: %Xor: type = fn_type @Xor [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Xor = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 10 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 6 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 6] [template] +// CHECK:STDOUT: %RuntimeCall: type = fn_type @RuntimeCall [template] +// CHECK:STDOUT: %struct.2: RuntimeCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Xor = %Xor +// CHECK:STDOUT: .Xor = %Xor.decl // CHECK:STDOUT: .arr = %arr -// CHECK:STDOUT: .RuntimeCall = %RuntimeCall +// CHECK:STDOUT: .RuntimeCall = %RuntimeCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Xor: = fn_decl @Xor [template] { +// CHECK:STDOUT: %Xor.decl: Xor = fn_decl @Xor [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc2_8.1: i32 = param a // CHECK:STDOUT: @Xor.%a: i32 = bind_name a, %a.loc2_8.1 // CHECK:STDOUT: %b.loc2_16.1: i32 = param b // CHECK:STDOUT: @Xor.%b: i32 = bind_name b, %b.loc2_16.1 // CHECK:STDOUT: @Xor.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Xor.ref: = name_ref Xor, %Xor [template = %Xor] -// CHECK:STDOUT: %.loc4_20: i32 = int_literal 12 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_24: i32 = int_literal 10 [template = constants.%.2] -// CHECK:STDOUT: %int.xor: init i32 = call %Xor.ref(%.loc4_20, %.loc4_24) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_27: type = array_type %int.xor, i32 [template = constants.%.4] +// CHECK:STDOUT: %Xor.ref: Xor = name_ref Xor, %Xor.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc4_20: i32 = int_literal 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_24: i32 = int_literal 10 [template = constants.%.3] +// CHECK:STDOUT: %int.xor: init i32 = call %Xor.ref(%.loc4_20, %.loc4_24) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_27: type = array_type %int.xor, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 6] = var arr // CHECK:STDOUT: %arr: ref [i32; 6] = bind_name arr, %arr.var -// CHECK:STDOUT: %.loc5_18: i32 = int_literal 6 [template = constants.%.3] -// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 6] [template = constants.%.5] +// CHECK:STDOUT: %.loc5_18: i32 = int_literal 6 [template = constants.%.4] +// CHECK:STDOUT: %.loc5_19: type = array_type %.loc5_18, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc5_20: type = ptr_type [i32; 6] [template = constants.%.6] // CHECK:STDOUT: %arr.ref: ref [i32; 6] = name_ref arr, %arr // CHECK:STDOUT: %.loc5_24: [i32; 6]* = addr_of %arr.ref // CHECK:STDOUT: %arr_p: [i32; 6]* = bind_name arr_p, %.loc5_24 -// CHECK:STDOUT: %RuntimeCall: = fn_decl @RuntimeCall [template] { +// CHECK:STDOUT: %RuntimeCall.decl: RuntimeCall = fn_decl @RuntimeCall [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc7_16.1: i32 = param a // CHECK:STDOUT: @RuntimeCall.%a: i32 = bind_name a, %a.loc7_16.1 // CHECK:STDOUT: %b.loc7_24.1: i32 = param b @@ -66,7 +71,7 @@ fn RuntimeCall(a: i32, b: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @RuntimeCall(%a: i32, %b: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Xor.ref: = name_ref Xor, file.%Xor [template = file.%Xor] +// CHECK:STDOUT: %Xor.ref: Xor = name_ref Xor, file.%Xor.decl [template = constants.%struct.1] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b // CHECK:STDOUT: %int.xor: init i32 = call %Xor.ref(%a.ref, %b.ref) diff --git a/toolchain/check/testdata/class/adapt.carbon b/toolchain/check/testdata/class/adapt.carbon index 75b99d946b8e..bab1decc321e 100644 --- a/toolchain/check/testdata/class/adapt.carbon +++ b/toolchain/check/testdata/class/adapt.carbon @@ -95,10 +95,14 @@ fn F(a: AdaptNotExtend) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Adapted: type = class_type @Adapted [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %AdaptNotExtend: type = class_type @AdaptNotExtend [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -106,12 +110,12 @@ fn F(a: AdaptNotExtend) { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Adapted = %Adapted.decl // CHECK:STDOUT: .AdaptNotExtend = %AdaptNotExtend.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Adapted.decl: type = class_decl @Adapted [template = constants.%Adapted] {} // CHECK:STDOUT: %AdaptNotExtend.decl: type = class_decl @AdaptNotExtend [template = constants.%AdaptNotExtend] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: %AdaptNotExtend.ref: type = name_ref AdaptNotExtend, %AdaptNotExtend.decl [template = constants.%AdaptNotExtend] // CHECK:STDOUT: %a.loc12_6.1: AdaptNotExtend = param a // CHECK:STDOUT: @F.2.%a: AdaptNotExtend = bind_name a, %a.loc12_6.1 @@ -119,11 +123,11 @@ fn F(a: AdaptNotExtend) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Adapted { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Adapted -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AdaptNotExtend { diff --git a/toolchain/check/testdata/class/base.carbon b/toolchain/check/testdata/class/base.carbon index c35a1124261b..6106465914e8 100644 --- a/toolchain/check/testdata/class/base.carbon +++ b/toolchain/check/testdata/class/base.carbon @@ -33,17 +33,22 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] // CHECK:STDOUT: %.5: type = unbound_element_type Derived, i32 [template] // CHECK:STDOUT: %.6: type = struct_type {.base: Base, .d: i32} [template] -// CHECK:STDOUT: %.7: type = struct_type {.base: {.b: i32}*, .d: i32} [template] -// CHECK:STDOUT: %.8: type = ptr_type {.base: {.b: i32}*, .d: i32} [template] -// CHECK:STDOUT: %.9: type = ptr_type {.base: Base, .d: i32} [template] -// CHECK:STDOUT: %.10: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.11: i32 = int_literal 7 [template] -// CHECK:STDOUT: %.12: type = struct_type {.base: {.b: i32}, .d: i32} [template] -// CHECK:STDOUT: %struct.1: Base = struct_value (%.10) [template] -// CHECK:STDOUT: %struct.2: Derived = struct_value (%struct.1, %.11) [template] -// CHECK:STDOUT: %.13: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.14: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.15: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %Make: type = fn_type @Make [template] +// CHECK:STDOUT: %.7: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Make = struct_value () [template] +// CHECK:STDOUT: %.8: type = struct_type {.base: {.b: i32}*, .d: i32} [template] +// CHECK:STDOUT: %.9: type = ptr_type {.base: {.b: i32}*, .d: i32} [template] +// CHECK:STDOUT: %.10: type = ptr_type {.base: Base, .d: i32} [template] +// CHECK:STDOUT: %.11: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.12: i32 = int_literal 7 [template] +// CHECK:STDOUT: %.13: type = struct_type {.base: {.b: i32}, .d: i32} [template] +// CHECK:STDOUT: %struct.2: Base = struct_value (%.11) [template] +// CHECK:STDOUT: %struct.3: Derived = struct_value (%struct.2, %.12) [template] +// CHECK:STDOUT: %.14: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.15: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %Access: type = fn_type @Access [template] +// CHECK:STDOUT: %struct.4: Access = struct_value () [template] +// CHECK:STDOUT: %.16: type = ptr_type (i32, i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -51,22 +56,22 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Base = %Base.decl // CHECK:STDOUT: .Derived = %Derived.decl -// CHECK:STDOUT: .Make = %Make -// CHECK:STDOUT: .Access = %Access +// CHECK:STDOUT: .Make = %Make.decl +// CHECK:STDOUT: .Access = %Access.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %Make: = fn_decl @Make [template] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.1] { // CHECK:STDOUT: %Derived.ref.loc17: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: @Make.%return: ref Derived = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Access: = fn_decl @Access [template] { +// CHECK:STDOUT: %Access.decl: Access = fn_decl @Access [template = constants.%struct.4] { // 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.%.14 [template = constants.%.14] +// CHECK:STDOUT: %.loc21_35.2: type = converted %.loc21_35.1, constants.%.15 [template = constants.%.15] // CHECK:STDOUT: @Access.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -93,19 +98,19 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: Derived { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_25: i32 = int_literal 4 [template = constants.%.10] +// CHECK:STDOUT: %.loc18_25: i32 = int_literal 4 [template = constants.%.11] // CHECK:STDOUT: %.loc18_26.1: {.b: i32} = struct_literal (%.loc18_25) -// CHECK:STDOUT: %.loc18_34: i32 = int_literal 7 [template = constants.%.11] +// CHECK:STDOUT: %.loc18_34: i32 = int_literal 7 [template = constants.%.12] // CHECK:STDOUT: %.loc18_35.1: {.base: {.b: i32}, .d: i32} = struct_literal (%.loc18_26.1, %.loc18_34) // CHECK:STDOUT: %.loc18_35.2: ref Base = class_element_access %return, element0 // CHECK:STDOUT: %.loc18_26.2: ref i32 = class_element_access %.loc18_35.2, element0 -// CHECK:STDOUT: %.loc18_26.3: init i32 = initialize_from %.loc18_25 to %.loc18_26.2 [template = constants.%.10] -// CHECK:STDOUT: %.loc18_26.4: init Base = class_init (%.loc18_26.3), %.loc18_35.2 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc18_35.3: init Base = converted %.loc18_26.1, %.loc18_26.4 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18_26.3: init i32 = initialize_from %.loc18_25 to %.loc18_26.2 [template = constants.%.11] +// CHECK:STDOUT: %.loc18_26.4: init Base = class_init (%.loc18_26.3), %.loc18_35.2 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc18_35.3: init Base = converted %.loc18_26.1, %.loc18_26.4 [template = constants.%struct.2] // CHECK:STDOUT: %.loc18_35.4: ref i32 = class_element_access %return, element1 -// CHECK:STDOUT: %.loc18_35.5: init i32 = initialize_from %.loc18_34 to %.loc18_35.4 [template = constants.%.11] -// CHECK:STDOUT: %.loc18_35.6: init Derived = class_init (%.loc18_35.3, %.loc18_35.5), %return [template = constants.%struct.2] -// CHECK:STDOUT: %.loc18_36: init Derived = converted %.loc18_35.1, %.loc18_35.6 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc18_35.5: init i32 = initialize_from %.loc18_34 to %.loc18_35.4 [template = constants.%.12] +// CHECK:STDOUT: %.loc18_35.6: init Derived = class_init (%.loc18_35.3, %.loc18_35.5), %return [template = constants.%struct.3] +// CHECK:STDOUT: %.loc18_36: init Derived = converted %.loc18_35.1, %.loc18_35.6 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc18_36 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_field.carbon b/toolchain/check/testdata/class/base_field.carbon index 43f4847d1694..88b49989b749 100644 --- a/toolchain/check/testdata/class/base_field.carbon +++ b/toolchain/check/testdata/class/base_field.carbon @@ -34,9 +34,12 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: %.6: type = struct_type {.base: Base, .d: i32, .e: i32} [template] // CHECK:STDOUT: %.7: type = ptr_type Derived [template] // CHECK:STDOUT: %.8: type = ptr_type i32 [template] -// CHECK:STDOUT: %.9: type = struct_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] -// CHECK:STDOUT: %.10: type = ptr_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] -// CHECK:STDOUT: %.11: type = ptr_type {.base: Base, .d: i32, .e: i32} [template] +// CHECK:STDOUT: %Access: type = fn_type @Access [template] +// CHECK:STDOUT: %.9: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Access = struct_value () [template] +// CHECK:STDOUT: %.10: type = struct_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] +// CHECK:STDOUT: %.11: type = ptr_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] +// CHECK:STDOUT: %.12: type = ptr_type {.base: Base, .d: i32, .e: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -44,12 +47,12 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Base = %Base.decl // CHECK:STDOUT: .Derived = %Derived.decl -// CHECK:STDOUT: .Access = %Access +// CHECK:STDOUT: .Access = %Access.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %Access: = fn_decl @Access [template] { +// CHECK:STDOUT: %Access.decl: Access = fn_decl @Access [template = constants.%struct] { // 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 diff --git a/toolchain/check/testdata/class/base_function_unqualified.carbon b/toolchain/check/testdata/class/base_function_unqualified.carbon index 6eafe400a642..70fbc6083b75 100644 --- a/toolchain/check/testdata/class/base_function_unqualified.carbon +++ b/toolchain/check/testdata/class/base_function_unqualified.carbon @@ -23,11 +23,17 @@ fn Derived.H() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Base: type = class_type @Base [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %Derived: type = class_type @Derived [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %H: type = fn_type @H [template] +// CHECK:STDOUT: %struct.3: H = struct_value () [template] // CHECK:STDOUT: %.5: type = struct_type {.base: Base} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -40,28 +46,28 @@ fn Derived.H() { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %H: = fn_decl @H [template] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // 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.decl: G = fn_decl @G [template = constants.%struct.2] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived // CHECK:STDOUT: .base = %.loc12 -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .H = %H +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .H = %H.decl // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -69,14 +75,14 @@ fn Derived.H() { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, @Base.%F [template = @Base.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @H() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, @Base.%F [template = @Base.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/base_method.carbon b/toolchain/check/testdata/class/base_method.carbon index 3d0a5ebb0f48..4b21c637ee96 100644 --- a/toolchain/check/testdata/class/base_method.carbon +++ b/toolchain/check/testdata/class/base_method.carbon @@ -28,16 +28,20 @@ fn Call(p: Derived*) { // CHECK:STDOUT: %Base: type = class_type @Base [template] // CHECK:STDOUT: %.1: type = unbound_element_type Base, i32 [template] // CHECK:STDOUT: %.2: type = ptr_type Base [template] -// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.6: i32 = int_literal 1 [template] // CHECK:STDOUT: %Derived: type = class_type @Derived [template] -// CHECK:STDOUT: %.6: type = unbound_element_type Derived, Base [template] -// CHECK:STDOUT: %.7: type = struct_type {.base: Base} [template] -// CHECK:STDOUT: %.8: type = ptr_type Derived [template] -// CHECK:STDOUT: %.9: type = struct_type {.base: {.a: i32}*} [template] -// CHECK:STDOUT: %.10: type = ptr_type {.base: Base} [template] -// CHECK:STDOUT: %.11: type = tuple_type () [template] +// CHECK:STDOUT: %.7: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %.8: type = struct_type {.base: Base} [template] +// CHECK:STDOUT: %.9: type = ptr_type Derived [template] +// CHECK:STDOUT: %Call: type = fn_type @Call [template] +// CHECK:STDOUT: %struct.2: Call = struct_value () [template] +// CHECK:STDOUT: %.10: type = struct_type {.base: {.a: i32}*} [template] +// CHECK:STDOUT: %.11: type = ptr_type {.base: Base} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -45,11 +49,11 @@ fn Call(p: Derived*) { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Base = %Base.decl // CHECK:STDOUT: .Derived = %Derived.decl -// CHECK:STDOUT: .Call = %Call +// CHECK:STDOUT: .Call = %Call.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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 @@ -57,9 +61,9 @@ fn Call(p: Derived*) { // CHECK:STDOUT: @F.%.loc13: Base* = addr_pattern @F.%self // CHECK:STDOUT: } // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %Call: = fn_decl @Call [template] { +// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.2] { // 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: %.loc21: type = ptr_type Derived [template = constants.%.9] // CHECK:STDOUT: %p.loc21_9.1: Derived* = param p // CHECK:STDOUT: @Call.%p: Derived* = bind_name p, %p.loc21_9.1 // CHECK:STDOUT: } @@ -67,7 +71,7 @@ fn Call(p: Derived*) { // CHECK:STDOUT: // CHECK:STDOUT: class @Base { // CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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 @@ -78,7 +82,7 @@ fn Call(p: Derived*) { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base // CHECK:STDOUT: .a = %.loc8 -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { @@ -97,7 +101,7 @@ fn Call(p: Derived*) { // CHECK:STDOUT: %.loc14_4: ref Base = deref %self.ref // CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc8 [template = @Base.%.loc8] // CHECK:STDOUT: %.loc14_10: ref i32 = class_element_access %.loc14_4, element0 -// CHECK:STDOUT: %.loc14_15: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_15: i32 = int_literal 1 [template = constants.%.6] // CHECK:STDOUT: assign %.loc14_10, %.loc14_15 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -106,14 +110,14 @@ fn Call(p: Derived*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %.loc22_4.1: ref Derived = deref %p.ref -// CHECK:STDOUT: %F.ref: = name_ref F, @Base.%F [template = @Base.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc22_7: = bound_method %.loc22_4.1, %F.ref // CHECK:STDOUT: %.loc22_4.2: Derived* = addr_of %.loc22_4.1 // CHECK:STDOUT: %.loc22_9.1: ref Derived = deref %.loc22_4.2 // CHECK:STDOUT: %.loc22_9.2: ref Base = class_element_access %.loc22_9.1, element0 // CHECK:STDOUT: %.loc22_9.3: Base* = addr_of %.loc22_9.2 // CHECK:STDOUT: %.loc22_9.4: Base* = converted %.loc22_4.2, %.loc22_9.3 -// CHECK:STDOUT: %.loc22_9.5: init () = call %.loc22_7(%.loc22_9.4) +// CHECK:STDOUT: %F.call: init () = call %.loc22_7(%.loc22_9.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_method_qualified.carbon b/toolchain/check/testdata/class/base_method_qualified.carbon index ffcf951b6487..fd89901c7bfe 100644 --- a/toolchain/check/testdata/class/base_method_qualified.carbon +++ b/toolchain/check/testdata/class/base_method_qualified.carbon @@ -39,14 +39,30 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Derived: type = class_type @Derived [template] // CHECK:STDOUT: %Base: type = class_type @Base [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G.1: type = fn_type @G.1 [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %G.2: type = fn_type @G.2 [template] +// CHECK:STDOUT: %struct.4: G = struct_value () [template] // CHECK:STDOUT: %.5: type = struct_type {.base: Base} [template] +// CHECK:STDOUT: %Call: type = fn_type @Call [template] +// CHECK:STDOUT: %struct.5: Call = struct_value () [template] // CHECK:STDOUT: %.6: type = struct_type {.base: {}*} [template] // CHECK:STDOUT: %.7: type = ptr_type {.base: Base} [template] // CHECK:STDOUT: %.8: type = ptr_type Derived [template] +// CHECK:STDOUT: %CallIndirect: type = fn_type @CallIndirect [template] +// CHECK:STDOUT: %struct.6: CallIndirect = struct_value () [template] +// CHECK:STDOUT: %PassDerivedToBase: type = fn_type @PassDerivedToBase [template] +// CHECK:STDOUT: %struct.7: PassDerivedToBase = struct_value () [template] +// CHECK:STDOUT: %PassDerivedToBaseIndirect: type = fn_type @PassDerivedToBaseIndirect [template] +// CHECK:STDOUT: %struct.8: PassDerivedToBaseIndirect = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -54,35 +70,35 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Derived = %Derived.decl.loc7 // CHECK:STDOUT: .Base = %Base.decl -// CHECK:STDOUT: .Call = %Call -// CHECK:STDOUT: .CallIndirect = %CallIndirect -// CHECK:STDOUT: .PassDerivedToBase = %PassDerivedToBase -// CHECK:STDOUT: .PassDerivedToBaseIndirect = %PassDerivedToBaseIndirect +// CHECK:STDOUT: .Call = %Call.decl +// CHECK:STDOUT: .CallIndirect = %CallIndirect.decl +// CHECK:STDOUT: .PassDerivedToBase = %PassDerivedToBase.decl +// CHECK:STDOUT: .PassDerivedToBaseIndirect = %PassDerivedToBaseIndirect.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Derived.decl.loc7: type = class_decl @Derived [template = constants.%Derived] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} // CHECK:STDOUT: %Derived.decl.loc14: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %Call: = fn_decl @Call [template] { +// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.5] { // CHECK:STDOUT: %Derived.ref.loc21: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] // CHECK:STDOUT: %a.loc21_9.1: Derived = param a // CHECK:STDOUT: @Call.%a: Derived = bind_name a, %a.loc21_9.1 // CHECK:STDOUT: @Call.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallIndirect: = fn_decl @CallIndirect [template] { +// CHECK:STDOUT: %CallIndirect.decl: CallIndirect = fn_decl @CallIndirect [template = constants.%struct.6] { // CHECK:STDOUT: %Derived.ref.loc25: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] // CHECK:STDOUT: %.loc25: type = ptr_type Derived [template = constants.%.8] // CHECK:STDOUT: %p.loc25_17.1: Derived* = param p // CHECK:STDOUT: @CallIndirect.%p: Derived* = bind_name p, %p.loc25_17.1 // CHECK:STDOUT: @CallIndirect.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %PassDerivedToBase: = fn_decl @PassDerivedToBase [template] { +// CHECK:STDOUT: %PassDerivedToBase.decl: PassDerivedToBase = fn_decl @PassDerivedToBase [template = constants.%struct.7] { // CHECK:STDOUT: %Derived.ref.loc29: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] // CHECK:STDOUT: %a.loc29_22.1: Derived = param a // CHECK:STDOUT: @PassDerivedToBase.%a: Derived = bind_name a, %a.loc29_22.1 // CHECK:STDOUT: @PassDerivedToBase.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %PassDerivedToBaseIndirect: = fn_decl @PassDerivedToBaseIndirect [template] { +// CHECK:STDOUT: %PassDerivedToBaseIndirect.decl: PassDerivedToBaseIndirect = fn_decl @PassDerivedToBaseIndirect [template = constants.%struct.8] { // CHECK:STDOUT: %Derived.ref.loc33: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] // CHECK:STDOUT: %.loc33: type = ptr_type Derived [template = constants.%.8] // CHECK:STDOUT: %p.loc33_30.1: Derived* = param p @@ -94,12 +110,12 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc15: = base_decl Base, element0 [template] -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { // CHECK:STDOUT: %Self.ref.loc17: type = name_ref Self, constants.%Derived [template = constants.%Derived] // CHECK:STDOUT: %self.loc17_8.1: Derived = param self // CHECK:STDOUT: %self.loc17_8.2: Derived = bind_name self, %self.loc17_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G.2 [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G.2 [template = constants.%struct.4] { // CHECK:STDOUT: %Self.ref.loc18: type = name_ref Self, constants.%Derived [template = constants.%Derived] // CHECK:STDOUT: %self.loc18_8.1: Derived = param self // CHECK:STDOUT: %self.loc18_8.2: Derived = bind_name self, %self.loc18_8.1 @@ -108,19 +124,19 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived // CHECK:STDOUT: .base = %.loc15 -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Base [template = constants.%Base] // CHECK:STDOUT: %self.loc10_8.1: Base = param self // CHECK:STDOUT: %self.loc10_8.2: Base = bind_name self, %self.loc10_8.1 // CHECK:STDOUT: %return.var.loc10: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G.1 [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G.1 [template = constants.%struct.2] { // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc7 [template = constants.%Derived] // CHECK:STDOUT: %self.loc11_8.1: Derived = param self // CHECK:STDOUT: %self.loc11_8.2: Derived = bind_name self, %self.loc11_8.1 @@ -129,8 +145,8 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1[@Base.%self.loc10_8.2: Base]() -> i32; @@ -145,14 +161,14 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: Derived = name_ref a, %a // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %F.ref: = name_ref F, @Base.%F [template = @Base.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc22_11: = bound_method %a.ref, %F.ref // CHECK:STDOUT: %.loc22_20.1: ref Base = class_element_access %a.ref, element0 // CHECK:STDOUT: %.loc22_20.2: ref Base = converted %a.ref, %.loc22_20.1 // CHECK:STDOUT: %.loc22_20.3: Base = bind_value %.loc22_20.2 -// CHECK:STDOUT: %.loc22_20.4: init i32 = call %.loc22_11(%.loc22_20.3) -// CHECK:STDOUT: %.loc22_22.1: i32 = value_of_initializer %.loc22_20.4 -// CHECK:STDOUT: %.loc22_22.2: i32 = converted %.loc22_20.4, %.loc22_22.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc22_11(%.loc22_20.3) +// CHECK:STDOUT: %.loc22_22.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc22_22.2: i32 = converted %F.call, %.loc22_22.1 // CHECK:STDOUT: return %.loc22_22.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -160,15 +176,15 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %F.ref: = name_ref F, @Base.%F [template = @Base.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc26_11.1: ref Derived = deref %p.ref // CHECK:STDOUT: %.loc26_11.2: = bound_method %.loc26_11.1, %F.ref // CHECK:STDOUT: %.loc26_21.1: ref Base = class_element_access %.loc26_11.1, element0 // CHECK:STDOUT: %.loc26_21.2: ref Base = converted %.loc26_11.1, %.loc26_21.1 // CHECK:STDOUT: %.loc26_21.3: Base = bind_value %.loc26_21.2 -// CHECK:STDOUT: %.loc26_21.4: init i32 = call %.loc26_11.2(%.loc26_21.3) -// CHECK:STDOUT: %.loc26_23.1: i32 = value_of_initializer %.loc26_21.4 -// CHECK:STDOUT: %.loc26_23.2: i32 = converted %.loc26_21.4, %.loc26_23.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc26_11.2(%.loc26_21.3) +// CHECK:STDOUT: %.loc26_23.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc26_23.2: i32 = converted %F.call, %.loc26_23.1 // CHECK:STDOUT: return %.loc26_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -176,11 +192,11 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: Derived = name_ref a, %a // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %G.ref: = name_ref G, @Base.%G [template = @Base.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, @Base.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc30_11: = bound_method %a.ref, %G.ref -// CHECK:STDOUT: %.loc30_20: init i32 = call %.loc30_11(%a.ref) -// CHECK:STDOUT: %.loc30_22.1: i32 = value_of_initializer %.loc30_20 -// CHECK:STDOUT: %.loc30_22.2: i32 = converted %.loc30_20, %.loc30_22.1 +// CHECK:STDOUT: %G.call: init i32 = call %.loc30_11(%a.ref) +// CHECK:STDOUT: %.loc30_22.1: i32 = value_of_initializer %G.call +// CHECK:STDOUT: %.loc30_22.2: i32 = converted %G.call, %.loc30_22.1 // CHECK:STDOUT: return %.loc30_22.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -188,13 +204,13 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %G.ref: = name_ref G, @Base.%G [template = @Base.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, @Base.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc34_11.1: ref Derived = deref %p.ref // CHECK:STDOUT: %.loc34_11.2: = bound_method %.loc34_11.1, %G.ref // CHECK:STDOUT: %.loc34_11.3: Derived = bind_value %.loc34_11.1 -// CHECK:STDOUT: %.loc34_21: init i32 = call %.loc34_11.2(%.loc34_11.3) -// CHECK:STDOUT: %.loc34_23.1: i32 = value_of_initializer %.loc34_21 -// CHECK:STDOUT: %.loc34_23.2: i32 = converted %.loc34_21, %.loc34_23.1 +// CHECK:STDOUT: %G.call: init i32 = call %.loc34_11.2(%.loc34_11.3) +// CHECK:STDOUT: %.loc34_23.1: i32 = value_of_initializer %G.call +// CHECK:STDOUT: %.loc34_23.2: i32 = converted %G.call, %.loc34_23.1 // CHECK:STDOUT: return %.loc34_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_method_shadow.carbon b/toolchain/check/testdata/class/base_method_shadow.carbon index 1f1b5f9987c1..1edac7300a47 100644 --- a/toolchain/check/testdata/class/base_method_shadow.carbon +++ b/toolchain/check/testdata/class/base_method_shadow.carbon @@ -34,22 +34,30 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %A: type = class_type @A [template] // CHECK:STDOUT: %.1: type = ptr_type A [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] // CHECK:STDOUT: %B: type = class_type @B [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] // CHECK:STDOUT: %.4: type = ptr_type {} [template] // CHECK:STDOUT: %.5: type = unbound_element_type B, A [template] // CHECK:STDOUT: %.6: type = ptr_type B [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.7: type = struct_type {.base: A} [template] // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.8: type = struct_type {.base: {}*} [template] // CHECK:STDOUT: %.9: type = ptr_type {.base: A} [template] // CHECK:STDOUT: %.10: type = unbound_element_type C, B [template] // CHECK:STDOUT: %.11: type = ptr_type C [template] +// CHECK:STDOUT: %F.3: type = fn_type @F.3 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.12: type = struct_type {.base: B} [template] // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %.13: type = unbound_element_type D, B [template] // CHECK:STDOUT: %.14: type = ptr_type D [template] +// CHECK:STDOUT: %Call: type = fn_type @Call [template] +// CHECK:STDOUT: %struct.4: Call = struct_value () [template] // CHECK:STDOUT: %.15: type = struct_type {.base: {.base: A}*} [template] // CHECK:STDOUT: %.16: type = ptr_type {.base: B} [template] // CHECK:STDOUT: } @@ -61,14 +69,14 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl -// CHECK:STDOUT: .Call = %Call +// CHECK:STDOUT: .Call = %Call.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} -// CHECK:STDOUT: %Call: = fn_decl @Call [template] { +// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.4] { // 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 @@ -89,7 +97,7 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.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 @@ -99,13 +107,13 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // 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.decl: F = fn_decl @F.2 [template = constants.%struct.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 @@ -116,14 +124,14 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B // CHECK:STDOUT: .base = %.loc12 -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: // 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.decl: F = fn_decl @F.3 [template = constants.%struct.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 @@ -134,7 +142,7 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: .base = %.loc17 -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: extend name_scope3 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -158,32 +166,32 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: A* = name_ref a, %a // CHECK:STDOUT: %.loc26_4.1: ref A = deref %a.ref -// CHECK:STDOUT: %F.ref.loc26: = name_ref F, @A.%F [template = @A.%F] +// CHECK:STDOUT: %F.ref.loc26: F = name_ref F, @A.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc26_7: = bound_method %.loc26_4.1, %F.ref.loc26 // CHECK:STDOUT: %.loc26_4.2: A* = addr_of %.loc26_4.1 -// CHECK:STDOUT: %.loc26_9: init () = call %.loc26_7(%.loc26_4.2) +// CHECK:STDOUT: %F.call.loc26: init () = call %.loc26_7(%.loc26_4.2) // CHECK:STDOUT: %b.ref: B* = name_ref b, %b // CHECK:STDOUT: %.loc27_4.1: ref B = deref %b.ref -// CHECK:STDOUT: %F.ref.loc27: = name_ref F, @B.%F [template = @B.%F] +// CHECK:STDOUT: %F.ref.loc27: F = name_ref F, @B.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc27_7: = bound_method %.loc27_4.1, %F.ref.loc27 // CHECK:STDOUT: %.loc27_4.2: B* = addr_of %.loc27_4.1 -// CHECK:STDOUT: %.loc27_9: init () = call %.loc27_7(%.loc27_4.2) +// CHECK:STDOUT: %F.call.loc27: init () = call %.loc27_7(%.loc27_4.2) // CHECK:STDOUT: %c.ref: C* = name_ref c, %c // CHECK:STDOUT: %.loc28_4.1: ref C = deref %c.ref -// CHECK:STDOUT: %F.ref.loc28: = name_ref F, @C.%F [template = @C.%F] +// CHECK:STDOUT: %F.ref.loc28: F = name_ref F, @C.%F.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc28_7: = bound_method %.loc28_4.1, %F.ref.loc28 // CHECK:STDOUT: %.loc28_4.2: C* = addr_of %.loc28_4.1 -// CHECK:STDOUT: %.loc28_9: init () = call %.loc28_7(%.loc28_4.2) +// CHECK:STDOUT: %F.call.loc28: init () = call %.loc28_7(%.loc28_4.2) // CHECK:STDOUT: %d.ref: D* = name_ref d, %d // CHECK:STDOUT: %.loc29_4.1: ref D = deref %d.ref -// CHECK:STDOUT: %F.ref.loc29: = name_ref F, @B.%F [template = @B.%F] +// CHECK:STDOUT: %F.ref.loc29: F = name_ref F, @B.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc29_7: = bound_method %.loc29_4.1, %F.ref.loc29 // CHECK:STDOUT: %.loc29_4.2: D* = addr_of %.loc29_4.1 // CHECK:STDOUT: %.loc29_9.1: ref D = deref %.loc29_4.2 // CHECK:STDOUT: %.loc29_9.2: ref B = class_element_access %.loc29_9.1, element0 // CHECK:STDOUT: %.loc29_9.3: B* = addr_of %.loc29_9.2 // CHECK:STDOUT: %.loc29_9.4: B* = converted %.loc29_4.2, %.loc29_9.3 -// CHECK:STDOUT: %.loc29_9.5: init () = call %.loc29_7(%.loc29_9.4) +// CHECK:STDOUT: %F.call.loc29: init () = call %.loc29_7(%.loc29_9.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/basic.carbon b/toolchain/check/testdata/class/basic.carbon index df40781f6112..1ede495b078c 100644 --- a/toolchain/check/testdata/class/basic.carbon +++ b/toolchain/check/testdata/class/basic.carbon @@ -26,36 +26,43 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.k: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 4 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.2: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.k: i32} [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %struct.3: Run = struct_value () [template] +// CHECK:STDOUT: %.4: i32 = int_literal 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %n.loc17_12.1: i32 = param n // CHECK:STDOUT: @G.%n: i32 = bind_name n, %n.loc17_12.1 // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Run: = fn_decl @Run [template] { +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.3] { // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // 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 @@ -64,8 +71,8 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: .k = %.loc14 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -84,8 +91,8 @@ fn Run() -> i32 { // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] -// CHECK:STDOUT: %.loc22_18: i32 = int_literal 4 [template = constants.%.3] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc22_18: i32 = int_literal 4 [template = constants.%.4] // CHECK:STDOUT: %F.call: init i32 = call %F.ref(%.loc22_18) // CHECK:STDOUT: %.loc22_20.1: i32 = value_of_initializer %F.call // CHECK:STDOUT: %.loc22_20.2: i32 = converted %F.call, %.loc22_20.1 diff --git a/toolchain/check/testdata/class/complete_in_member_fn.carbon b/toolchain/check/testdata/class/complete_in_member_fn.carbon index 7a49d7709bba..cf49eb55f2f7 100644 --- a/toolchain/check/testdata/class/complete_in_member_fn.carbon +++ b/toolchain/check/testdata/class/complete_in_member_fn.carbon @@ -14,9 +14,12 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.1: type = unbound_element_type C, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -29,7 +32,7 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %c.loc8_8.1: C = param c // CHECK:STDOUT: %c.loc8_8.2: C = bind_name c, %c.loc8_8.1 @@ -39,7 +42,7 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .a = %.loc10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/compound_field.carbon b/toolchain/check/testdata/class/compound_field.carbon index e3b3a10b8f0e..f0b5e2316616 100644 --- a/toolchain/check/testdata/class/compound_field.carbon +++ b/toolchain/check/testdata/class/compound_field.carbon @@ -44,11 +44,20 @@ fn AccessBaseIndirect(p: Derived*) -> i32* { // CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] // CHECK:STDOUT: %.5: type = unbound_element_type Derived, i32 [template] // CHECK:STDOUT: %.6: type = struct_type {.base: Base, .d: i32, .e: i32} [template] -// CHECK:STDOUT: %.7: type = struct_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] -// CHECK:STDOUT: %.8: type = ptr_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] -// CHECK:STDOUT: %.9: type = ptr_type {.base: Base, .d: i32, .e: i32} [template] -// CHECK:STDOUT: %.10: type = ptr_type Derived [template] -// CHECK:STDOUT: %.11: type = ptr_type i32 [template] +// CHECK:STDOUT: %AccessDerived: type = fn_type @AccessDerived [template] +// CHECK:STDOUT: %.7: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: AccessDerived = struct_value () [template] +// CHECK:STDOUT: %.8: type = struct_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] +// CHECK:STDOUT: %.9: type = ptr_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] +// CHECK:STDOUT: %.10: type = ptr_type {.base: Base, .d: i32, .e: i32} [template] +// CHECK:STDOUT: %AccessBase: type = fn_type @AccessBase [template] +// CHECK:STDOUT: %struct.2: AccessBase = struct_value () [template] +// CHECK:STDOUT: %.11: type = ptr_type Derived [template] +// CHECK:STDOUT: %.12: type = ptr_type i32 [template] +// CHECK:STDOUT: %AccessDerivedIndirect: type = fn_type @AccessDerivedIndirect [template] +// CHECK:STDOUT: %struct.3: AccessDerivedIndirect = struct_value () [template] +// CHECK:STDOUT: %AccessBaseIndirect: type = fn_type @AccessBaseIndirect [template] +// CHECK:STDOUT: %struct.4: AccessBaseIndirect = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -56,40 +65,40 @@ fn AccessBaseIndirect(p: Derived*) -> i32* { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Base = %Base.decl // CHECK:STDOUT: .Derived = %Derived.decl -// CHECK:STDOUT: .AccessDerived = %AccessDerived -// CHECK:STDOUT: .AccessBase = %AccessBase -// CHECK:STDOUT: .AccessDerivedIndirect = %AccessDerivedIndirect -// CHECK:STDOUT: .AccessBaseIndirect = %AccessBaseIndirect +// CHECK:STDOUT: .AccessDerived = %AccessDerived.decl +// CHECK:STDOUT: .AccessBase = %AccessBase.decl +// CHECK:STDOUT: .AccessDerivedIndirect = %AccessDerivedIndirect.decl +// CHECK:STDOUT: .AccessBaseIndirect = %AccessBaseIndirect.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %AccessDerived: = fn_decl @AccessDerived [template] { +// CHECK:STDOUT: %AccessDerived.decl: AccessDerived = fn_decl @AccessDerived [template = constants.%struct.1] { // CHECK:STDOUT: %Derived.ref.loc20: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: %d.loc20_18.1: Derived = param d // CHECK:STDOUT: @AccessDerived.%d: Derived = bind_name d, %d.loc20_18.1 // CHECK:STDOUT: @AccessDerived.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessBase: = fn_decl @AccessBase [template] { +// CHECK:STDOUT: %AccessBase.decl: AccessBase = fn_decl @AccessBase [template = constants.%struct.2] { // CHECK:STDOUT: %Derived.ref.loc24: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: %d.loc24_15.1: Derived = param d // CHECK:STDOUT: @AccessBase.%d: Derived = bind_name d, %d.loc24_15.1 // CHECK:STDOUT: @AccessBase.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessDerivedIndirect: = fn_decl @AccessDerivedIndirect [template] { +// CHECK:STDOUT: %AccessDerivedIndirect.decl: AccessDerivedIndirect = fn_decl @AccessDerivedIndirect [template = constants.%struct.3] { // CHECK:STDOUT: %Derived.ref.loc28: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %.loc28_36: type = ptr_type Derived [template = constants.%.10] +// CHECK:STDOUT: %.loc28_36: type = ptr_type Derived [template = constants.%.11] // CHECK:STDOUT: %p.loc28_26.1: Derived* = param p // CHECK:STDOUT: @AccessDerivedIndirect.%p: Derived* = bind_name p, %p.loc28_26.1 -// CHECK:STDOUT: %.loc28_45: type = ptr_type i32 [template = constants.%.11] +// CHECK:STDOUT: %.loc28_45: type = ptr_type i32 [template = constants.%.12] // CHECK:STDOUT: @AccessDerivedIndirect.%return: ref i32* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessBaseIndirect: = fn_decl @AccessBaseIndirect [template] { +// CHECK:STDOUT: %AccessBaseIndirect.decl: AccessBaseIndirect = fn_decl @AccessBaseIndirect [template = constants.%struct.4] { // CHECK:STDOUT: %Derived.ref.loc32: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %.loc32_33: type = ptr_type Derived [template = constants.%.10] +// CHECK:STDOUT: %.loc32_33: type = ptr_type Derived [template = constants.%.11] // CHECK:STDOUT: %p.loc32_23.1: Derived* = param p // CHECK:STDOUT: @AccessBaseIndirect.%p: Derived* = bind_name p, %p.loc32_23.1 -// CHECK:STDOUT: %.loc32_42: type = ptr_type i32 [template = constants.%.11] +// CHECK:STDOUT: %.loc32_42: type = ptr_type i32 [template = constants.%.12] // CHECK:STDOUT: @AccessBaseIndirect.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/cross_package_import.carbon b/toolchain/check/testdata/class/cross_package_import.carbon index e82a2573453e..dcf27635e247 100644 --- a/toolchain/check/testdata/class/cross_package_import.carbon +++ b/toolchain/check/testdata/class/cross_package_import.carbon @@ -145,13 +145,19 @@ var c: Other.C = {}; // CHECK:STDOUT: // CHECK:STDOUT: --- other_conflict.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .C = %C +// CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %C: = fn_decl @C [template] {} +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @C() { diff --git a/toolchain/check/testdata/class/derived_to_base.carbon b/toolchain/check/testdata/class/derived_to_base.carbon index d95af5513f72..f650f829dd6d 100644 --- a/toolchain/check/testdata/class/derived_to_base.carbon +++ b/toolchain/check/testdata/class/derived_to_base.carbon @@ -54,18 +54,31 @@ fn ConvertInit() { // CHECK:STDOUT: %.12: type = struct_type {.base: B, .c: i32} [template] // CHECK:STDOUT: %.13: type = ptr_type C [template] // CHECK:STDOUT: %.14: type = ptr_type B [template] -// CHECK:STDOUT: %.15: type = struct_type {.base: {.base: A, .b: i32}*, .c: i32} [template] -// CHECK:STDOUT: %.16: type = ptr_type {.base: {.base: A, .b: i32}*, .c: i32} [template] -// CHECK:STDOUT: %.17: type = ptr_type {.base: B, .c: i32} [template] -// CHECK:STDOUT: %.18: type = ptr_type A [template] -// CHECK:STDOUT: %.19: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.20: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.21: type = struct_type {.base: {.a: i32}, .b: i32} [template] -// CHECK:STDOUT: %.22: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.23: type = struct_type {.base: {.base: {.a: i32}, .b: i32}, .c: i32} [template] -// CHECK:STDOUT: %struct.1: A = struct_value (%.19) [template] -// CHECK:STDOUT: %struct.2: B = struct_value (%struct.1, %.20) [template] -// CHECK:STDOUT: %struct.3: C = struct_value (%struct.2, %.22) [template] +// CHECK:STDOUT: %ConvertCToB: type = fn_type @ConvertCToB [template] +// CHECK:STDOUT: %.15: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: ConvertCToB = struct_value () [template] +// CHECK:STDOUT: %.16: type = struct_type {.base: {.base: A, .b: i32}*, .c: i32} [template] +// CHECK:STDOUT: %.17: type = ptr_type {.base: {.base: A, .b: i32}*, .c: i32} [template] +// CHECK:STDOUT: %.18: type = ptr_type {.base: B, .c: i32} [template] +// CHECK:STDOUT: %.19: type = ptr_type A [template] +// CHECK:STDOUT: %ConvertBToA: type = fn_type @ConvertBToA [template] +// CHECK:STDOUT: %struct.2: ConvertBToA = struct_value () [template] +// CHECK:STDOUT: %ConvertCToA: type = fn_type @ConvertCToA [template] +// CHECK:STDOUT: %struct.3: ConvertCToA = struct_value () [template] +// CHECK:STDOUT: %ConvertValue: type = fn_type @ConvertValue [template] +// CHECK:STDOUT: %struct.4: ConvertValue = struct_value () [template] +// CHECK:STDOUT: %ConvertRef: type = fn_type @ConvertRef [template] +// CHECK:STDOUT: %struct.5: ConvertRef = struct_value () [template] +// CHECK:STDOUT: %ConvertInit: type = fn_type @ConvertInit [template] +// CHECK:STDOUT: %struct.6: ConvertInit = struct_value () [template] +// CHECK:STDOUT: %.20: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.21: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.22: type = struct_type {.base: {.a: i32}, .b: i32} [template] +// CHECK:STDOUT: %.23: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.24: type = struct_type {.base: {.base: {.a: i32}, .b: i32}, .c: i32} [template] +// CHECK:STDOUT: %struct.7: A = struct_value (%.20) [template] +// CHECK:STDOUT: %struct.8: B = struct_value (%struct.7, %.21) [template] +// CHECK:STDOUT: %struct.9: C = struct_value (%struct.8, %.23) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -74,18 +87,18 @@ fn ConvertInit() { // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .ConvertCToB = %ConvertCToB -// CHECK:STDOUT: .ConvertBToA = %ConvertBToA -// CHECK:STDOUT: .ConvertCToA = %ConvertCToA -// CHECK:STDOUT: .ConvertValue = %ConvertValue -// CHECK:STDOUT: .ConvertRef = %ConvertRef -// CHECK:STDOUT: .ConvertInit = %ConvertInit +// CHECK:STDOUT: .ConvertCToB = %ConvertCToB.decl +// CHECK:STDOUT: .ConvertBToA = %ConvertBToA.decl +// CHECK:STDOUT: .ConvertCToA = %ConvertCToA.decl +// CHECK:STDOUT: .ConvertValue = %ConvertValue.decl +// CHECK:STDOUT: .ConvertRef = %ConvertRef.decl +// CHECK:STDOUT: .ConvertInit = %ConvertInit.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %ConvertCToB: = fn_decl @ConvertCToB [template] { +// CHECK:STDOUT: %ConvertCToB.decl: ConvertCToB = fn_decl @ConvertCToB [template = constants.%struct.1] { // 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 @@ -94,39 +107,39 @@ fn ConvertInit() { // CHECK:STDOUT: %.loc21_27: type = ptr_type B [template = constants.%.14] // CHECK:STDOUT: @ConvertCToB.%return: ref B* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ConvertBToA: = fn_decl @ConvertBToA [template] { +// CHECK:STDOUT: %ConvertBToA.decl: ConvertBToA = fn_decl @ConvertBToA [template = constants.%struct.2] { // 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: %.loc22_27: type = ptr_type A [template = constants.%.19] // CHECK:STDOUT: @ConvertBToA.%return: ref A* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ConvertCToA: = fn_decl @ConvertCToA [template] { +// CHECK:STDOUT: %ConvertCToA.decl: ConvertCToA = fn_decl @ConvertCToA [template = constants.%struct.3] { // 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: %.loc23_27: type = ptr_type A [template = constants.%.19] // CHECK:STDOUT: @ConvertCToA.%return: ref A* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ConvertValue: = fn_decl @ConvertValue [template] { +// CHECK:STDOUT: %ConvertValue.decl: ConvertValue = fn_decl @ConvertValue [template = constants.%struct.4] { // 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: } -// CHECK:STDOUT: %ConvertRef: = fn_decl @ConvertRef [template] { +// CHECK:STDOUT: %ConvertRef.decl: ConvertRef = fn_decl @ConvertRef [template = constants.%struct.5] { // 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: %.loc29_26: type = ptr_type A [template = constants.%.19] // CHECK:STDOUT: @ConvertRef.%return: ref A* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ConvertInit: = fn_decl @ConvertInit [template] {} +// CHECK:STDOUT: %ConvertInit.decl: ConvertInit = fn_decl @ConvertInit [template = constants.%struct.6] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { @@ -219,27 +232,27 @@ fn ConvertInit() { // CHECK:STDOUT: fn @ConvertInit() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc34_38: i32 = int_literal 1 [template = constants.%.19] +// CHECK:STDOUT: %.loc34_38: i32 = int_literal 1 [template = constants.%.20] // CHECK:STDOUT: %.loc34_39.1: {.a: i32} = struct_literal (%.loc34_38) -// CHECK:STDOUT: %.loc34_47: i32 = int_literal 2 [template = constants.%.20] +// CHECK:STDOUT: %.loc34_47: i32 = int_literal 2 [template = constants.%.21] // CHECK:STDOUT: %.loc34_48.1: {.base: {.a: i32}, .b: i32} = struct_literal (%.loc34_39.1, %.loc34_47) -// CHECK:STDOUT: %.loc34_56: i32 = int_literal 3 [template = constants.%.22] +// CHECK:STDOUT: %.loc34_56: i32 = int_literal 3 [template = constants.%.23] // CHECK:STDOUT: %.loc34_57.1: {.base: {.base: {.a: i32}, .b: i32}, .c: i32} = struct_literal (%.loc34_48.1, %.loc34_56) // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc34_57.2: ref C = temporary_storage // CHECK:STDOUT: %.loc34_57.3: ref B = class_element_access %.loc34_57.2, element0 // CHECK:STDOUT: %.loc34_48.2: ref A = class_element_access %.loc34_57.3, element0 // CHECK:STDOUT: %.loc34_39.2: ref i32 = class_element_access %.loc34_48.2, element0 -// CHECK:STDOUT: %.loc34_39.3: init i32 = initialize_from %.loc34_38 to %.loc34_39.2 [template = constants.%.19] -// CHECK:STDOUT: %.loc34_39.4: init A = class_init (%.loc34_39.3), %.loc34_48.2 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc34_48.3: init A = converted %.loc34_39.1, %.loc34_39.4 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc34_39.3: init i32 = initialize_from %.loc34_38 to %.loc34_39.2 [template = constants.%.20] +// CHECK:STDOUT: %.loc34_39.4: init A = class_init (%.loc34_39.3), %.loc34_48.2 [template = constants.%struct.7] +// CHECK:STDOUT: %.loc34_48.3: init A = converted %.loc34_39.1, %.loc34_39.4 [template = constants.%struct.7] // CHECK:STDOUT: %.loc34_48.4: ref i32 = class_element_access %.loc34_57.3, element1 -// CHECK:STDOUT: %.loc34_48.5: init i32 = initialize_from %.loc34_47 to %.loc34_48.4 [template = constants.%.20] -// CHECK:STDOUT: %.loc34_48.6: init B = class_init (%.loc34_48.3, %.loc34_48.5), %.loc34_57.3 [template = constants.%struct.2] -// CHECK:STDOUT: %.loc34_57.4: init B = converted %.loc34_48.1, %.loc34_48.6 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc34_48.5: init i32 = initialize_from %.loc34_47 to %.loc34_48.4 [template = constants.%.21] +// CHECK:STDOUT: %.loc34_48.6: init B = class_init (%.loc34_48.3, %.loc34_48.5), %.loc34_57.3 [template = constants.%struct.8] +// CHECK:STDOUT: %.loc34_57.4: init B = converted %.loc34_48.1, %.loc34_48.6 [template = constants.%struct.8] // CHECK:STDOUT: %.loc34_57.5: ref i32 = class_element_access %.loc34_57.2, element1 -// CHECK:STDOUT: %.loc34_57.6: init i32 = initialize_from %.loc34_56 to %.loc34_57.5 [template = constants.%.22] -// CHECK:STDOUT: %.loc34_57.7: init C = class_init (%.loc34_57.4, %.loc34_57.6), %.loc34_57.2 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc34_57.6: init i32 = initialize_from %.loc34_56 to %.loc34_57.5 [template = constants.%.23] +// CHECK:STDOUT: %.loc34_57.7: init C = class_init (%.loc34_57.4, %.loc34_57.6), %.loc34_57.2 [template = constants.%struct.9] // CHECK:STDOUT: %.loc34_57.8: ref C = temporary %.loc34_57.2, %.loc34_57.7 // CHECK:STDOUT: %.loc34_59: ref C = converted %.loc34_57.1, %.loc34_57.8 // CHECK:STDOUT: %.loc34_63.1: ref B = class_element_access %.loc34_59, element0 diff --git a/toolchain/check/testdata/class/extend_adapt.carbon b/toolchain/check/testdata/class/extend_adapt.carbon index 6920f0c0320d..5cded64494b3 100644 --- a/toolchain/check/testdata/class/extend_adapt.carbon +++ b/toolchain/check/testdata/class/extend_adapt.carbon @@ -92,9 +92,17 @@ class StructAdapter { // CHECK:STDOUT: %SomeClassAdapter: type = class_type @SomeClassAdapter [template] // CHECK:STDOUT: %SomeClass: type = class_type @SomeClass [template] // CHECK:STDOUT: %.1: type = unbound_element_type SomeClass, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %StaticMemberFunction: type = fn_type @StaticMemberFunction [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: StaticMemberFunction = struct_value () [template] +// CHECK:STDOUT: %AdapterMethod: type = fn_type @AdapterMethod [template] +// CHECK:STDOUT: %struct.2: AdapterMethod = struct_value () [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %TestStaticMemberFunction: type = fn_type @TestStaticMemberFunction [template] +// CHECK:STDOUT: %struct.3: TestStaticMemberFunction = struct_value () [template] +// CHECK:STDOUT: %TestAdapterMethod: type = fn_type @TestAdapterMethod [template] +// CHECK:STDOUT: %struct.4: TestAdapterMethod = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -102,19 +110,19 @@ class StructAdapter { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .SomeClassAdapter = %SomeClassAdapter.decl.loc4 // CHECK:STDOUT: .SomeClass = %SomeClass.decl -// CHECK:STDOUT: .TestStaticMemberFunction = %TestStaticMemberFunction -// CHECK:STDOUT: .TestAdapterMethod = %TestAdapterMethod +// CHECK:STDOUT: .TestStaticMemberFunction = %TestStaticMemberFunction.decl +// CHECK:STDOUT: .TestAdapterMethod = %TestAdapterMethod.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %SomeClassAdapter.decl.loc4: type = class_decl @SomeClassAdapter [template = constants.%SomeClassAdapter] {} // CHECK:STDOUT: %SomeClass.decl: type = class_decl @SomeClass [template = constants.%SomeClass] {} // CHECK:STDOUT: %SomeClassAdapter.decl.loc15: type = class_decl @SomeClassAdapter [template = constants.%SomeClassAdapter] {} -// CHECK:STDOUT: %TestStaticMemberFunction: = fn_decl @TestStaticMemberFunction [template] { +// CHECK:STDOUT: %TestStaticMemberFunction.decl: TestStaticMemberFunction = fn_decl @TestStaticMemberFunction [template = constants.%struct.3] { // CHECK:STDOUT: %SomeClassAdapter.ref.loc19: type = name_ref SomeClassAdapter, %SomeClassAdapter.decl.loc4 [template = constants.%SomeClassAdapter] // CHECK:STDOUT: %a.loc19_29.1: SomeClassAdapter = param a // CHECK:STDOUT: @TestStaticMemberFunction.%a: SomeClassAdapter = bind_name a, %a.loc19_29.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %TestAdapterMethod: = fn_decl @TestAdapterMethod [template] { +// CHECK:STDOUT: %TestAdapterMethod.decl: TestAdapterMethod = fn_decl @TestAdapterMethod [template = constants.%struct.4] { // CHECK:STDOUT: %SomeClassAdapter.ref.loc23: type = name_ref SomeClassAdapter, %SomeClassAdapter.decl.loc4 [template = constants.%SomeClassAdapter] // CHECK:STDOUT: %a.loc23_22.1: SomeClassAdapter = param a // CHECK:STDOUT: @TestAdapterMethod.%a: SomeClassAdapter = bind_name a, %a.loc23_22.1 @@ -133,8 +141,8 @@ class StructAdapter { // CHECK:STDOUT: class @SomeClass { // CHECK:STDOUT: %.loc7: = field_decl a, element0 [template] // CHECK:STDOUT: %.loc8: = field_decl b, element1 [template] -// CHECK:STDOUT: %StaticMemberFunction: = fn_decl @StaticMemberFunction [template] {} -// CHECK:STDOUT: %AdapterMethod: = fn_decl @AdapterMethod [template] { +// CHECK:STDOUT: %StaticMemberFunction.decl: StaticMemberFunction = fn_decl @StaticMemberFunction [template = constants.%struct.1] {} +// CHECK:STDOUT: %AdapterMethod.decl: AdapterMethod = fn_decl @AdapterMethod [template = constants.%struct.2] { // CHECK:STDOUT: %SomeClassAdapter.ref: type = name_ref SomeClassAdapter, file.%SomeClassAdapter.decl.loc4 [template = constants.%SomeClassAdapter] // CHECK:STDOUT: %self.loc12_20.1: SomeClassAdapter = param self // CHECK:STDOUT: %self.loc12_20.2: SomeClassAdapter = bind_name self, %self.loc12_20.1 @@ -144,8 +152,8 @@ class StructAdapter { // CHECK:STDOUT: .Self = constants.%SomeClass // CHECK:STDOUT: .a = %.loc7 // CHECK:STDOUT: .b = %.loc8 -// CHECK:STDOUT: .StaticMemberFunction = %StaticMemberFunction -// CHECK:STDOUT: .AdapterMethod = %AdapterMethod +// CHECK:STDOUT: .StaticMemberFunction = %StaticMemberFunction.decl +// CHECK:STDOUT: .AdapterMethod = %AdapterMethod.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @StaticMemberFunction(); @@ -155,7 +163,7 @@ class StructAdapter { // CHECK:STDOUT: fn @TestStaticMemberFunction(%a: SomeClassAdapter) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: SomeClassAdapter = name_ref a, %a -// CHECK:STDOUT: %StaticMemberFunction.ref: = name_ref StaticMemberFunction, @SomeClass.%StaticMemberFunction [template = @SomeClass.%StaticMemberFunction] +// CHECK:STDOUT: %StaticMemberFunction.ref: StaticMemberFunction = name_ref StaticMemberFunction, @SomeClass.%StaticMemberFunction.decl [template = constants.%struct.1] // CHECK:STDOUT: %StaticMemberFunction.call: init () = call %StaticMemberFunction.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -163,9 +171,9 @@ class StructAdapter { // CHECK:STDOUT: fn @TestAdapterMethod(%a: SomeClassAdapter) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: SomeClassAdapter = name_ref a, %a -// CHECK:STDOUT: %AdapterMethod.ref: = name_ref AdapterMethod, @SomeClass.%AdapterMethod [template = @SomeClass.%AdapterMethod] -// CHECK:STDOUT: %.loc24_4: = bound_method %a.ref, %AdapterMethod.ref -// CHECK:STDOUT: %.loc24_18: init () = call %.loc24_4(%a.ref) +// CHECK:STDOUT: %AdapterMethod.ref: AdapterMethod = name_ref AdapterMethod, @SomeClass.%AdapterMethod.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc24: = bound_method %a.ref, %AdapterMethod.ref +// CHECK:STDOUT: %AdapterMethod.call: init () = call %.loc24(%a.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -173,10 +181,14 @@ class StructAdapter { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %SomeClass: type = class_type @SomeClass [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %SomeClassAdapter: type = class_type @SomeClassAdapter [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -184,12 +196,12 @@ class StructAdapter { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .SomeClass = %SomeClass.decl // CHECK:STDOUT: .SomeClassAdapter = %SomeClassAdapter.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %SomeClass.decl: type = class_decl @SomeClass [template = constants.%SomeClass] {} // CHECK:STDOUT: %SomeClassAdapter.decl: type = class_decl @SomeClassAdapter [template = constants.%SomeClassAdapter] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: %SomeClassAdapter.ref: type = name_ref SomeClassAdapter, %SomeClassAdapter.decl [template = constants.%SomeClassAdapter] // CHECK:STDOUT: %a.loc12_6.1: SomeClassAdapter = param a // CHECK:STDOUT: @F.2.%a: SomeClassAdapter = bind_name a, %a.loc12_6.1 @@ -197,7 +209,7 @@ class StructAdapter { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @SomeClass { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%SomeClass [template = constants.%SomeClass] // CHECK:STDOUT: %self.loc5_8.1: SomeClass = param self // CHECK:STDOUT: %self.loc5_8.2: SomeClass = bind_name self, %self.loc5_8.1 @@ -205,7 +217,7 @@ class StructAdapter { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%SomeClass -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @SomeClassAdapter { @@ -222,9 +234,9 @@ class StructAdapter { // CHECK:STDOUT: fn @F.2(%a: SomeClassAdapter) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: SomeClassAdapter = name_ref a, %a -// CHECK:STDOUT: %F.ref: = name_ref F, @SomeClass.%F [template = @SomeClass.%F] -// CHECK:STDOUT: %.loc20_4: = bound_method %a.ref, %F.ref -// CHECK:STDOUT: %.loc20_6: init () = call %.loc20_4() [template = ] +// CHECK:STDOUT: %F.ref: F = name_ref F, @SomeClass.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc20: = bound_method %a.ref, %F.ref +// CHECK:STDOUT: %F.call: init () = call %.loc20() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -236,6 +248,9 @@ class StructAdapter { // CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %SomeClassAdapter: type = class_type @SomeClassAdapter [template] // CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -243,12 +258,12 @@ class StructAdapter { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .SomeClass = %SomeClass.decl // CHECK:STDOUT: .SomeClassAdapter = %SomeClassAdapter.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %SomeClass.decl: type = class_decl @SomeClass [template = constants.%SomeClass] {} // CHECK:STDOUT: %SomeClassAdapter.decl: type = class_decl @SomeClassAdapter [template = constants.%SomeClassAdapter] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %SomeClassAdapter.ref: type = name_ref SomeClassAdapter, %SomeClassAdapter.decl [template = constants.%SomeClassAdapter] // CHECK:STDOUT: %a.loc13_6.1: SomeClassAdapter = param a // CHECK:STDOUT: @F.%a: SomeClassAdapter = bind_name a, %a.loc13_6.1 diff --git a/toolchain/check/testdata/class/extern.carbon b/toolchain/check/testdata/class/extern.carbon index 8a65295573ef..292b31f2a8fd 100644 --- a/toolchain/check/testdata/class/extern.carbon +++ b/toolchain/check/testdata/class/extern.carbon @@ -342,6 +342,9 @@ extern class C; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %.1: type = fn_type @.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -351,7 +354,7 @@ extern class C; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %.loc12: = fn_decl @.1 [template] {} +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C; diff --git a/toolchain/check/testdata/class/fail_abstract.carbon b/toolchain/check/testdata/class/fail_abstract.carbon index e9206d9995bc..bf5578da2f84 100644 --- a/toolchain/check/testdata/class/fail_abstract.carbon +++ b/toolchain/check/testdata/class/fail_abstract.carbon @@ -37,15 +37,20 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: %.4: type = unbound_element_type Derived, Abstract [template] // CHECK:STDOUT: %.5: type = unbound_element_type Derived, i32 [template] // CHECK:STDOUT: %.6: type = struct_type {.base: Abstract, .d: i32} [template] -// CHECK:STDOUT: %.7: type = struct_type {.base: {.a: i32}*, .d: i32} [template] -// CHECK:STDOUT: %.8: type = ptr_type {.base: {.a: i32}*, .d: i32} [template] -// CHECK:STDOUT: %.9: type = ptr_type {.base: Abstract, .d: i32} [template] -// CHECK:STDOUT: %.10: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.11: i32 = int_literal 7 [template] -// CHECK:STDOUT: %.12: type = struct_type {.base: {.a: i32}, .d: i32} [template] -// CHECK:STDOUT: %.13: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.14: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.15: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %Make: type = fn_type @Make [template] +// CHECK:STDOUT: %.7: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Make = struct_value () [template] +// CHECK:STDOUT: %.8: type = struct_type {.base: {.a: i32}*, .d: i32} [template] +// CHECK:STDOUT: %.9: type = ptr_type {.base: {.a: i32}*, .d: i32} [template] +// CHECK:STDOUT: %.10: type = ptr_type {.base: Abstract, .d: i32} [template] +// CHECK:STDOUT: %.11: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.12: i32 = int_literal 7 [template] +// CHECK:STDOUT: %.13: type = struct_type {.base: {.a: i32}, .d: i32} [template] +// CHECK:STDOUT: %.14: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.15: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %Access: type = fn_type @Access [template] +// CHECK:STDOUT: %struct.2: Access = struct_value () [template] +// CHECK:STDOUT: %.16: type = ptr_type (i32, i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -53,22 +58,22 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Abstract = %Abstract.decl // CHECK:STDOUT: .Derived = %Derived.decl -// CHECK:STDOUT: .Make = %Make -// CHECK:STDOUT: .Access = %Access +// CHECK:STDOUT: .Make = %Make.decl +// CHECK:STDOUT: .Access = %Access.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %Make: = fn_decl @Make [template] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.1] { // CHECK:STDOUT: %Derived.ref.loc17: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: @Make.%return: ref Derived = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Access: = fn_decl @Access [template] { +// CHECK:STDOUT: %Access.decl: Access = fn_decl @Access [template = constants.%struct.2] { // 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: %.loc25_35.2: type = converted %.loc25_35.1, constants.%.15 [template = constants.%.15] // CHECK:STDOUT: @Access.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -95,9 +100,9 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: Derived { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 [template = constants.%.10] +// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 [template = constants.%.11] // CHECK:STDOUT: %.loc22_26: {.a: i32} = struct_literal (%.loc22_25) -// CHECK:STDOUT: %.loc22_34: i32 = int_literal 7 [template = constants.%.11] +// CHECK:STDOUT: %.loc22_34: i32 = int_literal 7 [template = constants.%.12] // CHECK:STDOUT: %.loc22_35: {.base: {.a: i32}, .d: i32} = struct_literal (%.loc22_26, %.loc22_34) // CHECK:STDOUT: return to %return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_adapt_bad_decl.carbon b/toolchain/check/testdata/class/fail_adapt_bad_decl.carbon index 320f9daf560d..2e0178470973 100644 --- a/toolchain/check/testdata/class/fail_adapt_bad_decl.carbon +++ b/toolchain/check/testdata/class/fail_adapt_bad_decl.carbon @@ -97,17 +97,20 @@ class C { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Bad: type = class_type @Bad [template] // CHECK:STDOUT: %.1: i32 = int_literal 100 [template] +// CHECK:STDOUT: %Use: type = fn_type @Use [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Use = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Bad = %Bad.decl -// CHECK:STDOUT: .Use = %Use +// CHECK:STDOUT: .Use = %Use.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Bad.decl: type = class_decl @Bad [template = constants.%Bad] {} -// CHECK:STDOUT: %Use: = fn_decl @Use [template] { +// CHECK:STDOUT: %Use.decl: Use = fn_decl @Use [template = constants.%struct] { // CHECK:STDOUT: %Bad.ref: type = name_ref Bad, %Bad.decl [template = constants.%Bad] // CHECK:STDOUT: %b.loc16_8.1: Bad = param b // CHECK:STDOUT: @Use.%b: Bad = bind_name b, %b.loc16_8.1 @@ -134,17 +137,20 @@ class C { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Bad: type = class_type @Bad [template] // CHECK:STDOUT: %.1: i32 = int_literal 100 [template] +// CHECK:STDOUT: %Use: type = fn_type @Use [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Use = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Bad = %Bad.decl -// CHECK:STDOUT: .Use = %Use +// CHECK:STDOUT: .Use = %Use.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Bad.decl: type = class_decl @Bad [template = constants.%Bad] {} -// CHECK:STDOUT: %Use: = fn_decl @Use [template] { +// CHECK:STDOUT: %Use.decl: Use = fn_decl @Use [template = constants.%struct] { // CHECK:STDOUT: %Bad.ref: type = name_ref Bad, %Bad.decl [template = constants.%Bad] // CHECK:STDOUT: %b.loc13_8.1: Bad = param b // CHECK:STDOUT: @Use.%b: Bad = bind_name b, %b.loc13_8.1 diff --git a/toolchain/check/testdata/class/fail_addr_not_self.carbon b/toolchain/check/testdata/class/fail_addr_not_self.carbon index 1debbec765b6..465294a17c60 100644 --- a/toolchain/check/testdata/class/fail_addr_not_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_not_self.carbon @@ -22,7 +22,12 @@ class Class { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = ptr_type Class [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -35,13 +40,13 @@ class Class { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %Class.ref.loc12: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc12: type = ptr_type Class [template = constants.%.1] // CHECK:STDOUT: %a.loc12_13.1: Class* = param a // CHECK:STDOUT: %a.loc12_13.2: Class* = bind_name a, %a.loc12_13.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Class.ref.loc17: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc17: type = ptr_type Class [template = constants.%.1] // CHECK:STDOUT: %b.loc17_13.1: Class* = param b @@ -50,8 +55,8 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F[@Class.%a.loc12_13.2: Class*](); diff --git a/toolchain/check/testdata/class/fail_addr_self.carbon b/toolchain/check/testdata/class/fail_addr_self.carbon index dbc219f72361..a31a285298d3 100644 --- a/toolchain/check/testdata/class/fail_addr_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_self.carbon @@ -45,8 +45,14 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = ptr_type Class [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.4: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -54,11 +60,11 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { // 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 @@ -70,14 +76,14 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.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: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // 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 @@ -86,8 +92,8 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1[addr @Class.%self.loc8_13.3: Class*](); @@ -97,25 +103,25 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: fn @F.2(%c: Class, %p: Class*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref.loc20: Class = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc20: = name_ref F, @Class.%F [template = @Class.%F] -// CHECK:STDOUT: %.loc20_4: = bound_method %c.ref.loc20, %F.ref.loc20 -// CHECK:STDOUT: %.loc20_6: init () = call %.loc20_4() [template = ] +// CHECK:STDOUT: %F.ref.loc20: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc20: = bound_method %c.ref.loc20, %F.ref.loc20 +// CHECK:STDOUT: %F.call.loc20: init () = call %.loc20() [template = ] // CHECK:STDOUT: %c.ref.loc29: Class = name_ref c, %c -// CHECK:STDOUT: %G.ref.loc29: = name_ref G, @Class.%G [template = @Class.%G] -// CHECK:STDOUT: %.loc29_4: = bound_method %c.ref.loc29, %G.ref.loc29 -// CHECK:STDOUT: %.loc29_6: init () = call %.loc29_4() [template = ] +// CHECK:STDOUT: %G.ref.loc29: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc29: = bound_method %c.ref.loc29, %G.ref.loc29 +// CHECK:STDOUT: %G.call.loc29: init () = call %.loc29() [template = ] // CHECK:STDOUT: %p.ref.loc32: Class* = name_ref p, %p // CHECK:STDOUT: %.loc32_4.1: ref Class = deref %p.ref.loc32 -// CHECK:STDOUT: %F.ref.loc32: = name_ref F, @Class.%F [template = @Class.%F] +// CHECK:STDOUT: %F.ref.loc32: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc32_7: = bound_method %.loc32_4.1, %F.ref.loc32 // CHECK:STDOUT: %.loc32_4.2: Class* = addr_of %.loc32_4.1 -// CHECK:STDOUT: %.loc32_9: init () = call %.loc32_7(%.loc32_4.2) +// CHECK:STDOUT: %F.call.loc32: init () = call %.loc32_7(%.loc32_4.2) // CHECK:STDOUT: %p.ref.loc40: Class* = name_ref p, %p // CHECK:STDOUT: %.loc40_4.1: ref Class = deref %p.ref.loc40 -// CHECK:STDOUT: %G.ref.loc40: = name_ref G, @Class.%G [template = @Class.%G] +// CHECK:STDOUT: %G.ref.loc40: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc40_7: = bound_method %.loc40_4.1, %G.ref.loc40 // CHECK:STDOUT: %.loc40_4.2: Class* = addr_of %.loc40_4.1 -// CHECK:STDOUT: %.loc40_9: init () = call %.loc40_7() [template = ] +// CHECK:STDOUT: %G.call.loc40: init () = call %.loc40_7() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_base_bad_type.carbon b/toolchain/check/testdata/class/fail_base_bad_type.carbon index 23e82a436179..2a90786d09a5 100644 --- a/toolchain/check/testdata/class/fail_base_bad_type.carbon +++ b/toolchain/check/testdata/class/fail_base_bad_type.carbon @@ -138,36 +138,62 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] // CHECK:STDOUT: %DeriveFromError: type = class_type @DeriveFromError [template] // CHECK:STDOUT: %.4: type = ptr_type DeriveFromError [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseError: type = fn_type @AccessMemberWithInvalidBaseError [template] +// CHECK:STDOUT: %.5: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: AccessMemberWithInvalidBaseError = struct_value () [template] // CHECK:STDOUT: %DeriveFromNonType: type = class_type @DeriveFromNonType [template] -// CHECK:STDOUT: %.5: i32 = int_literal 32 [template] -// CHECK:STDOUT: %.6: type = ptr_type DeriveFromNonType [template] +// CHECK:STDOUT: %.6: i32 = int_literal 32 [template] +// CHECK:STDOUT: %.7: type = ptr_type DeriveFromNonType [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBasNonType: type = fn_type @AccessMemberWithInvalidBasNonType [template] +// CHECK:STDOUT: %struct.2: AccessMemberWithInvalidBasNonType = struct_value () [template] // CHECK:STDOUT: %DeriveFromi32: type = class_type @DeriveFromi32 [template] -// CHECK:STDOUT: %.7: type = ptr_type DeriveFromi32 [template] -// CHECK:STDOUT: %.8: type = ptr_type i32 [template] +// CHECK:STDOUT: %.8: type = ptr_type DeriveFromi32 [template] +// CHECK:STDOUT: %.9: type = ptr_type i32 [template] +// CHECK:STDOUT: %ConvertToBadBasei32: type = fn_type @ConvertToBadBasei32 [template] +// CHECK:STDOUT: %struct.3: ConvertToBadBasei32 = struct_value () [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBasei32: type = fn_type @AccessMemberWithInvalidBasei32 [template] +// CHECK:STDOUT: %struct.4: AccessMemberWithInvalidBasei32 = struct_value () [template] // CHECK:STDOUT: %DeriveFromTuple: type = class_type @DeriveFromTuple [template] -// CHECK:STDOUT: %.9: type = tuple_type (type) [template] -// CHECK:STDOUT: %.10: type = tuple_type (Base) [template] -// CHECK:STDOUT: %.11: type = tuple_type () [template] +// CHECK:STDOUT: %.10: type = tuple_type (type) [template] +// CHECK:STDOUT: %.11: type = tuple_type (Base) [template] // CHECK:STDOUT: %.12: type = ptr_type {} [template] // CHECK:STDOUT: %.13: type = tuple_type ({}*) [template] // CHECK:STDOUT: %.14: type = ptr_type DeriveFromTuple [template] // CHECK:STDOUT: %.15: type = ptr_type (Base,) [template] +// CHECK:STDOUT: %ConvertToBadBaseTuple: type = fn_type @ConvertToBadBaseTuple [template] +// CHECK:STDOUT: %struct.5: ConvertToBadBaseTuple = struct_value () [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple: type = fn_type @AccessMemberWithInvalidBaseTuple [template] +// CHECK:STDOUT: %struct.6: AccessMemberWithInvalidBaseTuple = struct_value () [template] // CHECK:STDOUT: %DeriveFromStruct: type = class_type @DeriveFromStruct [template] // CHECK:STDOUT: %.16: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.17: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.18: type = ptr_type DeriveFromStruct [template] +// CHECK:STDOUT: %ConvertToBadBaseStruct: type = fn_type @ConvertToBadBaseStruct [template] +// CHECK:STDOUT: %struct.7: ConvertToBadBaseStruct = struct_value () [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct: type = fn_type @AccessMemberWithInvalidBaseStruct [template] +// CHECK:STDOUT: %struct.8: AccessMemberWithInvalidBaseStruct = struct_value () [template] // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] // CHECK:STDOUT: %DeriveFromIncomplete: type = class_type @DeriveFromIncomplete [template] // CHECK:STDOUT: %.19: type = ptr_type DeriveFromIncomplete [template] // CHECK:STDOUT: %.20: type = ptr_type Incomplete [template] +// CHECK:STDOUT: %ConvertToBadBaseIncomplete: type = fn_type @ConvertToBadBaseIncomplete [template] +// CHECK:STDOUT: %struct.9: ConvertToBadBaseIncomplete = struct_value () [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete: type = fn_type @AccessMemberWithInvalidBaseIncomplete [template] +// CHECK:STDOUT: %struct.10: AccessMemberWithInvalidBaseIncomplete = struct_value () [template] // CHECK:STDOUT: %DeriveFromFinal: type = class_type @DeriveFromFinal [template] // CHECK:STDOUT: %.21: type = ptr_type {.a: i32} [template] // CHECK:STDOUT: %.22: type = unbound_element_type DeriveFromFinal, Final [template] // CHECK:STDOUT: %.23: type = struct_type {.base: Final} [template] // CHECK:STDOUT: %.24: type = ptr_type DeriveFromFinal [template] // CHECK:STDOUT: %.25: type = ptr_type Final [template] +// CHECK:STDOUT: %ConvertToBadBaseFinal: type = fn_type @ConvertToBadBaseFinal [template] +// CHECK:STDOUT: %struct.11: ConvertToBadBaseFinal = struct_value () [template] // CHECK:STDOUT: %.26: type = struct_type {.base: {.a: i32}*} [template] // CHECK:STDOUT: %.27: type = ptr_type {.base: Final} [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember: type = fn_type @AccessMemberWithInvalidBaseFinal_WithMember [template] +// CHECK:STDOUT: %struct.12: AccessMemberWithInvalidBaseFinal_WithMember = struct_value () [template] +// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember: type = fn_type @AccessMemberWithInvalidBaseFinal_NoMember [template] +// CHECK:STDOUT: %struct.13: AccessMemberWithInvalidBaseFinal_NoMember = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -176,32 +202,32 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: .Base = %Base.decl // CHECK:STDOUT: .Final = %Final.decl // CHECK:STDOUT: .DeriveFromError = %DeriveFromError.decl -// CHECK:STDOUT: .AccessMemberWithInvalidBaseError = %AccessMemberWithInvalidBaseError +// CHECK:STDOUT: .AccessMemberWithInvalidBaseError = %AccessMemberWithInvalidBaseError.decl // CHECK:STDOUT: .DeriveFromNonType = %DeriveFromNonType.decl -// CHECK:STDOUT: .AccessMemberWithInvalidBasNonType = %AccessMemberWithInvalidBasNonType +// CHECK:STDOUT: .AccessMemberWithInvalidBasNonType = %AccessMemberWithInvalidBasNonType.decl // CHECK:STDOUT: .DeriveFromi32 = %DeriveFromi32.decl -// CHECK:STDOUT: .ConvertToBadBasei32 = %ConvertToBadBasei32 -// CHECK:STDOUT: .AccessMemberWithInvalidBasei32 = %AccessMemberWithInvalidBasei32 +// CHECK:STDOUT: .ConvertToBadBasei32 = %ConvertToBadBasei32.decl +// CHECK:STDOUT: .AccessMemberWithInvalidBasei32 = %AccessMemberWithInvalidBasei32.decl // CHECK:STDOUT: .DeriveFromTuple = %DeriveFromTuple.decl -// CHECK:STDOUT: .ConvertToBadBaseTuple = %ConvertToBadBaseTuple -// CHECK:STDOUT: .AccessMemberWithInvalidBaseTuple = %AccessMemberWithInvalidBaseTuple +// CHECK:STDOUT: .ConvertToBadBaseTuple = %ConvertToBadBaseTuple.decl +// CHECK:STDOUT: .AccessMemberWithInvalidBaseTuple = %AccessMemberWithInvalidBaseTuple.decl // CHECK:STDOUT: .DeriveFromStruct = %DeriveFromStruct.decl -// CHECK:STDOUT: .ConvertToBadBaseStruct = %ConvertToBadBaseStruct -// CHECK:STDOUT: .AccessMemberWithInvalidBaseStruct = %AccessMemberWithInvalidBaseStruct +// CHECK:STDOUT: .ConvertToBadBaseStruct = %ConvertToBadBaseStruct.decl +// CHECK:STDOUT: .AccessMemberWithInvalidBaseStruct = %AccessMemberWithInvalidBaseStruct.decl // CHECK:STDOUT: .Incomplete = %Incomplete.decl // CHECK:STDOUT: .DeriveFromIncomplete = %DeriveFromIncomplete.decl -// CHECK:STDOUT: .ConvertToBadBaseIncomplete = %ConvertToBadBaseIncomplete -// CHECK:STDOUT: .AccessMemberWithInvalidBaseIncomplete = %AccessMemberWithInvalidBaseIncomplete +// CHECK:STDOUT: .ConvertToBadBaseIncomplete = %ConvertToBadBaseIncomplete.decl +// CHECK:STDOUT: .AccessMemberWithInvalidBaseIncomplete = %AccessMemberWithInvalidBaseIncomplete.decl // CHECK:STDOUT: .DeriveFromFinal = %DeriveFromFinal.decl -// CHECK:STDOUT: .ConvertToBadBaseFinal = %ConvertToBadBaseFinal -// CHECK:STDOUT: .AccessMemberWithInvalidBaseFinal_WithMember = %AccessMemberWithInvalidBaseFinal_WithMember -// CHECK:STDOUT: .AccessMemberWithInvalidBaseFinal_NoMember = %AccessMemberWithInvalidBaseFinal_NoMember +// CHECK:STDOUT: .ConvertToBadBaseFinal = %ConvertToBadBaseFinal.decl +// CHECK:STDOUT: .AccessMemberWithInvalidBaseFinal_WithMember = %AccessMemberWithInvalidBaseFinal_WithMember.decl +// CHECK:STDOUT: .AccessMemberWithInvalidBaseFinal_NoMember = %AccessMemberWithInvalidBaseFinal_NoMember.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} // CHECK:STDOUT: %Final.decl: type = class_decl @Final [template = constants.%Final] {} // CHECK:STDOUT: %DeriveFromError.decl: type = class_decl @DeriveFromError [template = constants.%DeriveFromError] {} -// CHECK:STDOUT: %AccessMemberWithInvalidBaseError: = fn_decl @AccessMemberWithInvalidBaseError [template] { +// CHECK:STDOUT: %AccessMemberWithInvalidBaseError.decl: AccessMemberWithInvalidBaseError = fn_decl @AccessMemberWithInvalidBaseError [template = constants.%struct.1] { // CHECK:STDOUT: %DeriveFromError.ref: type = name_ref DeriveFromError, %DeriveFromError.decl [template = constants.%DeriveFromError] // CHECK:STDOUT: %.loc21: type = ptr_type DeriveFromError [template = constants.%.4] // CHECK:STDOUT: %p.loc21_37.1: DeriveFromError* = param p @@ -209,42 +235,42 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: @AccessMemberWithInvalidBaseError.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromNonType.decl: type = class_decl @DeriveFromNonType [template = constants.%DeriveFromNonType] {} -// CHECK:STDOUT: %AccessMemberWithInvalidBasNonType: = fn_decl @AccessMemberWithInvalidBasNonType [template] { +// CHECK:STDOUT: %AccessMemberWithInvalidBasNonType.decl: AccessMemberWithInvalidBasNonType = fn_decl @AccessMemberWithInvalidBasNonType [template = constants.%struct.2] { // CHECK:STDOUT: %DeriveFromNonType.ref: type = name_ref DeriveFromNonType, %DeriveFromNonType.decl [template = constants.%DeriveFromNonType] -// CHECK:STDOUT: %.loc31: type = ptr_type DeriveFromNonType [template = constants.%.6] +// CHECK:STDOUT: %.loc31: type = ptr_type DeriveFromNonType [template = constants.%.7] // CHECK:STDOUT: %p.loc31_38.1: DeriveFromNonType* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBasNonType.%p: DeriveFromNonType* = bind_name p, %p.loc31_38.1 // CHECK:STDOUT: @AccessMemberWithInvalidBasNonType.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromi32.decl: type = class_decl @DeriveFromi32 [template = constants.%DeriveFromi32] {} -// CHECK:STDOUT: %ConvertToBadBasei32: = fn_decl @ConvertToBadBasei32 [template] { +// CHECK:STDOUT: %ConvertToBadBasei32.decl: ConvertToBadBasei32 = fn_decl @ConvertToBadBasei32 [template = constants.%struct.3] { // CHECK:STDOUT: %DeriveFromi32.ref.loc47: type = name_ref DeriveFromi32, %DeriveFromi32.decl [template = constants.%DeriveFromi32] -// CHECK:STDOUT: %.loc47_40: type = ptr_type DeriveFromi32 [template = constants.%.7] +// CHECK:STDOUT: %.loc47_40: type = ptr_type DeriveFromi32 [template = constants.%.8] // CHECK:STDOUT: %p.loc47_24.1: DeriveFromi32* = param p // CHECK:STDOUT: @ConvertToBadBasei32.%p: DeriveFromi32* = bind_name p, %p.loc47_24.1 -// CHECK:STDOUT: %.loc47_49: type = ptr_type i32 [template = constants.%.8] +// CHECK:STDOUT: %.loc47_49: type = ptr_type i32 [template = constants.%.9] // CHECK:STDOUT: @ConvertToBadBasei32.%return: ref i32* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessMemberWithInvalidBasei32: = fn_decl @AccessMemberWithInvalidBasei32 [template] { +// CHECK:STDOUT: %AccessMemberWithInvalidBasei32.decl: AccessMemberWithInvalidBasei32 = fn_decl @AccessMemberWithInvalidBasei32 [template = constants.%struct.4] { // CHECK:STDOUT: %DeriveFromi32.ref.loc49: type = name_ref DeriveFromi32, %DeriveFromi32.decl [template = constants.%DeriveFromi32] -// CHECK:STDOUT: %.loc49: type = ptr_type DeriveFromi32 [template = constants.%.7] +// CHECK:STDOUT: %.loc49: type = ptr_type DeriveFromi32 [template = constants.%.8] // CHECK:STDOUT: %p.loc49_35.1: DeriveFromi32* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBasei32.%p: DeriveFromi32* = bind_name p, %p.loc49_35.1 // CHECK:STDOUT: @AccessMemberWithInvalidBasei32.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromTuple.decl: type = class_decl @DeriveFromTuple [template = constants.%DeriveFromTuple] {} -// CHECK:STDOUT: %ConvertToBadBaseTuple: = fn_decl @ConvertToBadBaseTuple [template] { +// CHECK:STDOUT: %ConvertToBadBaseTuple.decl: ConvertToBadBaseTuple = fn_decl @ConvertToBadBaseTuple [template = constants.%struct.5] { // CHECK:STDOUT: %DeriveFromTuple.ref.loc63: type = name_ref DeriveFromTuple, %DeriveFromTuple.decl [template = constants.%DeriveFromTuple] // CHECK:STDOUT: %.loc63_44: type = ptr_type DeriveFromTuple [template = constants.%.14] // CHECK:STDOUT: %p.loc63_26.1: DeriveFromTuple* = param p // CHECK:STDOUT: @ConvertToBadBaseTuple.%p: DeriveFromTuple* = bind_name p, %p.loc63_26.1 // CHECK:STDOUT: %Base.ref: type = name_ref Base, %Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc63_56: (type,) = tuple_literal (%Base.ref) -// CHECK:STDOUT: %.loc63_57.1: type = converted %.loc63_56, constants.%.10 [template = constants.%.10] +// CHECK:STDOUT: %.loc63_57.1: type = converted %.loc63_56, constants.%.11 [template = constants.%.11] // CHECK:STDOUT: %.loc63_57.2: type = ptr_type (Base,) [template = constants.%.15] // CHECK:STDOUT: @ConvertToBadBaseTuple.%return: ref (Base,)* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple: = fn_decl @AccessMemberWithInvalidBaseTuple [template] { +// CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple.decl: AccessMemberWithInvalidBaseTuple = fn_decl @AccessMemberWithInvalidBaseTuple [template = constants.%struct.6] { // CHECK:STDOUT: %DeriveFromTuple.ref.loc65: type = name_ref DeriveFromTuple, %DeriveFromTuple.decl [template = constants.%DeriveFromTuple] // CHECK:STDOUT: %.loc65: type = ptr_type DeriveFromTuple [template = constants.%.14] // CHECK:STDOUT: %p.loc65_37.1: DeriveFromTuple* = param p @@ -252,7 +278,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: @AccessMemberWithInvalidBaseTuple.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromStruct.decl: type = class_decl @DeriveFromStruct [template = constants.%DeriveFromStruct] {} -// CHECK:STDOUT: %ConvertToBadBaseStruct: = fn_decl @ConvertToBadBaseStruct [template] { +// CHECK:STDOUT: %ConvertToBadBaseStruct.decl: ConvertToBadBaseStruct = fn_decl @ConvertToBadBaseStruct [template = constants.%struct.7] { // CHECK:STDOUT: %DeriveFromStruct.ref.loc81: type = name_ref DeriveFromStruct, %DeriveFromStruct.decl [template = constants.%DeriveFromStruct] // CHECK:STDOUT: %.loc81_46: type = ptr_type DeriveFromStruct [template = constants.%.18] // CHECK:STDOUT: %p.loc81_27.1: DeriveFromStruct* = param p @@ -261,7 +287,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %.loc81_70: type = ptr_type {.a: i32, .b: i32} [template = constants.%.17] // CHECK:STDOUT: @ConvertToBadBaseStruct.%return: ref {.a: i32, .b: i32}* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct: = fn_decl @AccessMemberWithInvalidBaseStruct [template] { +// CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct.decl: AccessMemberWithInvalidBaseStruct = fn_decl @AccessMemberWithInvalidBaseStruct [template = constants.%struct.8] { // CHECK:STDOUT: %DeriveFromStruct.ref.loc84: type = name_ref DeriveFromStruct, %DeriveFromStruct.decl [template = constants.%DeriveFromStruct] // CHECK:STDOUT: %.loc84: type = ptr_type DeriveFromStruct [template = constants.%.18] // CHECK:STDOUT: %p.loc84_38.1: DeriveFromStruct* = param p @@ -270,7 +296,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} // CHECK:STDOUT: %DeriveFromIncomplete.decl: type = class_decl @DeriveFromIncomplete [template = constants.%DeriveFromIncomplete] {} -// CHECK:STDOUT: %ConvertToBadBaseIncomplete: = fn_decl @ConvertToBadBaseIncomplete [template] { +// CHECK:STDOUT: %ConvertToBadBaseIncomplete.decl: ConvertToBadBaseIncomplete = fn_decl @ConvertToBadBaseIncomplete [template = constants.%struct.9] { // CHECK:STDOUT: %DeriveFromIncomplete.ref.loc103: type = name_ref DeriveFromIncomplete, %DeriveFromIncomplete.decl [template = constants.%DeriveFromIncomplete] // CHECK:STDOUT: %.loc103_54: type = ptr_type DeriveFromIncomplete [template = constants.%.19] // CHECK:STDOUT: %p.loc103_31.1: DeriveFromIncomplete* = param p @@ -279,7 +305,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %.loc103_70: type = ptr_type Incomplete [template = constants.%.20] // CHECK:STDOUT: @ConvertToBadBaseIncomplete.%return: ref Incomplete* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete: = fn_decl @AccessMemberWithInvalidBaseIncomplete [template] { +// CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete.decl: AccessMemberWithInvalidBaseIncomplete = fn_decl @AccessMemberWithInvalidBaseIncomplete [template = constants.%struct.10] { // CHECK:STDOUT: %DeriveFromIncomplete.ref.loc105: type = name_ref DeriveFromIncomplete, %DeriveFromIncomplete.decl [template = constants.%DeriveFromIncomplete] // CHECK:STDOUT: %.loc105: type = ptr_type DeriveFromIncomplete [template = constants.%.19] // CHECK:STDOUT: %p.loc105_42.1: DeriveFromIncomplete* = param p @@ -287,7 +313,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: @AccessMemberWithInvalidBaseIncomplete.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromFinal.decl: type = class_decl @DeriveFromFinal [template = constants.%DeriveFromFinal] {} -// CHECK:STDOUT: %ConvertToBadBaseFinal: = fn_decl @ConvertToBadBaseFinal [template] { +// CHECK:STDOUT: %ConvertToBadBaseFinal.decl: ConvertToBadBaseFinal = fn_decl @ConvertToBadBaseFinal [template = constants.%struct.11] { // CHECK:STDOUT: %DeriveFromFinal.ref.loc116: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] // CHECK:STDOUT: %.loc116_44: type = ptr_type DeriveFromFinal [template = constants.%.24] // CHECK:STDOUT: %p.loc116_26.1: DeriveFromFinal* = param p @@ -296,14 +322,14 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %.loc116_55: type = ptr_type Final [template = constants.%.25] // CHECK:STDOUT: @ConvertToBadBaseFinal.%return: ref Final* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember: = fn_decl @AccessMemberWithInvalidBaseFinal_WithMember [template] { +// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember.decl: AccessMemberWithInvalidBaseFinal_WithMember = fn_decl @AccessMemberWithInvalidBaseFinal_WithMember [template = constants.%struct.12] { // CHECK:STDOUT: %DeriveFromFinal.ref.loc120: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] // CHECK:STDOUT: %.loc120: type = ptr_type DeriveFromFinal [template = constants.%.24] // CHECK:STDOUT: %p.loc120_48.1: DeriveFromFinal* = param p // CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_WithMember.%p: DeriveFromFinal* = bind_name p, %p.loc120_48.1 // CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_WithMember.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember: = fn_decl @AccessMemberWithInvalidBaseFinal_NoMember [template] { +// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember.decl: AccessMemberWithInvalidBaseFinal_NoMember = fn_decl @AccessMemberWithInvalidBaseFinal_NoMember [template = constants.%struct.13] { // CHECK:STDOUT: %DeriveFromFinal.ref.loc124: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] // CHECK:STDOUT: %.loc124: type = ptr_type DeriveFromFinal [template = constants.%.24] // CHECK:STDOUT: %p.loc124_46.1: DeriveFromFinal* = param p @@ -336,7 +362,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromNonType { -// CHECK:STDOUT: %.loc28_16: i32 = int_literal 32 [template = constants.%.5] +// CHECK:STDOUT: %.loc28_16: i32 = int_literal 32 [template = constants.%.6] // CHECK:STDOUT: %.loc28_18: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -357,7 +383,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: class @DeriveFromTuple { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc56_22.1: (type,) = tuple_literal (%Base.ref) -// CHECK:STDOUT: %.loc56_22.2: type = converted %.loc56_22.1, constants.%.10 [template = constants.%.10] +// CHECK:STDOUT: %.loc56_22.2: type = converted %.loc56_22.1, constants.%.11 [template = constants.%.11] // CHECK:STDOUT: %.loc56_23: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/fail_base_method_define.carbon b/toolchain/check/testdata/class/fail_base_method_define.carbon index 701f19e67cc4..385668115b4b 100644 --- a/toolchain/check/testdata/class/fail_base_method_define.carbon +++ b/toolchain/check/testdata/class/fail_base_method_define.carbon @@ -31,13 +31,21 @@ fn D.C.F() {} // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %D: type = class_type @D [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = unbound_element_type D, B [template] // CHECK:STDOUT: %.5: type = struct_type {.base: B} [template] +// CHECK:STDOUT: %F.3: type = fn_type @F.3 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %.6: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.4: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -49,26 +57,26 @@ fn D.C.F() {} // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} -// CHECK:STDOUT: %F: = fn_decl @F.3 [template] {} -// CHECK:STDOUT: %.loc28: = fn_decl @.1 [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.3] {} +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.4] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { @@ -78,7 +86,7 @@ fn D.C.F() {} // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%D // CHECK:STDOUT: .base = %.loc16 -// CHECK:STDOUT: .F = file.%F +// CHECK:STDOUT: .F = file.%F.decl // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_base_misplaced.carbon b/toolchain/check/testdata/class/fail_base_misplaced.carbon index f4cb42498980..7f9ad4f7ce86 100644 --- a/toolchain/check/testdata/class/fail_base_misplaced.carbon +++ b/toolchain/check/testdata/class/fail_base_misplaced.carbon @@ -28,6 +28,9 @@ fn F() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file {} diff --git a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon index 73cb7c564f5f..3928934614ea 100644 --- a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon +++ b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon @@ -28,8 +28,11 @@ fn AccessBInA(a: A) -> i32 { // CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %.3: type = unbound_element_type B, i32 [template] // CHECK:STDOUT: %.4: type = struct_type {.b: i32} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.b: i32} [template] +// CHECK:STDOUT: %AccessBInA: type = fn_type @AccessBInA [template] +// CHECK:STDOUT: %.5: type = tuple_type () [template] +// CHECK:STDOUT: %struct: AccessBInA = struct_value () [template] +// CHECK:STDOUT: %.6: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.7: type = ptr_type {.b: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -37,12 +40,12 @@ fn AccessBInA(a: A) -> i32 { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: .B = %B.decl -// CHECK:STDOUT: .AccessBInA = %AccessBInA +// CHECK:STDOUT: .AccessBInA = %AccessBInA.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} -// CHECK:STDOUT: %AccessBInA: = fn_decl @AccessBInA [template] { +// CHECK:STDOUT: %AccessBInA.decl: AccessBInA = fn_decl @AccessBInA [template = constants.%struct] { // CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %a.loc15_15.1: A = param a // CHECK:STDOUT: @AccessBInA.%a: A = bind_name a, %a.loc15_15.1 diff --git a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon index 76a6e0a996e7..2bfa56d0c509 100644 --- a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon +++ b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon @@ -19,19 +19,22 @@ fn Make() -> C { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.1: i32 = int_literal 123 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %Make: type = fn_type @Make [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Make = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 123 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .Make = %Make +// CHECK:STDOUT: .Make = %Make.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %Make: = fn_decl @Make [template] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @Make.%return: ref C = var // CHECK:STDOUT: } @@ -48,7 +51,7 @@ fn Make() -> C { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_16: i32 = int_literal 123 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_16: i32 = int_literal 123 [template = constants.%.2] // CHECK:STDOUT: %.loc15_19: {.a: i32} = struct_literal (%.loc15_16) // CHECK:STDOUT: return to %return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_derived_to_base.carbon b/toolchain/check/testdata/class/fail_derived_to_base.carbon index 1b082ceed85d..2231702d8293 100644 --- a/toolchain/check/testdata/class/fail_derived_to_base.carbon +++ b/toolchain/check/testdata/class/fail_derived_to_base.carbon @@ -45,12 +45,17 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: %.7: type = struct_type {.base: A2, .b: i32} [template] // CHECK:STDOUT: %.8: type = ptr_type B2 [template] // CHECK:STDOUT: %.9: type = ptr_type A1 [template] -// CHECK:STDOUT: %.10: type = struct_type {.base: {.a: i32}*, .b: i32} [template] -// CHECK:STDOUT: %.11: type = ptr_type {.base: {.a: i32}*, .b: i32} [template] -// CHECK:STDOUT: %.12: type = ptr_type {.base: A2, .b: i32} [template] +// CHECK:STDOUT: %ConvertUnrelated: type = fn_type @ConvertUnrelated [template] +// CHECK:STDOUT: %.10: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: ConvertUnrelated = struct_value () [template] +// CHECK:STDOUT: %.11: type = struct_type {.base: {.a: i32}*, .b: i32} [template] +// CHECK:STDOUT: %.12: type = ptr_type {.base: {.a: i32}*, .b: i32} [template] +// CHECK:STDOUT: %.13: type = ptr_type {.base: A2, .b: i32} [template] // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] -// CHECK:STDOUT: %.13: type = ptr_type Incomplete [template] -// CHECK:STDOUT: %.14: type = ptr_type A2 [template] +// CHECK:STDOUT: %.14: type = ptr_type Incomplete [template] +// CHECK:STDOUT: %.15: type = ptr_type A2 [template] +// CHECK:STDOUT: %ConvertIncomplete: type = fn_type @ConvertIncomplete [template] +// CHECK:STDOUT: %struct.2: ConvertIncomplete = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -59,15 +64,15 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: .A1 = %A1.decl // CHECK:STDOUT: .A2 = %A2.decl // CHECK:STDOUT: .B2 = %B2.decl -// CHECK:STDOUT: .ConvertUnrelated = %ConvertUnrelated +// CHECK:STDOUT: .ConvertUnrelated = %ConvertUnrelated.decl // CHECK:STDOUT: .Incomplete = %Incomplete.decl -// CHECK:STDOUT: .ConvertIncomplete = %ConvertIncomplete +// CHECK:STDOUT: .ConvertIncomplete = %ConvertIncomplete.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A1.decl: type = class_decl @A1 [template = constants.%A1] {} // CHECK:STDOUT: %A2.decl: type = class_decl @A2 [template = constants.%A2] {} // CHECK:STDOUT: %B2.decl: type = class_decl @B2 [template = constants.%B2] {} -// CHECK:STDOUT: %ConvertUnrelated: = fn_decl @ConvertUnrelated [template] { +// CHECK:STDOUT: %ConvertUnrelated.decl: ConvertUnrelated = fn_decl @ConvertUnrelated [template = constants.%struct.1] { // CHECK:STDOUT: %B2.ref: type = name_ref B2, %B2.decl [template = constants.%B2] // CHECK:STDOUT: %.loc24_26: type = ptr_type B2 [template = constants.%.8] // CHECK:STDOUT: %p.loc24_21.1: B2* = param p @@ -77,13 +82,13 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: @ConvertUnrelated.%return: ref A1* = var // CHECK:STDOUT: } // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} -// CHECK:STDOUT: %ConvertIncomplete: = fn_decl @ConvertIncomplete [template] { +// CHECK:STDOUT: %ConvertIncomplete.decl: ConvertIncomplete = fn_decl @ConvertIncomplete [template = constants.%struct.2] { // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc31_35: type = ptr_type Incomplete [template = constants.%.13] +// CHECK:STDOUT: %.loc31_35: type = ptr_type Incomplete [template = constants.%.14] // CHECK:STDOUT: %p.loc31_22.1: Incomplete* = param p // CHECK:STDOUT: @ConvertIncomplete.%p: Incomplete* = bind_name p, %p.loc31_22.1 // CHECK:STDOUT: %A2.ref: type = name_ref A2, %A2.decl [template = constants.%A2] -// CHECK:STDOUT: %.loc31_43: type = ptr_type A2 [template = constants.%.14] +// CHECK:STDOUT: %.loc31_43: type = ptr_type A2 [template = constants.%.15] // CHECK:STDOUT: @ConvertIncomplete.%return: ref A2* = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index 94a9d3a221c8..57723ce5fec5 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -135,82 +135,104 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = ptr_type Class [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %.1: type = fn_type @.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: = struct_value () [template] +// CHECK:STDOUT: %CallClassFunction: type = fn_type @CallClassFunction [template] +// CHECK:STDOUT: %struct.2: CallClassFunction = struct_value () [template] +// CHECK:STDOUT: %ConvertFromStruct: type = fn_type @ConvertFromStruct [template] +// CHECK:STDOUT: %struct.3: ConvertFromStruct = struct_value () [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] +// CHECK:STDOUT: %.4: type = ptr_type Class [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.4: G = struct_value () [template] +// CHECK:STDOUT: %MemberAccess: type = fn_type @MemberAccess [template] +// CHECK:STDOUT: %struct.5: MemberAccess = struct_value () [template] +// CHECK:STDOUT: %Copy: type = fn_type @Copy [template] +// CHECK:STDOUT: %struct.6: Copy = struct_value () [template] +// CHECK:STDOUT: %Let: type = fn_type @Let [template] +// CHECK:STDOUT: %struct.7: Let = struct_value () [template] +// CHECK:STDOUT: %TakeIncomplete: type = fn_type @TakeIncomplete [template] +// CHECK:STDOUT: %struct.8: TakeIncomplete = struct_value () [template] +// CHECK:STDOUT: %ReturnIncomplete: type = fn_type @ReturnIncomplete [template] +// CHECK:STDOUT: %struct.9: ReturnIncomplete = struct_value () [template] +// CHECK:STDOUT: %CallTakeIncomplete: type = fn_type @CallTakeIncomplete [template] +// CHECK:STDOUT: %struct.10: CallTakeIncomplete = struct_value () [template] +// CHECK:STDOUT: %CallReturnIncomplete: type = fn_type @CallReturnIncomplete [template] +// CHECK:STDOUT: %struct.11: CallReturnIncomplete = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .CallClassFunction = %CallClassFunction +// CHECK:STDOUT: .CallClassFunction = %CallClassFunction.decl // CHECK:STDOUT: .global_var = %global_var -// CHECK:STDOUT: .ConvertFromStruct = %ConvertFromStruct -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .MemberAccess = %MemberAccess -// CHECK:STDOUT: .Copy = %Copy -// CHECK:STDOUT: .Let = %Let -// CHECK:STDOUT: .TakeIncomplete = %TakeIncomplete -// CHECK:STDOUT: .ReturnIncomplete = %ReturnIncomplete -// CHECK:STDOUT: .CallTakeIncomplete = %CallTakeIncomplete -// CHECK:STDOUT: .CallReturnIncomplete = %CallReturnIncomplete +// CHECK:STDOUT: .ConvertFromStruct = %ConvertFromStruct.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .MemberAccess = %MemberAccess.decl +// CHECK:STDOUT: .Copy = %Copy.decl +// CHECK:STDOUT: .Let = %Let.decl +// CHECK:STDOUT: .TakeIncomplete = %TakeIncomplete.decl +// CHECK:STDOUT: .ReturnIncomplete = %ReturnIncomplete.decl +// CHECK:STDOUT: .CallTakeIncomplete = %CallTakeIncomplete.decl +// CHECK:STDOUT: .CallReturnIncomplete = %CallReturnIncomplete.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %.loc16: = fn_decl @.1 [template] {} -// CHECK:STDOUT: %CallClassFunction: = fn_decl @CallClassFunction [template] {} +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %CallClassFunction.decl: CallClassFunction = fn_decl @CallClassFunction [template = constants.%struct.2] {} // CHECK:STDOUT: %Class.ref.loc36: 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: %ConvertFromStruct.decl: ConvertFromStruct = fn_decl @ConvertFromStruct [template = constants.%struct.3] { // CHECK:STDOUT: %Class.ref.loc45: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @ConvertFromStruct.%return: ref Class = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.4] { // CHECK:STDOUT: %Class.ref.loc47: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc47: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc47: type = ptr_type Class [template = constants.%.4] // CHECK:STDOUT: %p.loc47_6.1: Class* = param p // CHECK:STDOUT: @G.%p: Class* = bind_name p, %p.loc47_6.1 // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %MemberAccess: = fn_decl @MemberAccess [template] { +// CHECK:STDOUT: %MemberAccess.decl: MemberAccess = fn_decl @MemberAccess [template = constants.%struct.5] { // CHECK:STDOUT: %Class.ref.loc58: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc58: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc58: type = ptr_type Class [template = constants.%.4] // CHECK:STDOUT: %p.loc58_17.1: Class* = param p // CHECK:STDOUT: @MemberAccess.%p: Class* = bind_name p, %p.loc58_17.1 // CHECK:STDOUT: @MemberAccess.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Copy: = fn_decl @Copy [template] { +// CHECK:STDOUT: %Copy.decl: Copy = fn_decl @Copy [template = constants.%struct.6] { // CHECK:STDOUT: %Class.ref.loc76_12: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc76: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc76: type = ptr_type Class [template = constants.%.4] // CHECK:STDOUT: %p.loc76_9.1: Class* = param p // CHECK:STDOUT: @Copy.%p: Class* = bind_name p, %p.loc76_9.1 // CHECK:STDOUT: %Class.ref.loc76_23: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @Copy.%return: ref Class = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Let: = fn_decl @Let [template] { +// CHECK:STDOUT: %Let.decl: Let = fn_decl @Let [template = constants.%struct.7] { // CHECK:STDOUT: %Class.ref.loc80: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc80: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc80: type = ptr_type Class [template = constants.%.4] // CHECK:STDOUT: %p.loc80_8.1: Class* = param p // CHECK:STDOUT: @Let.%p: Class* = bind_name p, %p.loc80_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %TakeIncomplete: = fn_decl @TakeIncomplete [template] { +// CHECK:STDOUT: %TakeIncomplete.decl: TakeIncomplete = fn_decl @TakeIncomplete [template = constants.%struct.8] { // CHECK:STDOUT: %Class.ref.loc91: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.loc91_19.1: Class = param c // CHECK:STDOUT: @TakeIncomplete.%c: Class = bind_name c, %c.loc91_19.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %ReturnIncomplete: = fn_decl @ReturnIncomplete [template] { +// CHECK:STDOUT: %ReturnIncomplete.decl: ReturnIncomplete = fn_decl @ReturnIncomplete [template = constants.%struct.9] { // CHECK:STDOUT: %Class.ref.loc93: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @ReturnIncomplete.%return: ref Class = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallTakeIncomplete: = fn_decl @CallTakeIncomplete [template] { +// CHECK:STDOUT: %CallTakeIncomplete.decl: CallTakeIncomplete = fn_decl @CallTakeIncomplete [template = constants.%struct.10] { // CHECK:STDOUT: %Class.ref.loc95: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc95: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc95: type = ptr_type Class [template = constants.%.4] // CHECK:STDOUT: %p.loc95_23.1: Class* = param p // CHECK:STDOUT: @CallTakeIncomplete.%p: Class* = bind_name p, %p.loc95_23.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %CallReturnIncomplete: = fn_decl @CallReturnIncomplete [template] {} +// CHECK:STDOUT: %CallReturnIncomplete.decl: CallReturnIncomplete = fn_decl @CallReturnIncomplete [template = constants.%struct.11] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class; @@ -269,11 +291,11 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallTakeIncomplete(%p: Class*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TakeIncomplete.ref.loc106: = name_ref TakeIncomplete, file.%TakeIncomplete [template = file.%TakeIncomplete] +// CHECK:STDOUT: %TakeIncomplete.ref.loc106: TakeIncomplete = name_ref TakeIncomplete, file.%TakeIncomplete.decl [template = constants.%struct.8] // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p // CHECK:STDOUT: %.loc106: ref Class = deref %p.ref // CHECK:STDOUT: %TakeIncomplete.call.loc106: init () = call %TakeIncomplete.ref.loc106() [template = ] -// CHECK:STDOUT: %TakeIncomplete.ref.loc118: = name_ref TakeIncomplete, file.%TakeIncomplete [template = file.%TakeIncomplete] +// CHECK:STDOUT: %TakeIncomplete.ref.loc118: TakeIncomplete = name_ref TakeIncomplete, file.%TakeIncomplete.decl [template = constants.%struct.8] // CHECK:STDOUT: %.loc118: {} = struct_literal () // CHECK:STDOUT: %TakeIncomplete.call.loc118: init () = call %TakeIncomplete.ref.loc118() [template = ] // CHECK:STDOUT: return @@ -281,7 +303,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallReturnIncomplete() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %ReturnIncomplete.ref: = name_ref ReturnIncomplete, file.%ReturnIncomplete [template = file.%ReturnIncomplete] +// CHECK:STDOUT: %ReturnIncomplete.ref: ReturnIncomplete = name_ref ReturnIncomplete, file.%ReturnIncomplete.decl [template = constants.%struct.9] // CHECK:STDOUT: %ReturnIncomplete.call: init = call %ReturnIncomplete.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_init.carbon b/toolchain/check/testdata/class/fail_init.carbon index fda833c150f9..765e44d79241 100644 --- a/toolchain/check/testdata/class/fail_init.carbon +++ b/toolchain/check/testdata/class/fail_init.carbon @@ -32,24 +32,27 @@ fn F() { // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] // CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.7: type = struct_type {.a: i32, .c: i32} [template] -// CHECK:STDOUT: %.8: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.9: type = struct_type {.a: i32, .b: i32, .c: i32} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.6: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.7: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.8: type = struct_type {.a: i32, .c: i32} [template] +// CHECK:STDOUT: %.9: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.10: type = struct_type {.a: i32, .b: i32, .c: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { @@ -64,24 +67,24 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_9: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc17_9: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc17_10.1: {.a: i32} = struct_literal (%.loc17_9) // CHECK:STDOUT: %Class.ref.loc17: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc17_10.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc17_10.3: ref Class = temporary %.loc17_10.2, // CHECK:STDOUT: %.loc17_12: ref Class = converted %.loc17_10.1, %.loc17_10.3 -// CHECK:STDOUT: %.loc22_9: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc22_17: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc22_9: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc22_17: i32 = int_literal 2 [template = constants.%.7] // CHECK:STDOUT: %.loc22_18.1: {.a: i32, .c: i32} = struct_literal (%.loc22_9, %.loc22_17) // CHECK:STDOUT: %Class.ref.loc22: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc22_18.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc22_18.3: ref i32 = class_element_access %.loc22_18.2, element0 -// CHECK:STDOUT: %.loc22_18.4: init i32 = initialize_from %.loc22_9 to %.loc22_18.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc22_18.4: init i32 = initialize_from %.loc22_9 to %.loc22_18.3 [template = constants.%.4] // CHECK:STDOUT: %.loc22_18.5: ref Class = temporary %.loc22_18.2, // CHECK:STDOUT: %.loc22_20: ref Class = converted %.loc22_18.1, %.loc22_18.5 -// CHECK:STDOUT: %.loc26_9: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc26_17: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc26_25: i32 = int_literal 3 [template = constants.%.8] +// CHECK:STDOUT: %.loc26_9: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc26_17: i32 = int_literal 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc26_25: i32 = int_literal 3 [template = constants.%.9] // CHECK:STDOUT: %.loc26_26.1: {.a: i32, .b: i32, .c: i32} = struct_literal (%.loc26_9, %.loc26_17, %.loc26_25) // CHECK:STDOUT: %Class.ref.loc26: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc26_26.2: ref Class = temporary_storage diff --git a/toolchain/check/testdata/class/fail_init_as_inplace.carbon b/toolchain/check/testdata/class/fail_init_as_inplace.carbon index 10e635c4df2d..ffe3b8dd9187 100644 --- a/toolchain/check/testdata/class/fail_init_as_inplace.carbon +++ b/toolchain/check/testdata/class/fail_init_as_inplace.carbon @@ -29,29 +29,33 @@ fn F() { // CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] // CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.3: type = ptr_type Class [template] -// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct: Class = struct_value (%.5, %.6) [template] -// CHECK:STDOUT: %.7: type = tuple_type () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.5: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.6: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.7: i32 = int_literal 2 [template] +// CHECK:STDOUT: %struct.3: Class = struct_value (%.6, %.7) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { @@ -71,21 +75,21 @@ fn F() { // CHECK:STDOUT: %Class.ref.loc21_10: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.var: ref Class = var c // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var -// CHECK:STDOUT: %.loc21_24: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc21_32: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc21_24: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc21_32: i32 = int_literal 2 [template = constants.%.7] // CHECK:STDOUT: %.loc21_33.1: {.a: i32, .b: i32} = struct_literal (%.loc21_24, %.loc21_32) // CHECK:STDOUT: %Class.ref.loc21_38: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc21_33.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc21_33.3: ref i32 = class_element_access %.loc21_33.2, element0 -// CHECK:STDOUT: %.loc21_33.4: init i32 = initialize_from %.loc21_24 to %.loc21_33.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc21_33.4: init i32 = initialize_from %.loc21_24 to %.loc21_33.3 [template = constants.%.6] // CHECK:STDOUT: %.loc21_33.5: ref i32 = class_element_access %.loc21_33.2, element1 -// CHECK:STDOUT: %.loc21_33.6: init i32 = initialize_from %.loc21_32 to %.loc21_33.5 [template = constants.%.6] -// CHECK:STDOUT: %.loc21_33.7: init Class = class_init (%.loc21_33.4, %.loc21_33.6), %.loc21_33.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc21_33.6: init i32 = initialize_from %.loc21_32 to %.loc21_33.5 [template = constants.%.7] +// CHECK:STDOUT: %.loc21_33.7: init Class = class_init (%.loc21_33.4, %.loc21_33.6), %.loc21_33.2 [template = constants.%struct.3] // CHECK:STDOUT: %.loc21_33.8: ref Class = temporary %.loc21_33.2, %.loc21_33.7 // CHECK:STDOUT: %.loc21_35.1: ref Class = converted %.loc21_33.1, %.loc21_33.8 // CHECK:STDOUT: %.loc21_35.2: Class = bind_value %.loc21_35.1 // CHECK:STDOUT: assign %c.var, -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.1] // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c // CHECK:STDOUT: %.loc22: Class* = addr_of %c.ref // CHECK:STDOUT: %G.call: init () = call %G.ref(%.loc22) diff --git a/toolchain/check/testdata/class/fail_memaccess_category.carbon b/toolchain/check/testdata/class/fail_memaccess_category.carbon index 212cc3330287..96eb2c41b003 100644 --- a/toolchain/check/testdata/class/fail_memaccess_category.carbon +++ b/toolchain/check/testdata/class/fail_memaccess_category.carbon @@ -39,12 +39,16 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %A: type = class_type @A [template] // CHECK:STDOUT: %.1: type = ptr_type A [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] // CHECK:STDOUT: %B: type = class_type @B [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] // CHECK:STDOUT: %.4: type = ptr_type {} [template] // CHECK:STDOUT: %.5: type = unbound_element_type B, A [template] // CHECK:STDOUT: %.6: type = struct_type {.a: A} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.7: type = struct_type {.a: {}*} [template] // CHECK:STDOUT: %.8: type = ptr_type {.a: A} [template] // CHECK:STDOUT: } @@ -54,12 +58,12 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: .B = %B.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.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 @@ -71,7 +75,7 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.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 @@ -81,7 +85,7 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { @@ -99,16 +103,16 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: {.a: A} = name_ref s, %s // CHECK:STDOUT: %.loc24_4: A = struct_access %s.ref, element0 -// CHECK:STDOUT: %F.ref.loc24: = name_ref F, @A.%F [template = @A.%F] +// CHECK:STDOUT: %F.ref.loc24: F = name_ref F, @A.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc24_6: = bound_method %.loc24_4, %F.ref.loc24 -// CHECK:STDOUT: %.loc24_8: init () = call %.loc24_6() [template = ] +// CHECK:STDOUT: %F.call.loc24: init () = call %.loc24_6() [template = ] // CHECK:STDOUT: %b.ref: B = name_ref b, %b // CHECK:STDOUT: %a.ref: = name_ref a, @B.%.loc12 [template = @B.%.loc12] // CHECK:STDOUT: %.loc34_4.1: ref A = class_element_access %b.ref, element0 // CHECK:STDOUT: %.loc34_4.2: A = bind_value %.loc34_4.1 -// CHECK:STDOUT: %F.ref.loc34: = name_ref F, @A.%F [template = @A.%F] +// CHECK:STDOUT: %F.ref.loc34: F = name_ref F, @A.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc34_6: = bound_method %.loc34_4.2, %F.ref.loc34 -// CHECK:STDOUT: %.loc34_8: init () = call %.loc34_6() [template = ] +// CHECK:STDOUT: %F.call.loc34: init () = call %.loc34_6() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_member_of_let.carbon b/toolchain/check/testdata/class/fail_member_of_let.carbon index 05cff612972b..13526860c2a8 100644 --- a/toolchain/check/testdata/class/fail_member_of_let.carbon +++ b/toolchain/check/testdata/class/fail_member_of_let.carbon @@ -22,7 +22,12 @@ fn T.F() {} // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %.3: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.2: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -34,17 +39,17 @@ fn T.F() {} // CHECK:STDOUT: %Class.decl: type = 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: %.decl: = fn_decl @.1 [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32; diff --git a/toolchain/check/testdata/class/fail_method.carbon b/toolchain/check/testdata/class/fail_method.carbon index 2d65ee7734ee..5fd175b69106 100644 --- a/toolchain/check/testdata/class/fail_method.carbon +++ b/toolchain/check/testdata/class/fail_method.carbon @@ -46,8 +46,14 @@ fn F(c: Class) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %NoSelf: type = fn_type @NoSelf [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: NoSelf = struct_value () [template] +// CHECK:STDOUT: %WithSelf: type = fn_type @WithSelf [template] +// CHECK:STDOUT: %struct.2: WithSelf = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -56,14 +62,14 @@ fn F(c: Class) { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl // CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = 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: %WithSelf.ref: WithSelf = name_ref WithSelf, @Class.%WithSelf.decl [template = constants.%struct.2] +// CHECK:STDOUT: %A: WithSelf = bind_alias A, @Class.%WithSelf.decl [template = constants.%struct.2] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // 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 @@ -71,8 +77,8 @@ fn F(c: Class) { // 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.decl: NoSelf = fn_decl @NoSelf [template = constants.%struct.1] {} +// CHECK:STDOUT: %WithSelf.decl: WithSelf = fn_decl @WithSelf [template = constants.%struct.2] { // 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 @@ -80,8 +86,8 @@ fn F(c: Class) { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .NoSelf = %NoSelf -// CHECK:STDOUT: .WithSelf = %WithSelf +// CHECK:STDOUT: .NoSelf = %NoSelf.decl +// CHECK:STDOUT: .WithSelf = %WithSelf.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @NoSelf(); @@ -91,23 +97,23 @@ fn F(c: Class) { // CHECK:STDOUT: fn @F(%c: Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref.loc15: Class = name_ref c, %c -// CHECK:STDOUT: %NoSelf.ref.loc15: = name_ref NoSelf, @Class.%NoSelf [template = @Class.%NoSelf] +// CHECK:STDOUT: %NoSelf.ref.loc15: NoSelf = name_ref NoSelf, @Class.%NoSelf.decl [template = constants.%struct.1] // CHECK:STDOUT: %NoSelf.call.loc15: init () = call %NoSelf.ref.loc15() // CHECK:STDOUT: %c.ref.loc16: Class = name_ref c, %c -// CHECK:STDOUT: %WithSelf.ref.loc16: = name_ref WithSelf, @Class.%WithSelf [template = @Class.%WithSelf] -// CHECK:STDOUT: %.loc16_4: = bound_method %c.ref.loc16, %WithSelf.ref.loc16 -// CHECK:STDOUT: %.loc16_13: init () = call %.loc16_4(%c.ref.loc16) +// CHECK:STDOUT: %WithSelf.ref.loc16: WithSelf = name_ref WithSelf, @Class.%WithSelf.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc16: = bound_method %c.ref.loc16, %WithSelf.ref.loc16 +// CHECK:STDOUT: %WithSelf.call.loc16: init () = call %.loc16(%c.ref.loc16) // CHECK:STDOUT: %Class.ref.loc18: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %NoSelf.ref.loc18: = name_ref NoSelf, @Class.%NoSelf [template = @Class.%NoSelf] +// CHECK:STDOUT: %NoSelf.ref.loc18: NoSelf = name_ref NoSelf, @Class.%NoSelf.decl [template = constants.%struct.1] // CHECK:STDOUT: %NoSelf.call.loc18: init () = call %NoSelf.ref.loc18() // CHECK:STDOUT: %Class.ref.loc26: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %WithSelf.ref.loc26: = name_ref WithSelf, @Class.%WithSelf [template = @Class.%WithSelf] +// CHECK:STDOUT: %WithSelf.ref.loc26: WithSelf = name_ref WithSelf, @Class.%WithSelf.decl [template = constants.%struct.2] // CHECK:STDOUT: %WithSelf.call.loc26: init () = call %WithSelf.ref.loc26() [template = ] // CHECK:STDOUT: %Class.ref.loc34: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %WithSelf.ref.loc34: = name_ref WithSelf, @Class.%WithSelf [template = @Class.%WithSelf] +// CHECK:STDOUT: %WithSelf.ref.loc34: WithSelf = name_ref WithSelf, @Class.%WithSelf.decl [template = constants.%struct.2] // CHECK:STDOUT: %c.ref.loc34: Class = name_ref c, %c // CHECK:STDOUT: %WithSelf.call.loc34: init () = call %WithSelf.ref.loc34() [template = ] -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = @Class.%WithSelf] +// CHECK:STDOUT: %A.ref: WithSelf = name_ref A, file.%A [template = constants.%struct.2] // CHECK:STDOUT: %WithSelf.call.loc42: init () = call %A.ref() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_method_modifiers.carbon b/toolchain/check/testdata/class/fail_method_modifiers.carbon index ad4cce84afa4..65baf6e1ddeb 100644 --- a/toolchain/check/testdata/class/fail_method_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_method_modifiers.carbon @@ -55,9 +55,20 @@ base class BaseClass { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %FinalClass: type = class_type @FinalClass [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %Abstract.1: type = fn_type @Abstract.1 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Abstract = struct_value () [template] +// CHECK:STDOUT: %Virtual: type = fn_type @Virtual [template] +// CHECK:STDOUT: %struct.2: Virtual = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %AbstractClass: type = class_type @AbstractClass [template] +// CHECK:STDOUT: %Default: type = fn_type @Default [template] +// CHECK:STDOUT: %struct.3: Default = struct_value () [template] +// CHECK:STDOUT: %Final: type = fn_type @Final [template] +// CHECK:STDOUT: %struct.4: Final = struct_value () [template] // CHECK:STDOUT: %BaseClass: type = class_type @BaseClass [template] +// CHECK:STDOUT: %Abstract.2: type = fn_type @Abstract.2 [template] +// CHECK:STDOUT: %struct.5: Abstract = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -74,12 +85,12 @@ base class BaseClass { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @FinalClass { -// CHECK:STDOUT: %Abstract: = fn_decl @Abstract.1 [template] { +// CHECK:STDOUT: %Abstract.decl: Abstract = fn_decl @Abstract.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc16: type = name_ref Self, constants.%FinalClass [template = constants.%FinalClass] // CHECK:STDOUT: %self.loc16_24.1: FinalClass = param self // CHECK:STDOUT: %self.loc16_24.2: FinalClass = bind_name self, %self.loc16_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %Virtual: = fn_decl @Virtual [template] { +// CHECK:STDOUT: %Virtual.decl: Virtual = fn_decl @Virtual [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc25: type = name_ref Self, constants.%FinalClass [template = constants.%FinalClass] // CHECK:STDOUT: %self.loc25_22.1: FinalClass = param self // CHECK:STDOUT: %self.loc25_22.2: FinalClass = bind_name self, %self.loc25_22.1 @@ -87,17 +98,17 @@ base class BaseClass { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%FinalClass -// CHECK:STDOUT: .Abstract = %Abstract -// CHECK:STDOUT: .Virtual = %Virtual +// CHECK:STDOUT: .Abstract = %Abstract.decl +// CHECK:STDOUT: .Virtual = %Virtual.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AbstractClass { -// CHECK:STDOUT: %Default: = fn_decl @Default [template] { +// CHECK:STDOUT: %Default.decl: Default = fn_decl @Default [template = constants.%struct.3] { // CHECK:STDOUT: %Self.ref.loc34: type = name_ref Self, constants.%AbstractClass [template = constants.%AbstractClass] // CHECK:STDOUT: %self.loc34_22.1: AbstractClass = param self // CHECK:STDOUT: %self.loc34_22.2: AbstractClass = bind_name self, %self.loc34_22.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %Final: = fn_decl @Final [template] { +// CHECK:STDOUT: %Final.decl: Final = fn_decl @Final [template = constants.%struct.4] { // CHECK:STDOUT: %Self.ref.loc40: type = name_ref Self, constants.%AbstractClass [template = constants.%AbstractClass] // CHECK:STDOUT: %self.loc40_18.1: AbstractClass = param self // CHECK:STDOUT: %self.loc40_18.2: AbstractClass = bind_name self, %self.loc40_18.1 @@ -105,12 +116,12 @@ base class BaseClass { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%AbstractClass -// CHECK:STDOUT: .Default = %Default -// CHECK:STDOUT: .Final = %Final +// CHECK:STDOUT: .Default = %Default.decl +// CHECK:STDOUT: .Final = %Final.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @BaseClass { -// CHECK:STDOUT: %Abstract: = fn_decl @Abstract.2 [template] { +// CHECK:STDOUT: %Abstract.decl: Abstract = fn_decl @Abstract.2 [template = constants.%struct.5] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%BaseClass [template = constants.%BaseClass] // CHECK:STDOUT: %self.loc51_24.1: BaseClass = param self // CHECK:STDOUT: %self.loc51_24.2: BaseClass = bind_name self, %self.loc51_24.1 @@ -118,7 +129,7 @@ base class BaseClass { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%BaseClass -// CHECK:STDOUT: .Abstract = %Abstract +// CHECK:STDOUT: .Abstract = %Abstract.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Abstract.1[@FinalClass.%self.loc16_24.2: FinalClass](); diff --git a/toolchain/check/testdata/class/fail_method_redefinition.carbon b/toolchain/check/testdata/class/fail_method_redefinition.carbon index 206fcc249e44..f307e96cfa1b 100644 --- a/toolchain/check/testdata/class/fail_method_redefinition.carbon +++ b/toolchain/check/testdata/class/fail_method_redefinition.carbon @@ -19,7 +19,10 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -32,12 +35,12 @@ class Class { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.loc8: = fn_decl @F [template] {} -// CHECK:STDOUT: %F.loc15: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl.loc8: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl.loc15: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F.loc8 +// CHECK:STDOUT: .F = %F.decl.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { 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 92b1ea9a0f1f..52b15e0b0db6 100644 --- a/toolchain/check/testdata/class/fail_out_of_line_decl.carbon +++ b/toolchain/check/testdata/class/fail_out_of_line_decl.carbon @@ -16,6 +16,9 @@ fn C.F() {} // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -25,13 +28,13 @@ fn C.F() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .F = file.%F +// CHECK:STDOUT: .F = file.%F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/class/fail_redefinition.carbon b/toolchain/check/testdata/class/fail_redefinition.carbon index 85bf47e0d955..a27002f6fa49 100644 --- a/toolchain/check/testdata/class/fail_redefinition.carbon +++ b/toolchain/check/testdata/class/fail_redefinition.carbon @@ -42,7 +42,22 @@ fn Class.I() {} // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %H.1: type = fn_type @H.1 [template] +// CHECK:STDOUT: %struct.2: H = struct_value () [template] +// CHECK:STDOUT: %I.1: type = fn_type @I.1 [template] +// CHECK:STDOUT: %struct.3: I = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.4: G = struct_value () [template] +// CHECK:STDOUT: %H.2: type = fn_type @H.2 [template] +// CHECK:STDOUT: %struct.5: H = struct_value () [template] +// CHECK:STDOUT: %I.2: type = fn_type @I.2 [template] +// CHECK:STDOUT: %struct.6: I = struct_value () [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.7: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -53,23 +68,23 @@ fn Class.I() {} // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl.loc7: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %Class.decl.loc20: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] {} -// CHECK:STDOUT: %H: = fn_decl @H.2 [template] {} -// CHECK:STDOUT: %I: = fn_decl @I.2 [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.7] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.4] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H.2 [template = constants.%struct.5] {} +// CHECK:STDOUT: %I.decl: I = fn_decl @I.2 [template = constants.%struct.6] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %G: = fn_decl @G [template] {} -// CHECK:STDOUT: %H: = fn_decl @H.2 [template] {} -// CHECK:STDOUT: %I: = fn_decl @I.2 [template] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.4] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H.2 [template = constants.%struct.5] {} +// CHECK:STDOUT: %I.decl: I = fn_decl @I.2 [template = constants.%struct.6] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .H = %H -// CHECK:STDOUT: .I = %I -// CHECK:STDOUT: .F = file.%F +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .H = %H.decl +// CHECK:STDOUT: .I = %I.decl +// CHECK:STDOUT: .F = file.%F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1(); diff --git a/toolchain/check/testdata/class/fail_scope.carbon b/toolchain/check/testdata/class/fail_scope.carbon index 4e6a1fd420b0..a6c7d1d0a59b 100644 --- a/toolchain/check/testdata/class/fail_scope.carbon +++ b/toolchain/check/testdata/class/fail_scope.carbon @@ -21,36 +21,41 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: return %.loc9 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_self.carbon b/toolchain/check/testdata/class/fail_self.carbon index 8970b6836db0..09c664f1d625 100644 --- a/toolchain/check/testdata/class/fail_self.carbon +++ b/toolchain/check/testdata/class/fail_self.carbon @@ -52,10 +52,18 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %WrongSelf: type = class_type @WrongSelf [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %CallWrongSelf: type = fn_type @CallWrongSelf [template] +// CHECK:STDOUT: %struct.4: CallWrongSelf = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -63,21 +71,21 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl // CHECK:STDOUT: .WrongSelf = %WrongSelf.decl -// CHECK:STDOUT: .CallWrongSelf = %CallWrongSelf +// CHECK:STDOUT: .CallWrongSelf = %CallWrongSelf.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc21: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc21_12.1: Class = param self // CHECK:STDOUT: @F.1.%self: Class = bind_name self, %self.loc21_12.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc24: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: @G.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %WrongSelf.decl: type = class_decl @WrongSelf [template = constants.%WrongSelf] {} -// CHECK:STDOUT: %CallWrongSelf: = fn_decl @CallWrongSelf [template] { +// CHECK:STDOUT: %CallWrongSelf.decl: CallWrongSelf = fn_decl @CallWrongSelf [template = constants.%struct.4] { // CHECK:STDOUT: %WrongSelf.ref: type = name_ref WrongSelf, %WrongSelf.decl [template = constants.%WrongSelf] // CHECK:STDOUT: %ws.loc41_18.1: WrongSelf = param ws // CHECK:STDOUT: @CallWrongSelf.%ws: WrongSelf = bind_name ws, %ws.loc41_18.1 @@ -85,24 +93,24 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc12: 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: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc14: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %return.var: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @WrongSelf { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %self.loc38_8.1: Class = param self // CHECK:STDOUT: %self.loc38_8.2: Class = bind_name self, %self.loc38_8.1 @@ -110,7 +118,7 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%WrongSelf -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1(%self: Class) { @@ -133,9 +141,9 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: fn @CallWrongSelf(%ws: WrongSelf) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ws.ref: WrongSelf = name_ref ws, %ws -// CHECK:STDOUT: %F.ref: = name_ref F, @WrongSelf.%F [template = @WrongSelf.%F] -// CHECK:STDOUT: %.loc48_5: = bound_method %ws.ref, %F.ref -// CHECK:STDOUT: %.loc48_7: init () = call %.loc48_5() [template = ] +// CHECK:STDOUT: %F.ref: F = name_ref F, @WrongSelf.%F.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc48: = bound_method %ws.ref, %F.ref +// CHECK:STDOUT: %F.call: init () = call %.loc48() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_self_type_member.carbon b/toolchain/check/testdata/class/fail_self_type_member.carbon index 0d2a5b110e9a..8e686ea01b4c 100644 --- a/toolchain/check/testdata/class/fail_self_type_member.carbon +++ b/toolchain/check/testdata/class/fail_self_type_member.carbon @@ -27,9 +27,12 @@ fn F() -> bool { // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = unbound_element_type Class, bool [template] // CHECK:STDOUT: %.2: type = struct_type {.b: bool} [template] -// CHECK:STDOUT: %.3: type = ptr_type {.b: bool} [template] -// CHECK:STDOUT: %.4: bool = bool_literal true [template] -// CHECK:STDOUT: %struct: Class = struct_value (%.4) [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type {.b: bool} [template] +// CHECK:STDOUT: %.5: bool = bool_literal true [template] +// CHECK:STDOUT: %struct.2: Class = struct_value (%.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file {} diff --git a/toolchain/check/testdata/class/fail_todo_generic_method.carbon b/toolchain/check/testdata/class/fail_todo_generic_method.carbon index 16cfca5113c9..2ae870e6908c 100644 --- a/toolchain/check/testdata/class/fail_todo_generic_method.carbon +++ b/toolchain/check/testdata/class/fail_todo_generic_method.carbon @@ -31,7 +31,12 @@ fn Class(T:! type).F[self: Self](n: T) {} // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = unbound_element_type Class, T [symbolic] -// CHECK:STDOUT: %.2: type = struct_type {.a: T} [symbolic] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: T} [symbolic] +// CHECK:STDOUT: %.4: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.2: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -44,7 +49,7 @@ fn Class(T:! type).F[self: Self](n: T) {} // CHECK:STDOUT: %T.loc11_13.1: type = param T // CHECK:STDOUT: %T.loc11_13.2: type = bind_symbolic_name T 0, %T.loc11_13.1 [symbolic = constants.%T] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc26: = fn_decl @.1 [template] { +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] { // CHECK:STDOUT: %T.loc26_10.1: type = param T // CHECK:STDOUT: @.1.%T: type = bind_symbolic_name T 0, %T.loc26_10.1 [symbolic = constants.%T] // CHECK:STDOUT: } @@ -53,7 +58,7 @@ fn Class(T:! type).F[self: Self](n: T) {} // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %T.ref.loc12: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T] // CHECK:STDOUT: %.loc12: = field_decl a, element0 [template] -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc13_8.1: Class = param self // CHECK:STDOUT: %self.loc13_8.2: Class = bind_name self, %self.loc13_8.1 @@ -65,7 +70,7 @@ fn Class(T:! type).F[self: Self](n: T) {} // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class // CHECK:STDOUT: .a = %.loc12 -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F[@Class.%self.loc13_8.2: Class](@Class.%n.loc13_20.2: T); diff --git a/toolchain/check/testdata/class/fail_todo_local_class.carbon b/toolchain/check/testdata/class/fail_todo_local_class.carbon index 463b43d2b88f..315bd257941e 100644 --- a/toolchain/check/testdata/class/fail_todo_local_class.carbon +++ b/toolchain/check/testdata/class/fail_todo_local_class.carbon @@ -26,17 +26,20 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A: type = class_type @A [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file {} // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/class/fail_todo_modifiers.carbon b/toolchain/check/testdata/class/fail_todo_modifiers.carbon index e36d8aeb3c9b..0cde60f21136 100644 --- a/toolchain/check/testdata/class/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_todo_modifiers.carbon @@ -70,11 +70,26 @@ abstract class Abstract { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Access: type = class_type @Access [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Access, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.k: i32, .l: i32} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.2: type = unbound_element_type Access, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.k: i32, .l: i32} [template] // CHECK:STDOUT: %Base: type = class_type @Base [template] -// CHECK:STDOUT: %.3: type = struct_type {} [template] +// CHECK:STDOUT: %H: type = fn_type @H [template] +// CHECK:STDOUT: %struct.3: H = struct_value () [template] +// CHECK:STDOUT: %I: type = fn_type @I [template] +// CHECK:STDOUT: %struct.4: I = struct_value () [template] +// CHECK:STDOUT: %.4: type = struct_type {} [template] // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template] +// CHECK:STDOUT: %J: type = fn_type @J [template] +// CHECK:STDOUT: %struct.5: J = struct_value () [template] +// CHECK:STDOUT: %K: type = fn_type @K [template] +// CHECK:STDOUT: %struct.6: K = struct_value () [template] +// CHECK:STDOUT: %L: type = fn_type @L [template] +// CHECK:STDOUT: %struct.7: L = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -91,39 +106,39 @@ abstract class 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.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} // CHECK:STDOUT: %.loc25: = field_decl k, element0 [template] // CHECK:STDOUT: %.loc31: = field_decl l, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Access -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: .k = %.loc25 // CHECK:STDOUT: .l = %.loc31 // 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.decl: H = fn_decl @H [template = constants.%struct.3] {} +// CHECK:STDOUT: %I.decl: I = fn_decl @I [template = constants.%struct.4] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .H = %H -// CHECK:STDOUT: .I = %I +// CHECK:STDOUT: .H = %H.decl +// CHECK:STDOUT: .I = %I.decl // 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.decl: J = fn_decl @J [template = constants.%struct.5] {} +// CHECK:STDOUT: %K.decl: K = fn_decl @K [template = constants.%struct.6] {} +// CHECK:STDOUT: %L.decl: L = fn_decl @L [template = constants.%struct.7] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Abstract -// CHECK:STDOUT: .J = %J -// CHECK:STDOUT: .K = %K -// CHECK:STDOUT: .L = %L +// CHECK:STDOUT: .J = %J.decl +// CHECK:STDOUT: .K = %K.decl +// CHECK:STDOUT: .L = %L.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); diff --git a/toolchain/check/testdata/class/fail_unbound_field.carbon b/toolchain/check/testdata/class/fail_unbound_field.carbon index 361ca6b9d812..443ab0168bb8 100644 --- a/toolchain/check/testdata/class/fail_unbound_field.carbon +++ b/toolchain/check/testdata/class/fail_unbound_field.carbon @@ -27,32 +27,37 @@ fn G() -> i32 { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.field: i32} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = struct_type {.field: i32} [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // 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.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class // CHECK:STDOUT: .field = %.loc8 -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { diff --git a/toolchain/check/testdata/class/fail_unknown_member.carbon b/toolchain/check/testdata/class/fail_unknown_member.carbon index 472fd9ed3efe..dbf4d7f5b4c9 100644 --- a/toolchain/check/testdata/class/fail_unknown_member.carbon +++ b/toolchain/check/testdata/class/fail_unknown_member.carbon @@ -22,18 +22,21 @@ fn G(c: Class) -> i32 { // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] // CHECK:STDOUT: %.2: type = struct_type {.n: i32} [template] -// CHECK:STDOUT: %.3: type = ptr_type {.n: i32} [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct: G = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type {.n: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct] { // 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 diff --git a/toolchain/check/testdata/class/field_access.carbon b/toolchain/check/testdata/class/field_access.carbon index 2e163fa23fa4..1496ac4c031b 100644 --- a/toolchain/check/testdata/class/field_access.carbon +++ b/toolchain/check/testdata/class/field_access.carbon @@ -23,20 +23,23 @@ fn Run() { // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] // CHECK:STDOUT: %.2: type = struct_type {.j: i32, .k: i32} [template] -// CHECK:STDOUT: %.3: type = ptr_type {.j: i32, .k: i32} [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Run = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type {.j: i32, .k: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { @@ -57,12 +60,12 @@ fn Run() { // CHECK:STDOUT: %c.ref.loc14: ref Class = name_ref c, %c // CHECK:STDOUT: %j.ref.loc14: = name_ref j, @Class.%.loc8 [template = @Class.%.loc8] // CHECK:STDOUT: %.loc14_4: ref i32 = class_element_access %c.ref.loc14, element0 -// CHECK:STDOUT: %.loc14_9: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_9: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: assign %.loc14_4, %.loc14_9 // CHECK:STDOUT: %c.ref.loc15: ref Class = name_ref c, %c // CHECK:STDOUT: %k.ref.loc15: = name_ref k, @Class.%.loc9 [template = @Class.%.loc9] // CHECK:STDOUT: %.loc15_4: ref i32 = class_element_access %c.ref.loc15, element1 -// CHECK:STDOUT: %.loc15_9: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_9: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: assign %.loc15_4, %.loc15_9 // CHECK:STDOUT: %cj.var: ref i32 = var cj // CHECK:STDOUT: %cj: ref i32 = bind_name cj, %cj.var diff --git a/toolchain/check/testdata/class/field_access_in_value.carbon b/toolchain/check/testdata/class/field_access_in_value.carbon index 8ab2e0dd2b2e..ea785a28803b 100644 --- a/toolchain/check/testdata/class/field_access_in_value.carbon +++ b/toolchain/check/testdata/class/field_access_in_value.carbon @@ -24,20 +24,23 @@ fn Test() { // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] // CHECK:STDOUT: %.2: type = struct_type {.j: i32, .k: i32} [template] -// CHECK:STDOUT: %.3: type = ptr_type {.j: i32, .k: i32} [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %Test: type = fn_type @Test [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Test = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type {.j: i32, .k: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .Test = %Test +// CHECK:STDOUT: .Test = %Test.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %Test: = fn_decl @Test [template] {} +// CHECK:STDOUT: %Test.decl: Test = fn_decl @Test [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { @@ -58,12 +61,12 @@ fn Test() { // CHECK:STDOUT: %cv.ref.loc14: ref Class = name_ref cv, %cv // CHECK:STDOUT: %j.ref.loc14: = name_ref j, @Class.%.loc8 [template = @Class.%.loc8] // CHECK:STDOUT: %.loc14_5: ref i32 = class_element_access %cv.ref.loc14, element0 -// CHECK:STDOUT: %.loc14_10: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_10: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: assign %.loc14_5, %.loc14_10 // CHECK:STDOUT: %cv.ref.loc15: ref Class = name_ref cv, %cv // CHECK:STDOUT: %k.ref.loc15: = name_ref k, @Class.%.loc9 [template = @Class.%.loc9] // CHECK:STDOUT: %.loc15_5: ref i32 = class_element_access %cv.ref.loc15, element1 -// CHECK:STDOUT: %.loc15_10: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_10: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: assign %.loc15_5, %.loc15_10 // CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %cv.ref.loc16: ref Class = name_ref cv, %cv diff --git a/toolchain/check/testdata/class/forward_declared.carbon b/toolchain/check/testdata/class/forward_declared.carbon index 01659dcfd313..e143fd47e134 100644 --- a/toolchain/check/testdata/class/forward_declared.carbon +++ b/toolchain/check/testdata/class/forward_declared.carbon @@ -13,17 +13,20 @@ fn F(p: Class*) -> Class* { return p; } // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = ptr_type Class [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // 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 diff --git a/toolchain/check/testdata/class/import.carbon b/toolchain/check/testdata/class/import.carbon index 995294831c80..b28a381b9c20 100644 --- a/toolchain/check/testdata/class/import.carbon +++ b/toolchain/check/testdata/class/import.carbon @@ -54,7 +54,12 @@ fn Run() { // CHECK:STDOUT: %.2: type = unbound_element_type Field, i32 [template] // CHECK:STDOUT: %.3: type = struct_type {.x: i32} [template] // CHECK:STDOUT: %ForwardDeclared: type = class_type @ForwardDeclared [template] -// CHECK:STDOUT: %.4: type = ptr_type ForwardDeclared [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.5: type = ptr_type ForwardDeclared [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -88,14 +93,14 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDeclared { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // 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: %.loc15_23: type = ptr_type ForwardDeclared [template = constants.%.5] // 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 @@ -103,8 +108,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%ForwardDeclared -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Incomplete; @@ -116,22 +121,28 @@ fn Run() { // CHECK:STDOUT: --- b.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Run = struct_value () [template] // CHECK:STDOUT: %Empty: type = class_type @Empty [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %struct.1: Empty = struct_value () [template] +// CHECK:STDOUT: %struct.2: Empty = struct_value () [template] // CHECK:STDOUT: %Field: type = class_type @Field [template] // CHECK:STDOUT: %.4: type = struct_type {.x: i32} [template] // CHECK:STDOUT: %.5: type = ptr_type {.x: i32} [template] // CHECK:STDOUT: %.6: i32 = int_literal 1 [template] -// CHECK:STDOUT: %struct.2: Field = struct_value (%.6) [template] +// CHECK:STDOUT: %struct.3: Field = struct_value (%.6) [template] // CHECK:STDOUT: %.7: type = unbound_element_type Field, i32 [template] // CHECK:STDOUT: %.8: i32 = int_literal 2 [template] // CHECK:STDOUT: %ForwardDeclared.1: type = class_type @ForwardDeclared.1 [template] -// CHECK:STDOUT: %struct.3: ForwardDeclared = struct_value () [template] +// CHECK:STDOUT: %struct.4: ForwardDeclared = struct_value () [template] // CHECK:STDOUT: %ForwardDeclared.2: type = class_type @ForwardDeclared.2 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] // CHECK:STDOUT: %.9: type = ptr_type ForwardDeclared [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.6: G = struct_value () [template] // CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] // CHECK:STDOUT: %.10: type = ptr_type Incomplete [template] // CHECK:STDOUT: } @@ -143,22 +154,22 @@ fn Run() { // CHECK:STDOUT: .ForwardDeclared = %import_ref.3 // CHECK:STDOUT: .Incomplete = %import_ref.4 // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+2, loc_16 [template = constants.%Empty] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+5, loc_24 [template = constants.%Field] // CHECK:STDOUT: %import_ref.3: type = import_ref ir1, inst+12, loc_42 [template = constants.%ForwardDeclared.1] -// CHECK:STDOUT: %import_ref.4: type = import_ref ir1, inst+26, loc_71 [template = constants.%Incomplete] +// CHECK:STDOUT: %import_ref.4: type = import_ref ir1, inst+31, loc_71 [template = constants.%Incomplete] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.1] {} // CHECK:STDOUT: %import_ref.5 = import_ref ir1, inst+3, unloaded // CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+6, unloaded // CHECK:STDOUT: %import_ref.7: = import_ref ir1, inst+8, loc_36 [template = imports.%.1] // CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+13, unloaded -// CHECK:STDOUT: %import_ref.9: = import_ref ir1, inst+25, loc_56 [template = imports.%G] -// CHECK:STDOUT: %import_ref.10: = import_ref ir1, inst+18, loc_50 [template = imports.%F] +// CHECK:STDOUT: %import_ref.9: G = import_ref ir1, inst+28, loc_56 [template = constants.%struct.6] +// CHECK:STDOUT: %import_ref.10: F = import_ref ir1, inst+18, loc_50 [template = constants.%struct.5] // CHECK:STDOUT: %import_ref.11 = import_ref ir1, inst+13, unloaded -// CHECK:STDOUT: %import_ref.12 = import_ref ir1, inst+25, unloaded +// CHECK:STDOUT: %import_ref.12 = import_ref ir1, inst+28, unloaded // CHECK:STDOUT: %import_ref.13 = import_ref ir1, inst+18, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: @@ -196,8 +207,8 @@ fn Run() { // CHECK:STDOUT: %a.var: ref Empty = var a // CHECK:STDOUT: %a: ref Empty = bind_name a, %a.var // CHECK:STDOUT: %.loc7_19.1: {} = struct_literal () -// CHECK:STDOUT: %.loc7_19.2: init Empty = class_init (), %a.var [template = constants.%struct.1] -// CHECK:STDOUT: %.loc7_20: init Empty = converted %.loc7_19.1, %.loc7_19.2 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc7_19.2: init Empty = class_init (), %a.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc7_20: init Empty = converted %.loc7_19.1, %.loc7_19.2 [template = constants.%struct.2] // CHECK:STDOUT: assign %a.var, %.loc7_20 // CHECK:STDOUT: %Field.decl: type = class_decl @Field [template = constants.%Field] {} // CHECK:STDOUT: %Field.ref: type = name_ref Field, file.%import_ref.2 [template = constants.%Field] @@ -207,8 +218,8 @@ fn Run() { // CHECK:STDOUT: %.loc9_25.1: {.x: i32} = struct_literal (%.loc9_24) // CHECK:STDOUT: %.loc9_25.2: ref i32 = class_element_access %b.var, element0 // CHECK:STDOUT: %.loc9_25.3: init i32 = initialize_from %.loc9_24 to %.loc9_25.2 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_25.4: init Field = class_init (%.loc9_25.3), %b.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc9_26: init Field = converted %.loc9_25.1, %.loc9_25.4 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc9_25.4: init Field = class_init (%.loc9_25.3), %b.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc9_26: init Field = converted %.loc9_25.1, %.loc9_25.4 [template = constants.%struct.3] // CHECK:STDOUT: assign %b.var, %.loc9_26 // CHECK:STDOUT: %b.ref: ref Field = name_ref b, %b // CHECK:STDOUT: %x.ref: = name_ref x, file.%import_ref.7 [template = imports.%.1] @@ -220,20 +231,20 @@ fn Run() { // CHECK:STDOUT: %c.var: ref ForwardDeclared = var c // CHECK:STDOUT: %c: ref ForwardDeclared = bind_name c, %c.var // CHECK:STDOUT: %.loc12_29.1: {} = struct_literal () -// CHECK:STDOUT: %.loc12_29.2: init ForwardDeclared = class_init (), %c.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc12_30: init ForwardDeclared = converted %.loc12_29.1, %.loc12_29.2 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc12_29.2: init ForwardDeclared = class_init (), %c.var [template = constants.%struct.4] +// CHECK:STDOUT: %.loc12_30: init ForwardDeclared = converted %.loc12_29.1, %.loc12_29.2 [template = constants.%struct.4] // CHECK:STDOUT: assign %c.var, %.loc12_30 // CHECK:STDOUT: %c.ref.loc13: ref ForwardDeclared = name_ref c, %c // CHECK:STDOUT: %ForwardDeclared.decl.2: type = class_decl @ForwardDeclared.2 [template = constants.%ForwardDeclared.2] {} -// CHECK:STDOUT: %F.ref: = name_ref F, file.%import_ref.10 [template = imports.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%import_ref.10 [template = constants.%struct.5] // CHECK:STDOUT: %.loc13_4: = bound_method %c.ref.loc13, %F.ref // CHECK:STDOUT: %.loc13_3: ForwardDeclared = bind_value %c.ref.loc13 -// CHECK:STDOUT: %.loc13_6: init () = call %.loc13_4(%.loc13_3) +// CHECK:STDOUT: %F.call: init () = call %.loc13_4(%.loc13_3) // CHECK:STDOUT: %c.ref.loc14: ref ForwardDeclared = name_ref c, %c -// CHECK:STDOUT: %G.ref: = name_ref G, file.%import_ref.9 [template = imports.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%import_ref.9 [template = constants.%struct.6] // CHECK:STDOUT: %.loc14_4: = bound_method %c.ref.loc14, %G.ref // CHECK:STDOUT: %.loc14_3: ForwardDeclared* = addr_of %c.ref.loc14 -// CHECK:STDOUT: %.loc14_6: init () = call %.loc14_4(%.loc14_3) +// CHECK:STDOUT: %G.call: init () = call %.loc14_4(%.loc14_3) // CHECK:STDOUT: %ForwardDeclared.ref.loc16: type = name_ref ForwardDeclared, file.%import_ref.3 [template = constants.%ForwardDeclared.1] // CHECK:STDOUT: %.loc16_25: type = ptr_type ForwardDeclared [template = constants.%.9] // CHECK:STDOUT: %d.var: ref ForwardDeclared* = var d diff --git a/toolchain/check/testdata/class/import_base.carbon b/toolchain/check/testdata/class/import_base.carbon index 0544b48e5983..ea89a0ed8cee 100644 --- a/toolchain/check/testdata/class/import_base.carbon +++ b/toolchain/check/testdata/class/import_base.carbon @@ -36,12 +36,17 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Base: type = class_type @Base [template] -// CHECK:STDOUT: %.1: type = unbound_element_type Base, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.x: i32, .unused: i32} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %Unused: type = fn_type @Unused [template] +// CHECK:STDOUT: %struct.2: Unused = struct_value () [template] +// CHECK:STDOUT: %.2: type = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.x: i32, .unused: i32} [template] // CHECK:STDOUT: %Child: type = class_type @Child [template] -// CHECK:STDOUT: %.3: type = ptr_type {.x: i32, .unused: i32} [template] -// CHECK:STDOUT: %.4: type = unbound_element_type Child, Base [template] -// CHECK:STDOUT: %.5: type = struct_type {.base: Base} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.x: i32, .unused: i32} [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Child, Base [template] +// CHECK:STDOUT: %.6: type = struct_type {.base: Base} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -56,12 +61,12 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %Unused: = fn_decl @Unused [template] { +// CHECK:STDOUT: %Unused.decl: Unused = fn_decl @Unused [template = constants.%struct.2] { // 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 @@ -71,8 +76,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .Unused = %Unused +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .Unused = %Unused.decl // CHECK:STDOUT: .x = %.loc8 // CHECK:STDOUT: .unused = %.loc9 // CHECK:STDOUT: } @@ -94,22 +99,26 @@ fn Run() { // CHECK:STDOUT: --- b.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Run = struct_value () [template] // CHECK:STDOUT: %Child: type = class_type @Child [template] // CHECK:STDOUT: %Base: type = class_type @Base [template] -// CHECK:STDOUT: %.1: type = struct_type {.x: i32, .unused: i32} [template] -// CHECK:STDOUT: %.2: type = unbound_element_type Child, Base [template] -// CHECK:STDOUT: %.3: type = struct_type {.base: Base} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.x: i32, .unused: i32} [template] -// CHECK:STDOUT: %.5: type = struct_type {.base: {.x: i32, .unused: i32}*} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.base: Base} [template] -// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.8: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.9: type = struct_type {.base: {.x: i32, .unused: i32}} [template] -// CHECK:STDOUT: %struct.1: Base = struct_value (%.7, %.8) [template] -// CHECK:STDOUT: %struct.2: Child = struct_value (%struct.1) [template] -// CHECK:STDOUT: %.10: type = unbound_element_type Base, i32 [template] -// CHECK:STDOUT: %.11: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.12: type = tuple_type () [template] +// CHECK:STDOUT: %.2: type = struct_type {.x: i32, .unused: i32} [template] +// CHECK:STDOUT: %.3: type = unbound_element_type Child, Base [template] +// CHECK:STDOUT: %.4: type = struct_type {.base: Base} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.x: i32, .unused: i32} [template] +// CHECK:STDOUT: %.6: type = struct_type {.base: {.x: i32, .unused: i32}*} [template] +// CHECK:STDOUT: %.7: type = ptr_type {.base: Base} [template] +// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.9: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.10: type = struct_type {.base: {.x: i32, .unused: i32}} [template] +// CHECK:STDOUT: %struct.2: Base = struct_value (%.8, %.9) [template] +// CHECK:STDOUT: %struct.3: Child = struct_value (%struct.2) [template] +// CHECK:STDOUT: %.11: type = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.12: i32 = int_literal 2 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -117,19 +126,19 @@ fn Run() { // CHECK:STDOUT: .Base = %import_ref.1 // CHECK:STDOUT: .Child = %import_ref.2 // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded -// CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+20, loc_16 [template = constants.%Child] +// CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+25, loc_16 [template = constants.%Child] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} -// CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+7, loc_44 [template = imports.%F] +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.1] {} +// CHECK:STDOUT: %import_ref.3: F = import_ref ir1, inst+7, loc_44 [template = constants.%struct.4] // CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+3, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+13, loc_38 [template = imports.%.1] -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+11, unloaded -// CHECK:STDOUT: %import_ref.7 = import_ref ir1, inst+16, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+21, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref ir1, inst+25, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+18, loc_38 [template = imports.%.1] +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+14, unloaded +// CHECK:STDOUT: %import_ref.7 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+26, unloaded +// CHECK:STDOUT: %import_ref.9 = import_ref ir1, inst+30, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Child { @@ -155,34 +164,34 @@ fn Run() { // 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 -// CHECK:STDOUT: %.loc7_33: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc7_46: i32 = int_literal 1 [template = constants.%.8] +// CHECK:STDOUT: %.loc7_33: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc7_46: i32 = int_literal 1 [template = constants.%.9] // CHECK:STDOUT: %.loc7_47.1: {.x: i32, .unused: i32} = struct_literal (%.loc7_33, %.loc7_46) // CHECK:STDOUT: %.loc7_48.1: {.base: {.x: i32, .unused: i32}} = struct_literal (%.loc7_47.1) // CHECK:STDOUT: %.loc7_48.2: ref Base = class_element_access %a.var, element0 // CHECK:STDOUT: %.loc7_47.2: ref i32 = class_element_access %.loc7_48.2, element0 -// CHECK:STDOUT: %.loc7_47.3: init i32 = initialize_from %.loc7_33 to %.loc7_47.2 [template = constants.%.7] +// CHECK:STDOUT: %.loc7_47.3: init i32 = initialize_from %.loc7_33 to %.loc7_47.2 [template = constants.%.8] // CHECK:STDOUT: %.loc7_47.4: ref i32 = class_element_access %.loc7_48.2, element1 -// CHECK:STDOUT: %.loc7_47.5: init i32 = initialize_from %.loc7_46 to %.loc7_47.4 [template = constants.%.8] -// CHECK:STDOUT: %.loc7_47.6: init Base = class_init (%.loc7_47.3, %.loc7_47.5), %.loc7_48.2 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc7_48.3: init Base = converted %.loc7_47.1, %.loc7_47.6 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc7_48.4: init Child = class_init (%.loc7_48.3), %a.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc7_49: init Child = converted %.loc7_48.1, %.loc7_48.4 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc7_47.5: init i32 = initialize_from %.loc7_46 to %.loc7_47.4 [template = constants.%.9] +// CHECK:STDOUT: %.loc7_47.6: init Base = class_init (%.loc7_47.3, %.loc7_47.5), %.loc7_48.2 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc7_48.3: init Base = converted %.loc7_47.1, %.loc7_47.6 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc7_48.4: init Child = class_init (%.loc7_48.3), %a.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc7_49: init Child = converted %.loc7_48.1, %.loc7_48.4 [template = constants.%struct.3] // CHECK:STDOUT: assign %a.var, %.loc7_49 // CHECK:STDOUT: %a.ref.loc8: ref Child = name_ref a, %a // CHECK:STDOUT: %x.ref: = name_ref x, file.%import_ref.5 [template = imports.%.1] // CHECK:STDOUT: %.loc8_4.1: ref Base = class_element_access %a.ref.loc8, element0 // CHECK:STDOUT: %.loc8_4.2: ref Base = converted %a.ref.loc8, %.loc8_4.1 // CHECK:STDOUT: %.loc8_4.3: ref i32 = class_element_access %.loc8_4.2, element0 -// CHECK:STDOUT: %.loc8_9: i32 = int_literal 2 [template = constants.%.11] +// CHECK:STDOUT: %.loc8_9: i32 = int_literal 2 [template = constants.%.12] // CHECK:STDOUT: assign %.loc8_4.3, %.loc8_9 // CHECK:STDOUT: %a.ref.loc9: ref Child = name_ref a, %a -// CHECK:STDOUT: %F.ref: = name_ref F, file.%import_ref.3 [template = imports.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%import_ref.3 [template = constants.%struct.4] // CHECK:STDOUT: %.loc9_4: = bound_method %a.ref.loc9, %F.ref // CHECK:STDOUT: %.loc9_6.1: ref Base = class_element_access %a.ref.loc9, element0 // CHECK:STDOUT: %.loc9_6.2: ref Base = converted %a.ref.loc9, %.loc9_6.1 // CHECK:STDOUT: %.loc9_6.3: Base = bind_value %.loc9_6.2 -// CHECK:STDOUT: %.loc9_6.4: init () = call %.loc9_4(%.loc9_6.3) +// CHECK:STDOUT: %F.call: init () = call %.loc9_4(%.loc9_6.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/import_member_cycle.carbon b/toolchain/check/testdata/class/import_member_cycle.carbon index dcebb67f7452..fc44b45107e4 100644 --- a/toolchain/check/testdata/class/import_member_cycle.carbon +++ b/toolchain/check/testdata/class/import_member_cycle.carbon @@ -53,20 +53,23 @@ fn Run() { // CHECK:STDOUT: --- b.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Run = struct_value () [template] // CHECK:STDOUT: %Cycle: type = class_type @Cycle [template] -// CHECK:STDOUT: %.1: type = ptr_type Cycle [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: Cycle*} [template] +// CHECK:STDOUT: %.2: type = ptr_type Cycle [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: Cycle*} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Cycle = %import_ref.1 // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+2, loc_16 [template = constants.%Cycle] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct] {} // CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+8, unloaded // CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+3, unloaded // CHECK:STDOUT: } @@ -81,7 +84,7 @@ fn Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Cycle.decl: type = class_decl @Cycle [template = constants.%Cycle] {} // CHECK:STDOUT: %Cycle.ref: type = name_ref Cycle, file.%import_ref.1 [template = constants.%Cycle] -// CHECK:STDOUT: %.loc7: type = ptr_type Cycle [template = constants.%.1] +// CHECK:STDOUT: %.loc7: type = ptr_type Cycle [template = constants.%.2] // CHECK:STDOUT: %a.var: ref Cycle* = var a // CHECK:STDOUT: %a: ref Cycle* = bind_name a, %a.var // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/class/import_struct_cyle.carbon b/toolchain/check/testdata/class/import_struct_cyle.carbon index 0fa82c6e5a3d..a0b2e5d4c81b 100644 --- a/toolchain/check/testdata/class/import_struct_cyle.carbon +++ b/toolchain/check/testdata/class/import_struct_cyle.carbon @@ -67,12 +67,15 @@ fn Run() { // CHECK:STDOUT: --- b.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Run = struct_value () [template] // CHECK:STDOUT: %Cycle: type = class_type @Cycle [template] -// CHECK:STDOUT: %.1: type = ptr_type Cycle [template] -// CHECK:STDOUT: %.2: type = struct_type {.b: Cycle*} [template] -// CHECK:STDOUT: %.3: type = struct_type {.c: {.b: Cycle*}} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.c: {.b: Cycle*}} [template] -// CHECK:STDOUT: %.5: type = unbound_element_type Cycle, {.b: Cycle*} [template] +// CHECK:STDOUT: %.2: type = ptr_type Cycle [template] +// CHECK:STDOUT: %.3: type = struct_type {.b: Cycle*} [template] +// CHECK:STDOUT: %.4: type = struct_type {.c: {.b: Cycle*}} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.c: {.b: Cycle*}} [template] +// CHECK:STDOUT: %.6: type = unbound_element_type Cycle, {.b: Cycle*} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -80,12 +83,12 @@ fn Run() { // CHECK:STDOUT: .Cycle = %import_ref.1 // CHECK:STDOUT: .a = %import_ref.2 // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded // CHECK:STDOUT: %import_ref.2: ref {.b: Cycle*} = import_ref ir1, inst+12, loc_14 // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct] {} // CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+3, unloaded // CHECK:STDOUT: %import_ref.4: = import_ref ir1, inst+19, loc_24 [template = imports.%.1] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/init.carbon b/toolchain/check/testdata/class/init.carbon index 5abd61c83a73..422e90aaf4b4 100644 --- a/toolchain/check/testdata/class/init.carbon +++ b/toolchain/check/testdata/class/init.carbon @@ -25,20 +25,25 @@ fn MakeReorder(n: i32, next: Class*) -> Class { // CHECK:STDOUT: %.2: type = ptr_type Class [template] // CHECK:STDOUT: %.3: type = unbound_element_type Class, Class* [template] // CHECK:STDOUT: %.4: type = struct_type {.n: i32, .next: Class*} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.n: i32, .next: Class*} [template] -// CHECK:STDOUT: %.6: type = struct_type {.next: Class*, .n: i32} [template] +// CHECK:STDOUT: %Make: type = fn_type @Make [template] +// CHECK:STDOUT: %.5: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Make = struct_value () [template] +// CHECK:STDOUT: %.6: type = ptr_type {.n: i32, .next: Class*} [template] +// CHECK:STDOUT: %MakeReorder: type = fn_type @MakeReorder [template] +// CHECK:STDOUT: %struct.2: MakeReorder = struct_value () [template] +// CHECK:STDOUT: %.7: type = struct_type {.next: Class*, .n: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .Make = %Make -// CHECK:STDOUT: .MakeReorder = %MakeReorder +// CHECK:STDOUT: .Make = %Make.decl +// CHECK:STDOUT: .MakeReorder = %MakeReorder.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %Make: = fn_decl @Make [template] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.1] { // 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] @@ -48,7 +53,7 @@ fn MakeReorder(n: i32, next: Class*) -> Class { // CHECK:STDOUT: %Class.ref.loc12_34: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @Make.%return: ref Class = var // CHECK:STDOUT: } -// CHECK:STDOUT: %MakeReorder: = fn_decl @MakeReorder [template] { +// CHECK:STDOUT: %MakeReorder.decl: MakeReorder = fn_decl @MakeReorder [template = constants.%struct.2] { // 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] diff --git a/toolchain/check/testdata/class/init_adapt.carbon b/toolchain/check/testdata/class/init_adapt.carbon index 1226161df6c6..d9d9d75ea57f 100644 --- a/toolchain/check/testdata/class/init_adapt.carbon +++ b/toolchain/check/testdata/class/init_adapt.carbon @@ -85,7 +85,12 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct: C = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %struct.1: C = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %MakeC: type = fn_type @MakeC [template] +// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %struct.2: MakeC = struct_value () [template] +// CHECK:STDOUT: %MakeAdaptC: type = fn_type @MakeAdaptC [template] +// CHECK:STDOUT: %struct.3: MakeAdaptC = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -93,8 +98,8 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .AdaptC = %AdaptC.decl -// CHECK:STDOUT: .MakeC = %MakeC -// CHECK:STDOUT: .MakeAdaptC = %MakeAdaptC +// CHECK:STDOUT: .MakeC = %MakeC.decl +// CHECK:STDOUT: .MakeAdaptC = %MakeAdaptC.decl // CHECK:STDOUT: .d = %d // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } @@ -110,7 +115,7 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %.loc13_27.4: init i32 = initialize_from %.loc13_18 to %.loc13_27.3 [template = constants.%.4] // CHECK:STDOUT: %.loc13_27.5: ref i32 = class_element_access %.loc13_27.2, element1 // CHECK:STDOUT: %.loc13_27.6: init i32 = initialize_from %.loc13_26 to %.loc13_27.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_27.7: init C = class_init (%.loc13_27.4, %.loc13_27.6), %.loc13_27.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc13_27.7: init C = class_init (%.loc13_27.4, %.loc13_27.6), %.loc13_27.2 [template = constants.%struct.1] // CHECK:STDOUT: %.loc13_27.8: ref C = temporary %.loc13_27.2, %.loc13_27.7 // CHECK:STDOUT: %.loc13_28.1: ref C = converted %.loc13_27.1, %.loc13_27.8 // CHECK:STDOUT: %.loc13_28.2: C = bind_value %.loc13_28.1 @@ -127,11 +132,11 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %.loc17_14.1: C = as_compatible %b.ref // CHECK:STDOUT: %.loc17_14.2: C = converted %b.ref, %.loc17_14.1 // CHECK:STDOUT: %c: C = bind_name c, %.loc17_14.2 -// CHECK:STDOUT: %MakeC: = fn_decl @MakeC [template] { +// CHECK:STDOUT: %MakeC.decl: MakeC = fn_decl @MakeC [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref.loc19: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @MakeC.%return: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %MakeAdaptC: = fn_decl @MakeAdaptC [template] { +// CHECK:STDOUT: %MakeAdaptC.decl: MakeAdaptC = fn_decl @MakeAdaptC [template = constants.%struct.3] { // CHECK:STDOUT: %AdaptC.ref.loc21: type = name_ref AdaptC, %AdaptC.decl [template = constants.%AdaptC] // CHECK:STDOUT: @MakeAdaptC.%return: ref AdaptC = var // CHECK:STDOUT: } @@ -167,14 +172,14 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %MakeC.ref: = name_ref MakeC, file.%MakeC [template = file.%MakeC] +// CHECK:STDOUT: %MakeC.ref: MakeC = name_ref MakeC, file.%MakeC.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc23_5: ref AdaptC = splice_block file.%d.var {} // CHECK:STDOUT: %MakeC.call: init C = call %MakeC.ref() to %.loc23_5 // CHECK:STDOUT: %AdaptC.ref: type = name_ref AdaptC, file.%AdaptC.decl [template = constants.%AdaptC] // CHECK:STDOUT: %.loc23_25.1: init AdaptC = as_compatible %MakeC.call // CHECK:STDOUT: %.loc23_25.2: init AdaptC = converted %MakeC.call, %.loc23_25.1 // CHECK:STDOUT: assign file.%d.var, %.loc23_25.2 -// CHECK:STDOUT: %MakeAdaptC.ref: = name_ref MakeAdaptC, file.%MakeAdaptC [template = file.%MakeAdaptC] +// CHECK:STDOUT: %MakeAdaptC.ref: MakeAdaptC = name_ref MakeAdaptC, file.%MakeAdaptC.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc25_5: ref C = splice_block file.%e.var {} // CHECK:STDOUT: %MakeAdaptC.call: init AdaptC = call %MakeAdaptC.ref() to %.loc25_5 // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] @@ -194,7 +199,12 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct: C = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %struct.1: C = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %MakeC: type = fn_type @MakeC [template] +// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %struct.2: MakeC = struct_value () [template] +// CHECK:STDOUT: %MakeAdaptC: type = fn_type @MakeAdaptC [template] +// CHECK:STDOUT: %struct.3: MakeAdaptC = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -202,8 +212,8 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .AdaptC = %AdaptC.decl -// CHECK:STDOUT: .MakeC = %MakeC -// CHECK:STDOUT: .MakeAdaptC = %MakeAdaptC +// CHECK:STDOUT: .MakeC = %MakeC.decl +// CHECK:STDOUT: .MakeAdaptC = %MakeAdaptC.decl // CHECK:STDOUT: .d = %d // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } @@ -219,7 +229,7 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %.loc13_27.4: init i32 = initialize_from %.loc13_18 to %.loc13_27.3 [template = constants.%.4] // CHECK:STDOUT: %.loc13_27.5: ref i32 = class_element_access %.loc13_27.2, element1 // CHECK:STDOUT: %.loc13_27.6: init i32 = initialize_from %.loc13_26 to %.loc13_27.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_27.7: init C = class_init (%.loc13_27.4, %.loc13_27.6), %.loc13_27.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc13_27.7: init C = class_init (%.loc13_27.4, %.loc13_27.6), %.loc13_27.2 [template = constants.%struct.1] // CHECK:STDOUT: %.loc13_27.8: ref C = temporary %.loc13_27.2, %.loc13_27.7 // CHECK:STDOUT: %.loc13_28.1: ref C = converted %.loc13_27.1, %.loc13_27.8 // CHECK:STDOUT: %.loc13_28.2: C = bind_value %.loc13_28.1 @@ -230,11 +240,11 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %C.ref.loc27: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.ref: AdaptC = name_ref b, %b // CHECK:STDOUT: %c: C = bind_name c, -// CHECK:STDOUT: %MakeC: = fn_decl @MakeC [template] { +// CHECK:STDOUT: %MakeC.decl: MakeC = fn_decl @MakeC [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref.loc29: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @MakeC.%return: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %MakeAdaptC: = fn_decl @MakeAdaptC [template] { +// CHECK:STDOUT: %MakeAdaptC.decl: MakeAdaptC = fn_decl @MakeAdaptC [template = constants.%struct.3] { // CHECK:STDOUT: %AdaptC.ref.loc31: type = name_ref AdaptC, %AdaptC.decl [template = constants.%AdaptC] // CHECK:STDOUT: @MakeAdaptC.%return: ref AdaptC = var // CHECK:STDOUT: } @@ -270,11 +280,11 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %MakeC.ref: = name_ref MakeC, file.%MakeC [template = file.%MakeC] +// CHECK:STDOUT: %MakeC.ref: MakeC = name_ref MakeC, file.%MakeC.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc37: ref C = temporary_storage // CHECK:STDOUT: %MakeC.call: init C = call %MakeC.ref() to %.loc37 // CHECK:STDOUT: assign file.%d.var, -// CHECK:STDOUT: %MakeAdaptC.ref: = name_ref MakeAdaptC, file.%MakeAdaptC [template = file.%MakeAdaptC] +// CHECK:STDOUT: %MakeAdaptC.ref: MakeAdaptC = name_ref MakeAdaptC, file.%MakeAdaptC.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc42: ref AdaptC = temporary_storage // CHECK:STDOUT: %MakeAdaptC.call: init AdaptC = call %MakeAdaptC.ref() to %.loc42 // CHECK:STDOUT: assign file.%e.var, diff --git a/toolchain/check/testdata/class/init_as.carbon b/toolchain/check/testdata/class/init_as.carbon index 3e5a67d4bd24..ad0c377705f9 100644 --- a/toolchain/check/testdata/class/init_as.carbon +++ b/toolchain/check/testdata/class/init_as.carbon @@ -19,21 +19,24 @@ fn F() -> i32 { // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] // CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.5: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %struct: Class = struct_value (%.3, %.4) [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.6: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %struct.2: Class = struct_value (%.4, %.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -50,16 +53,16 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13_17: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc13_25: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_17: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_25: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %.loc13_26.1: {.a: i32, .b: i32} = struct_literal (%.loc13_17, %.loc13_25) // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc13_26.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc13_26.3: ref i32 = class_element_access %.loc13_26.2, element0 -// CHECK:STDOUT: %.loc13_26.4: init i32 = initialize_from %.loc13_17 to %.loc13_26.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc13_26.4: init i32 = initialize_from %.loc13_17 to %.loc13_26.3 [template = constants.%.4] // CHECK:STDOUT: %.loc13_26.5: ref i32 = class_element_access %.loc13_26.2, element1 -// CHECK:STDOUT: %.loc13_26.6: init i32 = initialize_from %.loc13_25 to %.loc13_26.5 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_26.7: init Class = class_init (%.loc13_26.4, %.loc13_26.6), %.loc13_26.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc13_26.6: init i32 = initialize_from %.loc13_25 to %.loc13_26.5 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_26.7: init Class = class_init (%.loc13_26.4, %.loc13_26.6), %.loc13_26.2 [template = constants.%struct.2] // CHECK:STDOUT: %.loc13_26.8: ref Class = temporary %.loc13_26.2, %.loc13_26.7 // CHECK:STDOUT: %.loc13_28: ref Class = converted %.loc13_26.1, %.loc13_26.8 // CHECK:STDOUT: %a.ref: = name_ref a, @Class.%.loc8 [template = @Class.%.loc8] diff --git a/toolchain/check/testdata/class/init_nested.carbon b/toolchain/check/testdata/class/init_nested.carbon index 118a8e7dddd7..a50479eff9a8 100644 --- a/toolchain/check/testdata/class/init_nested.carbon +++ b/toolchain/check/testdata/class/init_nested.carbon @@ -26,31 +26,36 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: %Inner: type = class_type @Inner [template] // CHECK:STDOUT: %.1: type = unbound_element_type Inner, i32 [template] // CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %MakeInner: type = fn_type @MakeInner [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: MakeInner = struct_value () [template] // CHECK:STDOUT: %Outer: type = class_type @Outer [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.4: type = unbound_element_type Outer, Inner [template] -// CHECK:STDOUT: %.5: type = struct_type {.c: Inner, .d: Inner} [template] -// CHECK:STDOUT: %.6: type = struct_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} [template] -// CHECK:STDOUT: %.7: type = ptr_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} [template] -// CHECK:STDOUT: %.8: type = ptr_type {.c: Inner, .d: Inner} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Outer, Inner [template] +// CHECK:STDOUT: %.6: type = struct_type {.c: Inner, .d: Inner} [template] +// CHECK:STDOUT: %MakeOuter: type = fn_type @MakeOuter [template] +// CHECK:STDOUT: %struct.2: MakeOuter = struct_value () [template] +// CHECK:STDOUT: %.7: type = struct_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} [template] +// CHECK:STDOUT: %.8: type = ptr_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} [template] +// CHECK:STDOUT: %.9: type = ptr_type {.c: Inner, .d: Inner} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Inner = %Inner.decl -// CHECK:STDOUT: .MakeInner = %MakeInner +// CHECK:STDOUT: .MakeInner = %MakeInner.decl // CHECK:STDOUT: .Outer = %Outer.decl -// CHECK:STDOUT: .MakeOuter = %MakeOuter +// CHECK:STDOUT: .MakeOuter = %MakeOuter.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Inner.decl: type = class_decl @Inner [template = constants.%Inner] {} -// CHECK:STDOUT: %MakeInner: = fn_decl @MakeInner [template] { +// CHECK:STDOUT: %MakeInner.decl: MakeInner = fn_decl @MakeInner [template = constants.%struct.1] { // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, %Inner.decl [template = constants.%Inner] // CHECK:STDOUT: @MakeInner.%return: ref Inner = var // CHECK:STDOUT: } // CHECK:STDOUT: %Outer.decl: type = class_decl @Outer [template = constants.%Outer] {} -// CHECK:STDOUT: %MakeOuter: = fn_decl @MakeOuter [template] { +// CHECK:STDOUT: %MakeOuter.decl: MakeOuter = fn_decl @MakeOuter [template = constants.%struct.2] { // CHECK:STDOUT: %Outer.ref: type = name_ref Outer, %Outer.decl [template = constants.%Outer] // CHECK:STDOUT: @MakeOuter.%return: ref Outer = var // CHECK:STDOUT: } @@ -82,10 +87,10 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeOuter() -> %return: Outer { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %MakeInner.ref.loc20_16: = name_ref MakeInner, file.%MakeInner [template = file.%MakeInner] +// CHECK:STDOUT: %MakeInner.ref.loc20_16: MakeInner = name_ref MakeInner, file.%MakeInner.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc20_45.1: ref Inner = class_element_access %return, element0 // CHECK:STDOUT: %MakeInner.call.loc20_25: init Inner = call %MakeInner.ref.loc20_16() to %.loc20_45.1 -// CHECK:STDOUT: %MakeInner.ref.loc20_34: = name_ref MakeInner, file.%MakeInner [template = file.%MakeInner] +// CHECK:STDOUT: %MakeInner.ref.loc20_34: MakeInner = name_ref MakeInner, file.%MakeInner.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc20_45.2: ref Inner = class_element_access %return, element1 // CHECK:STDOUT: %MakeInner.call.loc20_43: init Inner = call %MakeInner.ref.loc20_34() to %.loc20_45.2 // CHECK:STDOUT: %.loc20_45.3: {.c: Inner, .d: Inner} = struct_literal (%MakeInner.call.loc20_25, %MakeInner.call.loc20_43) diff --git a/toolchain/check/testdata/class/method.carbon b/toolchain/check/testdata/class/method.carbon index 1179e4843e6e..cbd19cd813f8 100644 --- a/toolchain/check/testdata/class/method.carbon +++ b/toolchain/check/testdata/class/method.carbon @@ -58,103 +58,126 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = ptr_type Class [template] -// CHECK:STDOUT: %.2: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.3: type = struct_type {.k: i32} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.k: i32} [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] -// CHECK:STDOUT: %struct: Class = struct_value (%.5) [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = ptr_type Class [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.3: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.4: type = struct_type {.k: i32} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.k: i32} [template] +// CHECK:STDOUT: %Call: type = fn_type @Call [template] +// CHECK:STDOUT: %struct.3: Call = struct_value () [template] +// CHECK:STDOUT: %CallAlias: type = fn_type @CallAlias [template] +// CHECK:STDOUT: %struct.4: CallAlias = struct_value () [template] +// CHECK:STDOUT: %CallOnConstBoundMethod: type = fn_type @CallOnConstBoundMethod [template] +// CHECK:STDOUT: %struct.5: CallOnConstBoundMethod = struct_value () [template] +// CHECK:STDOUT: %.6: i32 = int_literal 1 [template] +// CHECK:STDOUT: %struct.6: Class = struct_value (%.6) [template] +// CHECK:STDOUT: %CallWithAddr: type = fn_type @CallWithAddr [template] +// CHECK:STDOUT: %struct.7: CallWithAddr = struct_value () [template] +// CHECK:STDOUT: %CallFThroughPointer: type = fn_type @CallFThroughPointer [template] +// CHECK:STDOUT: %struct.8: CallFThroughPointer = struct_value () [template] +// CHECK:STDOUT: %CallGThroughPointer: type = fn_type @CallGThroughPointer [template] +// CHECK:STDOUT: %struct.9: CallGThroughPointer = struct_value () [template] +// CHECK:STDOUT: %Make: type = fn_type @Make [template] +// CHECK:STDOUT: %struct.10: Make = struct_value () [template] +// CHECK:STDOUT: %CallFOnInitializingExpr: type = fn_type @CallFOnInitializingExpr [template] +// CHECK:STDOUT: %struct.11: CallFOnInitializingExpr = struct_value () [template] +// CHECK:STDOUT: %CallGOnInitializingExpr: type = fn_type @CallGOnInitializingExpr [template] +// CHECK:STDOUT: %struct.12: CallGOnInitializingExpr = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .Call = %Call -// CHECK:STDOUT: .CallAlias = %CallAlias -// CHECK:STDOUT: .CallOnConstBoundMethod = %CallOnConstBoundMethod -// CHECK:STDOUT: .CallWithAddr = %CallWithAddr -// CHECK:STDOUT: .CallFThroughPointer = %CallFThroughPointer -// CHECK:STDOUT: .CallGThroughPointer = %CallGThroughPointer -// CHECK:STDOUT: .Make = %Make -// CHECK:STDOUT: .CallFOnInitializingExpr = %CallFOnInitializingExpr -// CHECK:STDOUT: .CallGOnInitializingExpr = %CallGOnInitializingExpr +// CHECK:STDOUT: .Call = %Call.decl +// CHECK:STDOUT: .CallAlias = %CallAlias.decl +// CHECK:STDOUT: .CallOnConstBoundMethod = %CallOnConstBoundMethod.decl +// CHECK:STDOUT: .CallWithAddr = %CallWithAddr.decl +// CHECK:STDOUT: .CallFThroughPointer = %CallFThroughPointer.decl +// CHECK:STDOUT: .CallGThroughPointer = %CallGThroughPointer.decl +// CHECK:STDOUT: .Make = %Make.decl +// CHECK:STDOUT: .CallFOnInitializingExpr = %CallFOnInitializingExpr.decl +// CHECK:STDOUT: .CallGOnInitializingExpr = %CallGOnInitializingExpr.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [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: @F.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Call: = fn_decl @Call [template] { +// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.3] { // 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: @Call.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallAlias: = fn_decl @CallAlias [template] { +// CHECK:STDOUT: %CallAlias.decl: CallAlias = fn_decl @CallAlias [template = constants.%struct.4] { // 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: @CallAlias.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallOnConstBoundMethod: = fn_decl @CallOnConstBoundMethod [template] { +// CHECK:STDOUT: %CallOnConstBoundMethod.decl: CallOnConstBoundMethod = fn_decl @CallOnConstBoundMethod [template = constants.%struct.5] { // CHECK:STDOUT: @CallOnConstBoundMethod.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallWithAddr: = fn_decl @CallWithAddr [template] { +// CHECK:STDOUT: %CallWithAddr.decl: CallWithAddr = fn_decl @CallWithAddr [template = constants.%struct.7] { // CHECK:STDOUT: @CallWithAddr.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallFThroughPointer: = fn_decl @CallFThroughPointer [template] { +// CHECK:STDOUT: %CallFThroughPointer.decl: CallFThroughPointer = fn_decl @CallFThroughPointer [template = constants.%struct.8] { // 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: %.loc39: type = ptr_type Class [template = constants.%.2] // CHECK:STDOUT: %p.loc39_24.1: Class* = param p // CHECK:STDOUT: @CallFThroughPointer.%p: Class* = bind_name p, %p.loc39_24.1 // CHECK:STDOUT: @CallFThroughPointer.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallGThroughPointer: = fn_decl @CallGThroughPointer [template] { +// CHECK:STDOUT: %CallGThroughPointer.decl: CallGThroughPointer = fn_decl @CallGThroughPointer [template = constants.%struct.9] { // 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: %.loc43: type = ptr_type Class [template = constants.%.2] // CHECK:STDOUT: %p.loc43_24.1: Class* = param p // CHECK:STDOUT: @CallGThroughPointer.%p: Class* = bind_name p, %p.loc43_24.1 // CHECK:STDOUT: @CallGThroughPointer.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Make: = fn_decl @Make [template] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.10] { // CHECK:STDOUT: %Class.ref.loc47: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @Make.%return: ref Class = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallFOnInitializingExpr: = fn_decl @CallFOnInitializingExpr [template] { +// CHECK:STDOUT: %CallFOnInitializingExpr.decl: CallFOnInitializingExpr = fn_decl @CallFOnInitializingExpr [template = constants.%struct.11] { // CHECK:STDOUT: @CallFOnInitializingExpr.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %CallGOnInitializingExpr: = fn_decl @CallGOnInitializingExpr [template] { +// CHECK:STDOUT: %CallGOnInitializingExpr.decl: CallGOnInitializingExpr = fn_decl @CallGOnInitializingExpr [template = constants.%struct.12] { // CHECK:STDOUT: @CallGOnInitializingExpr.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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.loc8: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc9_23: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %.loc9_23: type = ptr_type Class [template = constants.%.2] // 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: } -// CHECK:STDOUT: %F.ref: = name_ref F, %F [template = %F] -// CHECK:STDOUT: %A: = bind_alias A, %F [template = %F] +// CHECK:STDOUT: %F.ref: F = name_ref F, %F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %A: F = bind_alias A, %F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc13: = field_decl k, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: .A = %A // CHECK:STDOUT: .k = %.loc13 // CHECK:STDOUT: } @@ -173,42 +196,42 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: fn @Call(%c: Class) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: Class = name_ref c, %c -// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc23_11: = bound_method %c.ref, %F.ref -// CHECK:STDOUT: %.loc23_13: init i32 = call %.loc23_11(%c.ref) -// CHECK:STDOUT: %.loc23_15.1: i32 = value_of_initializer %.loc23_13 -// CHECK:STDOUT: %.loc23_15.2: i32 = converted %.loc23_13, %.loc23_15.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc23_11(%c.ref) +// CHECK:STDOUT: %.loc23_15.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc23_15.2: i32 = converted %F.call, %.loc23_15.1 // CHECK:STDOUT: return %.loc23_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallAlias(%c: Class) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: Class = name_ref c, %c -// CHECK:STDOUT: %A.ref: = name_ref A, @Class.%A [template = @Class.%F] +// CHECK:STDOUT: %A.ref: F = name_ref A, @Class.%A [template = constants.%struct.1] // CHECK:STDOUT: %.loc27_11: = bound_method %c.ref, %A.ref -// CHECK:STDOUT: %.loc27_13: init i32 = call %.loc27_11(%c.ref) -// CHECK:STDOUT: %.loc27_15.1: i32 = value_of_initializer %.loc27_13 -// CHECK:STDOUT: %.loc27_15.2: i32 = converted %.loc27_13, %.loc27_15.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc27_11(%c.ref) +// CHECK:STDOUT: %.loc27_15.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc27_15.2: i32 = converted %F.call, %.loc27_15.1 // CHECK:STDOUT: return %.loc27_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallOnConstBoundMethod() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc31_17: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc31_17: i32 = int_literal 1 [template = constants.%.6] // CHECK:STDOUT: %.loc31_18.1: {.k: i32} = struct_literal (%.loc31_17) // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc31_18.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc31_18.3: ref i32 = class_element_access %.loc31_18.2, element0 -// CHECK:STDOUT: %.loc31_18.4: init i32 = initialize_from %.loc31_17 to %.loc31_18.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc31_18.5: init Class = class_init (%.loc31_18.4), %.loc31_18.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc31_18.4: init i32 = initialize_from %.loc31_17 to %.loc31_18.3 [template = constants.%.6] +// CHECK:STDOUT: %.loc31_18.5: init Class = class_init (%.loc31_18.4), %.loc31_18.2 [template = constants.%struct.6] // CHECK:STDOUT: %.loc31_18.6: ref Class = temporary %.loc31_18.2, %.loc31_18.5 // CHECK:STDOUT: %.loc31_20.1: ref Class = converted %.loc31_18.1, %.loc31_18.6 -// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc31_29: = bound_method %.loc31_20.1, %F.ref // CHECK:STDOUT: %.loc31_20.2: Class = bind_value %.loc31_20.1 -// CHECK:STDOUT: %.loc31_31: init i32 = call %.loc31_29(%.loc31_20.2) -// CHECK:STDOUT: %.loc31_33.1: i32 = value_of_initializer %.loc31_31 -// CHECK:STDOUT: %.loc31_33.2: i32 = converted %.loc31_31, %.loc31_33.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc31_29(%.loc31_20.2) +// CHECK:STDOUT: %.loc31_33.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc31_33.2: i32 = converted %F.call, %.loc31_33.1 // CHECK:STDOUT: return %.loc31_33.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -218,12 +241,12 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: %c.var: ref Class = var c // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c -// CHECK:STDOUT: %G.ref: = name_ref G, @Class.%G [template = @Class.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc36_11: = bound_method %c.ref, %G.ref // CHECK:STDOUT: %.loc36_10: Class* = addr_of %c.ref -// CHECK:STDOUT: %.loc36_13: init i32 = call %.loc36_11(%.loc36_10) -// CHECK:STDOUT: %.loc36_15.1: i32 = value_of_initializer %.loc36_13 -// CHECK:STDOUT: %.loc36_15.2: i32 = converted %.loc36_13, %.loc36_15.1 +// CHECK:STDOUT: %G.call: init i32 = call %.loc36_11(%.loc36_10) +// CHECK:STDOUT: %.loc36_15.1: i32 = value_of_initializer %G.call +// CHECK:STDOUT: %.loc36_15.2: i32 = converted %G.call, %.loc36_15.1 // CHECK:STDOUT: return %.loc36_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -231,12 +254,12 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p // CHECK:STDOUT: %.loc40_11.1: ref Class = deref %p.ref -// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc40_14: = bound_method %.loc40_11.1, %F.ref // CHECK:STDOUT: %.loc40_11.2: Class = bind_value %.loc40_11.1 -// CHECK:STDOUT: %.loc40_16: init i32 = call %.loc40_14(%.loc40_11.2) -// CHECK:STDOUT: %.loc40_18.1: i32 = value_of_initializer %.loc40_16 -// CHECK:STDOUT: %.loc40_18.2: i32 = converted %.loc40_16, %.loc40_18.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc40_14(%.loc40_11.2) +// CHECK:STDOUT: %.loc40_18.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc40_18.2: i32 = converted %F.call, %.loc40_18.1 // CHECK:STDOUT: return %.loc40_18.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -244,12 +267,12 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p // CHECK:STDOUT: %.loc44_11.1: ref Class = deref %p.ref -// CHECK:STDOUT: %G.ref: = name_ref G, @Class.%G [template = @Class.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc44_14: = bound_method %.loc44_11.1, %G.ref // CHECK:STDOUT: %.loc44_11.2: Class* = addr_of %.loc44_11.1 -// CHECK:STDOUT: %.loc44_16: init i32 = call %.loc44_14(%.loc44_11.2) -// CHECK:STDOUT: %.loc44_18.1: i32 = value_of_initializer %.loc44_16 -// CHECK:STDOUT: %.loc44_18.2: i32 = converted %.loc44_16, %.loc44_18.1 +// CHECK:STDOUT: %G.call: init i32 = call %.loc44_14(%.loc44_11.2) +// CHECK:STDOUT: %.loc44_18.1: i32 = value_of_initializer %G.call +// CHECK:STDOUT: %.loc44_18.2: i32 = converted %G.call, %.loc44_18.1 // CHECK:STDOUT: return %.loc44_18.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -257,31 +280,31 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallFOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Make.ref: = name_ref Make, file.%Make [template = file.%Make] +// CHECK:STDOUT: %Make.ref: Make = name_ref Make, file.%Make.decl [template = constants.%struct.10] // CHECK:STDOUT: %.loc50_14.1: ref Class = temporary_storage // CHECK:STDOUT: %Make.call: init Class = call %Make.ref() to %.loc50_14.1 // CHECK:STDOUT: %.loc50_14.2: ref Class = temporary %.loc50_14.1, %Make.call -// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc50_16: = bound_method %.loc50_14.2, %F.ref // CHECK:STDOUT: %.loc50_14.3: Class = bind_value %.loc50_14.2 -// CHECK:STDOUT: %.loc50_18: init i32 = call %.loc50_16(%.loc50_14.3) -// CHECK:STDOUT: %.loc50_20.1: i32 = value_of_initializer %.loc50_18 -// CHECK:STDOUT: %.loc50_20.2: i32 = converted %.loc50_18, %.loc50_20.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc50_16(%.loc50_14.3) +// CHECK:STDOUT: %.loc50_20.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc50_20.2: i32 = converted %F.call, %.loc50_20.1 // CHECK:STDOUT: return %.loc50_20.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Make.ref: = name_ref Make, file.%Make [template = file.%Make] +// CHECK:STDOUT: %Make.ref: Make = name_ref Make, file.%Make.decl [template = constants.%struct.10] // CHECK:STDOUT: %.loc54_14.1: ref Class = temporary_storage // CHECK:STDOUT: %Make.call: init Class = call %Make.ref() to %.loc54_14.1 // CHECK:STDOUT: %.loc54_14.2: ref Class = temporary %.loc54_14.1, %Make.call -// CHECK:STDOUT: %G.ref: = name_ref G, @Class.%G [template = @Class.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc54_16: = bound_method %.loc54_14.2, %G.ref // CHECK:STDOUT: %.loc54_14.3: Class* = addr_of %.loc54_14.2 -// CHECK:STDOUT: %.loc54_18: init i32 = call %.loc54_16(%.loc54_14.3) -// CHECK:STDOUT: %.loc54_20.1: i32 = value_of_initializer %.loc54_18 -// CHECK:STDOUT: %.loc54_20.2: i32 = converted %.loc54_18, %.loc54_20.1 +// CHECK:STDOUT: %G.call: init i32 = call %.loc54_16(%.loc54_14.3) +// CHECK:STDOUT: %.loc54_20.1: i32 = value_of_initializer %G.call +// CHECK:STDOUT: %.loc54_20.2: i32 = converted %G.call, %.loc54_20.1 // CHECK:STDOUT: return %.loc54_20.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/nested.carbon b/toolchain/check/testdata/class/nested.carbon index 57380e69b968..9430d5164bc7 100644 --- a/toolchain/check/testdata/class/nested.carbon +++ b/toolchain/check/testdata/class/nested.carbon @@ -49,54 +49,63 @@ fn F(a: Outer*) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Outer: type = class_type @Outer [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] // CHECK:STDOUT: %Inner: type = class_type @Inner [template] -// CHECK:STDOUT: %.1: type = ptr_type Inner [template] -// CHECK:STDOUT: %.2: type = unbound_element_type Inner, Inner* [template] -// CHECK:STDOUT: %.3: type = ptr_type Outer [template] -// CHECK:STDOUT: %.4: type = unbound_element_type Inner, Outer* [template] -// CHECK:STDOUT: %.5: type = struct_type {.pi: Inner*, .po: Outer*, .qi: Inner*} [template] -// CHECK:STDOUT: %.6: type = unbound_element_type Outer, Outer* [template] -// CHECK:STDOUT: %.7: type = unbound_element_type Outer, Inner* [template] -// CHECK:STDOUT: %.8: type = struct_type {.po: Outer*, .qo: Outer*, .pi: Inner*} [template] -// CHECK:STDOUT: %.9: type = ptr_type {.po: Outer*, .qo: Outer*, .pi: Inner*} [template] -// CHECK:STDOUT: %.10: type = ptr_type {.pi: Inner*, .po: Outer*, .qi: Inner*} [template] +// CHECK:STDOUT: %.2: type = ptr_type Inner [template] +// CHECK:STDOUT: %.3: type = unbound_element_type Inner, Inner* [template] +// CHECK:STDOUT: %.4: type = ptr_type Outer [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Inner, Outer* [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.6: type = struct_type {.pi: Inner*, .po: Outer*, .qi: Inner*} [template] +// CHECK:STDOUT: %H: type = fn_type @H [template] +// CHECK:STDOUT: %struct.3: H = struct_value () [template] +// CHECK:STDOUT: %.7: type = unbound_element_type Outer, Outer* [template] +// CHECK:STDOUT: %.8: type = unbound_element_type Outer, Inner* [template] +// CHECK:STDOUT: %.9: type = struct_type {.po: Outer*, .qo: Outer*, .pi: Inner*} [template] +// CHECK:STDOUT: %.10: type = ptr_type {.po: Outer*, .qo: Outer*, .pi: Inner*} [template] +// CHECK:STDOUT: %.11: type = ptr_type {.pi: Inner*, .po: Outer*, .qi: Inner*} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Outer = %Outer.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Outer.decl: type = class_decl @Outer [template = constants.%Outer] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.4] { // CHECK:STDOUT: %Outer.ref: type = name_ref Outer, %Outer.decl [template = constants.%Outer] -// CHECK:STDOUT: %.loc37: type = ptr_type Outer [template = constants.%.3] +// CHECK:STDOUT: %.loc37: type = ptr_type Outer [template = constants.%.4] // CHECK:STDOUT: %a.loc37_6.1: Outer* = param a // CHECK:STDOUT: @F.2.%a: Outer* = bind_name a, %a.loc37_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Outer { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} // CHECK:STDOUT: %Inner.decl: type = class_decl @Inner [template = constants.%Inner] {} -// CHECK:STDOUT: %H: = fn_decl @H [template] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] {} // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Outer [template = constants.%Outer] -// CHECK:STDOUT: %.loc32_15: type = ptr_type Outer [template = constants.%.3] +// CHECK:STDOUT: %.loc32_15: type = ptr_type Outer [template = constants.%.4] // CHECK:STDOUT: %.loc32_9: = field_decl po, element0 [template] // CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer.decl [template = constants.%Outer] -// CHECK:STDOUT: %.loc33_16: type = ptr_type Outer [template = constants.%.3] +// CHECK:STDOUT: %.loc33_16: type = ptr_type Outer [template = constants.%.4] // CHECK:STDOUT: %.loc33_9: = field_decl qo, element1 [template] // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, %Inner.decl [template = constants.%Inner] -// CHECK:STDOUT: %.loc34_16: type = ptr_type Inner [template = constants.%.1] +// CHECK:STDOUT: %.loc34_16: type = ptr_type Inner [template = constants.%.2] // CHECK:STDOUT: %.loc34_9: = field_decl pi, element2 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Outer -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .Inner = %Inner.decl -// CHECK:STDOUT: .H = %H +// CHECK:STDOUT: .H = %H.decl // CHECK:STDOUT: .po = %.loc32_9 // CHECK:STDOUT: .qo = %.loc33_9 // CHECK:STDOUT: .pi = %.loc34_9 @@ -104,22 +113,22 @@ fn F(a: Outer*) { // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Inner [template = constants.%Inner] -// CHECK:STDOUT: %.loc15_17: type = ptr_type Inner [template = constants.%.1] +// CHECK:STDOUT: %.loc15_17: type = ptr_type Inner [template = constants.%.2] // CHECK:STDOUT: %.loc15_11: = field_decl pi, element0 [template] // CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer.decl [template = constants.%Outer] -// CHECK:STDOUT: %.loc16_18: type = ptr_type Outer [template = constants.%.3] +// CHECK:STDOUT: %.loc16_18: type = ptr_type Outer [template = constants.%.4] // CHECK:STDOUT: %.loc16_11: = field_decl po, element1 [template] // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [template = constants.%Inner] -// CHECK:STDOUT: %.loc17_18: type = ptr_type Inner [template = constants.%.1] +// CHECK:STDOUT: %.loc17_18: type = ptr_type Inner [template = constants.%.2] // CHECK:STDOUT: %.loc17_11: = field_decl qi, element2 [template] -// CHECK:STDOUT: %G: = fn_decl @G [template] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Inner // CHECK:STDOUT: .pi = %.loc15_11 // CHECK:STDOUT: .po = %.loc16_11 // CHECK:STDOUT: .qi = %.loc17_11 -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1() { @@ -159,7 +168,7 @@ fn F(a: Outer*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer.decl [template = constants.%Outer] // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [template = constants.%Inner] -// CHECK:STDOUT: %.loc38_21: type = ptr_type Inner [template = constants.%.1] +// CHECK:STDOUT: %.loc38_21: type = ptr_type Inner [template = constants.%.2] // CHECK:STDOUT: %a.ref.loc38: Outer* = name_ref a, %a // CHECK:STDOUT: %.loc38_26: ref Outer = deref %a.ref.loc38 // CHECK:STDOUT: %pi.ref.loc38: = name_ref pi, @Outer.%.loc34_9 [template = @Outer.%.loc34_9] diff --git a/toolchain/check/testdata/class/nested_name.carbon b/toolchain/check/testdata/class/nested_name.carbon index 7529dcb18580..a059ea570ac6 100644 --- a/toolchain/check/testdata/class/nested_name.carbon +++ b/toolchain/check/testdata/class/nested_name.carbon @@ -26,8 +26,12 @@ fn G(o: Outer) { // CHECK:STDOUT: %.1: type = unbound_element_type Inner, i32 [template] // CHECK:STDOUT: %.2: type = struct_type {.n: i32} [template] // CHECK:STDOUT: %.3: type = struct_type {} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.n: i32} [template] -// CHECK:STDOUT: %.5: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.5: type = ptr_type {.n: i32} [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: %.6: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -35,19 +39,19 @@ fn G(o: Outer) { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Outer = %Outer.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Outer.decl: type = class_decl @Outer [template = constants.%Outer] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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: @F.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // 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 diff --git a/toolchain/check/testdata/class/raw_self.carbon b/toolchain/check/testdata/class/raw_self.carbon index 2c2e78519dd2..f4861483558b 100644 --- a/toolchain/check/testdata/class/raw_self.carbon +++ b/toolchain/check/testdata/class/raw_self.carbon @@ -23,12 +23,17 @@ fn Class.G[self: Self](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = ptr_type Class [template] -// CHECK:STDOUT: %.2: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.4: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.5: type = struct_type {.n: i32} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.n: i32} [template] -// CHECK:STDOUT: %.7: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.4: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.6: type = struct_type {.n: i32} [template] +// CHECK:STDOUT: %.7: type = ptr_type {.n: i32} [template] +// CHECK:STDOUT: %.8: type = ptr_type (i32, i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -38,7 +43,7 @@ fn Class.G[self: Self](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc13: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %.loc13_27: type = ptr_type Class [template = constants.%.1] // CHECK:STDOUT: %self.loc13_17.1: Class* = param self @@ -47,20 +52,20 @@ fn Class.G[self: Self](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: %self.loc13_30.1: i32 = param r#self // CHECK:STDOUT: @F.%self.loc13_30: i32 = bind_name r#self, %self.loc13_30.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc17: type = name_ref Self, constants.%Class [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_24.1: i32 = param r#self // CHECK:STDOUT: @G.%self.loc17_24: i32 = bind_name r#self, %self.loc17_24.1 // CHECK:STDOUT: %.loc17_49.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc17_49.2: type = converted %.loc17_49.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc17_49.2: type = converted %.loc17_49.1, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: @G.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc8: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %.loc8_23: type = ptr_type Class [template = constants.%.1] // CHECK:STDOUT: %self.loc8_13.1: Class* = param self @@ -69,22 +74,22 @@ fn Class.G[self: Self](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: %self.loc8_26.1: i32 = param r#self // CHECK:STDOUT: %self.loc8_26.2: i32 = bind_name r#self, %self.loc8_26.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [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_20.1: i32 = param r#self // CHECK:STDOUT: %self.loc9_20.2: i32 = bind_name r#self, %self.loc9_20.1 // CHECK:STDOUT: %.loc9_45.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc9_45.2: type = converted %.loc9_45.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_45.2: type = converted %.loc9_45.1, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: %return.var: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: %.loc10: = field_decl n, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: .n = %.loc10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/raw_self_type.carbon b/toolchain/check/testdata/class/raw_self_type.carbon index f354f6ea9403..cbe938fd84bb 100644 --- a/toolchain/check/testdata/class/raw_self_type.carbon +++ b/toolchain/check/testdata/class/raw_self_type.carbon @@ -23,12 +23,16 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = ptr_type Class [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %.3: type = ptr_type Class [template] // CHECK:STDOUT: %.4: type = ptr_type {} [template] // CHECK:STDOUT: %MemberNamedSelf: type = class_type @MemberNamedSelf [template] // CHECK:STDOUT: %Self: type = class_type @Self [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -40,7 +44,7 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %MemberNamedSelf.decl: type = class_decl @MemberNamedSelf [template = constants.%MemberNamedSelf] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc20_25: type = name_ref Self, constants.%MemberNamedSelf [template = constants.%MemberNamedSelf] // CHECK:STDOUT: %x.loc20_22.1: MemberNamedSelf = param x // CHECK:STDOUT: @F.2.%x: MemberNamedSelf = bind_name x, %x.loc20_22.1 @@ -51,16 +55,16 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @MemberNamedSelf { // CHECK:STDOUT: %Self.decl: type = class_decl @Self [template = constants.%Self] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc17_11: type = name_ref Self, constants.%MemberNamedSelf [template = constants.%MemberNamedSelf] // CHECK:STDOUT: %x.loc17_8.1: MemberNamedSelf = param x // CHECK:STDOUT: %x.loc17_8.2: MemberNamedSelf = bind_name x, %x.loc17_8.1 @@ -72,7 +76,7 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%MemberNamedSelf // CHECK:STDOUT: .r#Self = %Self.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Self { @@ -83,11 +87,11 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: fn @F.1() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc9: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc9: type = ptr_type Class [template = constants.%.3] // CHECK:STDOUT: %Self.var: ref Class* = var r#Self // CHECK:STDOUT: %Self: ref Class* = bind_name r#Self, %Self.var // CHECK:STDOUT: %Self.ref.loc10_12: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc10_16: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc10_16: type = ptr_type Class [template = constants.%.3] // CHECK:STDOUT: %p.var: ref Class* = var p // CHECK:STDOUT: %p: ref Class* = bind_name p, %p.var // CHECK:STDOUT: %Self.ref.loc10_20: ref Class* = name_ref r#Self, %Self diff --git a/toolchain/check/testdata/class/redeclaration.carbon b/toolchain/check/testdata/class/redeclaration.carbon index 3a53e385f7b2..085e5219bf8d 100644 --- a/toolchain/check/testdata/class/redeclaration.carbon +++ b/toolchain/check/testdata/class/redeclaration.carbon @@ -16,8 +16,10 @@ fn Class.F[self: Self](b: bool) {} // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -29,7 +31,7 @@ fn Class.F[self: Self](b: bool) {} // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl.loc7: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %Class.decl.loc9: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc13_12.1: Class = param self // CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc13_12.1 @@ -39,7 +41,7 @@ fn Class.F[self: Self](b: bool) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc10_8.1: Class = param self // CHECK:STDOUT: %self.loc10_8.2: Class = bind_name self, %self.loc10_8.1 @@ -49,7 +51,7 @@ fn Class.F[self: Self](b: bool) {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F[%self: Class](%b: bool) { diff --git a/toolchain/check/testdata/class/reenter_scope.carbon b/toolchain/check/testdata/class/reenter_scope.carbon index 4cbf93e03f7b..383adea0544b 100644 --- a/toolchain/check/testdata/class/reenter_scope.carbon +++ b/toolchain/check/testdata/class/reenter_scope.carbon @@ -18,7 +18,12 @@ fn Class.F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -28,31 +33,31 @@ fn Class.F() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %return.var.loc8: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %return.var.loc9: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %G.ref.loc13: = name_ref G, @Class.%G [template = @Class.%G] +// CHECK:STDOUT: %G.ref.loc13: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %G.call.loc13: init i32 = call %G.ref.loc13() -// CHECK:STDOUT: %G.ref.loc14: = name_ref G, @Class.%G [template = @Class.%G] +// CHECK:STDOUT: %G.ref.loc14: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %G.call.loc14: init i32 = call %G.ref.loc14() // CHECK:STDOUT: %.loc14_13.1: i32 = value_of_initializer %G.call.loc14 // CHECK:STDOUT: %.loc14_13.2: i32 = converted %G.call.loc14, %.loc14_13.1 diff --git a/toolchain/check/testdata/class/reorder.carbon b/toolchain/check/testdata/class/reorder.carbon index 6a3d42b09c8d..3cf34149f0eb 100644 --- a/toolchain/check/testdata/class/reorder.carbon +++ b/toolchain/check/testdata/class/reorder.carbon @@ -18,8 +18,13 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -32,23 +37,23 @@ class Class { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { // CHECK:STDOUT: %return.var.loc8: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %return.var.loc12: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() // CHECK:STDOUT: %.loc9_21.1: i32 = value_of_initializer %F.call // CHECK:STDOUT: %.loc9_21.2: i32 = converted %F.call, %.loc9_21.1 @@ -57,7 +62,7 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: return %.loc13 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/reorder_qualified.carbon b/toolchain/check/testdata/class/reorder_qualified.carbon index 6ed7565571d2..53609ccad923 100644 --- a/toolchain/check/testdata/class/reorder_qualified.carbon +++ b/toolchain/check/testdata/class/reorder_qualified.carbon @@ -48,28 +48,38 @@ class A { // CHECK:STDOUT: %A: type = class_type @A [template] // CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.1: type = unbound_element_type B, i32 [template] -// CHECK:STDOUT: %.2: type = struct_type {.b: i32} [template] +// CHECK:STDOUT: %BF: type = fn_type @BF [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: BF = struct_value () [template] +// CHECK:STDOUT: %.2: type = unbound_element_type B, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.b: i32} [template] // CHECK:STDOUT: %D: type = class_type @D [template] -// CHECK:STDOUT: %.3: type = unbound_element_type D, i32 [template] -// CHECK:STDOUT: %.4: type = struct_type {.d: i32} [template] -// CHECK:STDOUT: %.5: type = unbound_element_type C, i32 [template] -// CHECK:STDOUT: %.6: type = struct_type {.c: i32} [template] -// CHECK:STDOUT: %.7: type = unbound_element_type A, i32 [template] -// CHECK:STDOUT: %.8: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.9: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.10: i32 = int_literal 1 [template] -// CHECK:STDOUT: %struct.1: A = struct_value (%.10) [template] -// CHECK:STDOUT: %.11: type = ptr_type {.b: i32} [template] -// CHECK:STDOUT: %.12: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct.2: B = struct_value (%.12) [template] -// CHECK:STDOUT: %.13: type = ptr_type {.c: i32} [template] -// CHECK:STDOUT: %.14: i32 = int_literal 3 [template] -// CHECK:STDOUT: %struct.3: C = struct_value (%.14) [template] -// CHECK:STDOUT: %.15: type = ptr_type {.d: i32} [template] -// CHECK:STDOUT: %.16: i32 = int_literal 4 [template] -// CHECK:STDOUT: %struct.4: D = struct_value (%.16) [template] -// CHECK:STDOUT: %.17: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %DF: type = fn_type @DF [template] +// CHECK:STDOUT: %struct.3: DF = struct_value () [template] +// CHECK:STDOUT: %.4: type = unbound_element_type D, i32 [template] +// CHECK:STDOUT: %.5: type = struct_type {.d: i32} [template] +// CHECK:STDOUT: %CF: type = fn_type @CF [template] +// CHECK:STDOUT: %struct.4: CF = struct_value () [template] +// CHECK:STDOUT: %.6: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.7: type = struct_type {.c: i32} [template] +// CHECK:STDOUT: %AF: type = fn_type @AF [template] +// CHECK:STDOUT: %struct.5: AF = struct_value () [template] +// CHECK:STDOUT: %.8: type = unbound_element_type A, i32 [template] +// CHECK:STDOUT: %.9: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.10: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.11: i32 = int_literal 1 [template] +// CHECK:STDOUT: %struct.6: A = struct_value (%.11) [template] +// CHECK:STDOUT: %.12: type = ptr_type {.b: i32} [template] +// CHECK:STDOUT: %.13: i32 = int_literal 2 [template] +// CHECK:STDOUT: %struct.7: B = struct_value (%.13) [template] +// CHECK:STDOUT: %.14: type = ptr_type {.c: i32} [template] +// CHECK:STDOUT: %.15: i32 = int_literal 3 [template] +// CHECK:STDOUT: %struct.8: C = struct_value (%.15) [template] +// CHECK:STDOUT: %.16: type = ptr_type {.d: i32} [template] +// CHECK:STDOUT: %.17: i32 = int_literal 4 [template] +// CHECK:STDOUT: %struct.9: D = struct_value (%.17) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -84,50 +94,50 @@ class A { // CHECK:STDOUT: class @A { // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %AF: = fn_decl @AF [template] {} +// CHECK:STDOUT: %AF.decl: AF = fn_decl @AF [template = constants.%struct.5] {} // CHECK:STDOUT: %.loc42: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A // CHECK:STDOUT: .B = %B.decl -// CHECK:STDOUT: .AF = %AF +// CHECK:STDOUT: .AF = %AF.decl // CHECK:STDOUT: .a = %.loc42 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %BF: = fn_decl @BF [template] {} +// CHECK:STDOUT: %BF.decl: BF = fn_decl @BF [template = constants.%struct.1] {} // CHECK:STDOUT: %.loc12: = field_decl b, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .BF = %BF +// CHECK:STDOUT: .BF = %BF.decl // CHECK:STDOUT: .b = %.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} -// CHECK:STDOUT: %DF: = fn_decl @DF [template] {} -// CHECK:STDOUT: %CF: = fn_decl @CF [template] {} +// CHECK:STDOUT: %DF.decl: DF = fn_decl @DF [template = constants.%struct.3] {} +// CHECK:STDOUT: %CF.decl: CF = fn_decl @CF [template = constants.%struct.4] {} // CHECK:STDOUT: %.loc38: = field_decl c, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: .D = %D.decl -// CHECK:STDOUT: .CF = %CF +// CHECK:STDOUT: .CF = %CF.decl // CHECK:STDOUT: .c = %.loc38 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { -// CHECK:STDOUT: %F: = fn_decl @F [template] {} -// CHECK:STDOUT: %DF: = fn_decl @DF [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} +// CHECK:STDOUT: %DF.decl: DF = fn_decl @DF [template = constants.%struct.3] {} // CHECK:STDOUT: %.loc20: = field_decl d, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%D -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .DF = %DF +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .DF = %DF.decl // CHECK:STDOUT: .d = %.loc20 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -140,50 +150,50 @@ class A { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%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: %.loc25_24: i32 = int_literal 1 [template = constants.%.10] +// CHECK:STDOUT: %.loc25_24: i32 = int_literal 1 [template = constants.%.11] // CHECK:STDOUT: %.loc25_25.1: {.a: i32} = struct_literal (%.loc25_24) // CHECK:STDOUT: %.loc25_25.2: ref i32 = class_element_access %a.var, element0 -// CHECK:STDOUT: %.loc25_25.3: init i32 = initialize_from %.loc25_24 to %.loc25_25.2 [template = constants.%.10] -// CHECK:STDOUT: %.loc25_25.4: init A = class_init (%.loc25_25.3), %a.var [template = constants.%struct.1] -// CHECK:STDOUT: %.loc25_26: init A = converted %.loc25_25.1, %.loc25_25.4 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc25_25.3: init i32 = initialize_from %.loc25_24 to %.loc25_25.2 [template = constants.%.11] +// CHECK:STDOUT: %.loc25_25.4: init A = class_init (%.loc25_25.3), %a.var [template = constants.%struct.6] +// CHECK:STDOUT: %.loc25_26: init A = converted %.loc25_25.1, %.loc25_25.4 [template = constants.%struct.6] // CHECK:STDOUT: assign %a.var, %.loc25_26 // CHECK:STDOUT: %B.ref: type = name_ref B, @A.%B.decl [template = constants.%B] // CHECK:STDOUT: %b.var: ref B = var b // CHECK:STDOUT: %b: ref B = bind_name b, %b.var -// CHECK:STDOUT: %.loc26_24: i32 = int_literal 2 [template = constants.%.12] +// CHECK:STDOUT: %.loc26_24: i32 = int_literal 2 [template = constants.%.13] // CHECK:STDOUT: %.loc26_25.1: {.b: i32} = struct_literal (%.loc26_24) // CHECK:STDOUT: %.loc26_25.2: ref i32 = class_element_access %b.var, element0 -// CHECK:STDOUT: %.loc26_25.3: init i32 = initialize_from %.loc26_24 to %.loc26_25.2 [template = constants.%.12] -// CHECK:STDOUT: %.loc26_25.4: init B = class_init (%.loc26_25.3), %b.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc26_26: init B = converted %.loc26_25.1, %.loc26_25.4 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc26_25.3: init i32 = initialize_from %.loc26_24 to %.loc26_25.2 [template = constants.%.13] +// CHECK:STDOUT: %.loc26_25.4: init B = class_init (%.loc26_25.3), %b.var [template = constants.%struct.7] +// CHECK:STDOUT: %.loc26_26: init B = converted %.loc26_25.1, %.loc26_25.4 [template = constants.%struct.7] // CHECK:STDOUT: assign %b.var, %.loc26_26 // CHECK:STDOUT: %C.ref: type = name_ref C, @B.%C.decl [template = constants.%C] // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var -// CHECK:STDOUT: %.loc27_24: i32 = int_literal 3 [template = constants.%.14] +// CHECK:STDOUT: %.loc27_24: i32 = int_literal 3 [template = constants.%.15] // CHECK:STDOUT: %.loc27_25.1: {.c: i32} = struct_literal (%.loc27_24) // CHECK:STDOUT: %.loc27_25.2: ref i32 = class_element_access %c.var, element0 -// CHECK:STDOUT: %.loc27_25.3: init i32 = initialize_from %.loc27_24 to %.loc27_25.2 [template = constants.%.14] -// CHECK:STDOUT: %.loc27_25.4: init C = class_init (%.loc27_25.3), %c.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc27_26: init C = converted %.loc27_25.1, %.loc27_25.4 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc27_25.3: init i32 = initialize_from %.loc27_24 to %.loc27_25.2 [template = constants.%.15] +// CHECK:STDOUT: %.loc27_25.4: init C = class_init (%.loc27_25.3), %c.var [template = constants.%struct.8] +// CHECK:STDOUT: %.loc27_26: init C = converted %.loc27_25.1, %.loc27_25.4 [template = constants.%struct.8] // CHECK:STDOUT: assign %c.var, %.loc27_26 // CHECK:STDOUT: %D.ref: type = name_ref D, @C.%D.decl [template = constants.%D] // CHECK:STDOUT: %d.var: ref D = var d // CHECK:STDOUT: %d: ref D = bind_name d, %d.var -// CHECK:STDOUT: %.loc28_24: i32 = int_literal 4 [template = constants.%.16] +// CHECK:STDOUT: %.loc28_24: i32 = int_literal 4 [template = constants.%.17] // CHECK:STDOUT: %.loc28_25.1: {.d: i32} = struct_literal (%.loc28_24) // CHECK:STDOUT: %.loc28_25.2: ref i32 = class_element_access %d.var, element0 -// CHECK:STDOUT: %.loc28_25.3: init i32 = initialize_from %.loc28_24 to %.loc28_25.2 [template = constants.%.16] -// CHECK:STDOUT: %.loc28_25.4: init D = class_init (%.loc28_25.3), %d.var [template = constants.%struct.4] -// CHECK:STDOUT: %.loc28_26: init D = converted %.loc28_25.1, %.loc28_25.4 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc28_25.3: init i32 = initialize_from %.loc28_24 to %.loc28_25.2 [template = constants.%.17] +// CHECK:STDOUT: %.loc28_25.4: init D = class_init (%.loc28_25.3), %d.var [template = constants.%struct.9] +// CHECK:STDOUT: %.loc28_26: init D = converted %.loc28_25.1, %.loc28_25.4 [template = constants.%struct.9] // CHECK:STDOUT: assign %d.var, %.loc28_26 -// CHECK:STDOUT: %AF.ref: = name_ref AF, @A.%AF [template = @A.%AF] +// CHECK:STDOUT: %AF.ref: AF = name_ref AF, @A.%AF.decl [template = constants.%struct.5] // CHECK:STDOUT: %AF.call: init () = call %AF.ref() -// CHECK:STDOUT: %BF.ref: = name_ref BF, @B.%BF [template = @B.%BF] +// CHECK:STDOUT: %BF.ref: BF = name_ref BF, @B.%BF.decl [template = constants.%struct.1] // CHECK:STDOUT: %BF.call: init () = call %BF.ref() -// CHECK:STDOUT: %CF.ref: = name_ref CF, @C.%CF [template = @C.%CF] +// CHECK:STDOUT: %CF.ref: CF = name_ref CF, @C.%CF.decl [template = constants.%struct.4] // CHECK:STDOUT: %CF.call: init () = call %CF.ref() -// CHECK:STDOUT: %DF.ref: = name_ref DF, @D.%DF [template = @D.%DF] +// CHECK:STDOUT: %DF.ref: DF = name_ref DF, @D.%DF.decl [template = constants.%struct.3] // CHECK:STDOUT: %DF.call: init () = call %DF.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/scope.carbon b/toolchain/check/testdata/class/scope.carbon index b6a697613c1b..0feccff7eaee 100644 --- a/toolchain/check/testdata/class/scope.carbon +++ b/toolchain/check/testdata/class/scope.carbon @@ -27,49 +27,58 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %struct.4: Run = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { // CHECK:STDOUT: @F.2.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.4] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { // CHECK:STDOUT: %return.var.loc8: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %return.var.loc12: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: return %.loc9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() // CHECK:STDOUT: %.loc13_15.1: i32 = value_of_initializer %F.call // CHECK:STDOUT: %.loc13_15.2: i32 = converted %F.call, %.loc13_15.1 @@ -78,7 +87,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc18: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: return %.loc18 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -86,13 +95,13 @@ fn Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %F.ref.loc22: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref.loc22: F = name_ref F, file.%F.decl [template = constants.%struct.3] // CHECK:STDOUT: %F.call.loc22: init i32 = call %F.ref.loc22() // CHECK:STDOUT: assign %a.var, %F.call.loc22 // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %F.ref.loc23: = name_ref F, @Class.%F [template = @Class.%F] +// CHECK:STDOUT: %F.ref.loc23: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call.loc23: init i32 = call %F.ref.loc23() // CHECK:STDOUT: assign %b.var, %F.call.loc23 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/class/self.carbon b/toolchain/check/testdata/class/self.carbon index e4d908a9a577..2b485c8c3ce9 100644 --- a/toolchain/check/testdata/class/self.carbon +++ b/toolchain/check/testdata/class/self.carbon @@ -23,10 +23,15 @@ fn Class.G[addr self: Self*]() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = ptr_type Class [template] -// CHECK:STDOUT: %.2: type = unbound_element_type Class, i32 [template] -// CHECK:STDOUT: %.3: type = struct_type {.n: i32} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.n: i32} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = ptr_type Class [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.3: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.4: type = struct_type {.n: i32} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.n: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -36,15 +41,15 @@ fn Class.G[addr self: Self*]() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc14: type = name_ref Self, constants.%Class [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: @F.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc18: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc18_27: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %.loc18_27: type = ptr_type Class [template = constants.%.2] // 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 @@ -53,15 +58,15 @@ fn Class.G[addr self: Self*]() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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.loc8: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc9_23: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %.loc9_23: type = ptr_type Class [template = constants.%.2] // 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 @@ -71,8 +76,8 @@ fn Class.G[addr self: Self*]() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: .n = %.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/self_conversion.carbon b/toolchain/check/testdata/class/self_conversion.carbon index 92cad94b352b..25210fc05509 100644 --- a/toolchain/check/testdata/class/self_conversion.carbon +++ b/toolchain/check/testdata/class/self_conversion.carbon @@ -37,13 +37,19 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: %Derived: type = class_type @Derived [template] // CHECK:STDOUT: %.3: type = ptr_type {.a: i32} [template] // CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] -// CHECK:STDOUT: %.5: type = ptr_type Base [template] -// CHECK:STDOUT: %.6: type = struct_type {.base: Base} [template] -// CHECK:STDOUT: %.7: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.8: type = ptr_type Derived [template] -// CHECK:STDOUT: %.9: type = struct_type {.base: {.a: i32}*} [template] -// CHECK:STDOUT: %.10: type = ptr_type {.base: Base} [template] -// CHECK:STDOUT: %.11: type = tuple_type () [template] +// CHECK:STDOUT: %SelfBase: type = fn_type @SelfBase [template] +// CHECK:STDOUT: %.5: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: SelfBase = struct_value () [template] +// CHECK:STDOUT: %.6: type = ptr_type Base [template] +// CHECK:STDOUT: %AddrSelfBase: type = fn_type @AddrSelfBase [template] +// CHECK:STDOUT: %struct.2: AddrSelfBase = struct_value () [template] +// CHECK:STDOUT: %.7: type = struct_type {.base: Base} [template] +// CHECK:STDOUT: %.8: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.9: type = ptr_type Derived [template] +// CHECK:STDOUT: %Call: type = fn_type @Call [template] +// CHECK:STDOUT: %struct.3: Call = struct_value () [template] +// CHECK:STDOUT: %.10: type = struct_type {.base: {.a: i32}*} [template] +// CHECK:STDOUT: %.11: type = ptr_type {.base: Base} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -51,27 +57,27 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Base = %Base.decl // CHECK:STDOUT: .Derived = %Derived.decl -// CHECK:STDOUT: .Call = %Call +// CHECK:STDOUT: .Call = %Call.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} -// CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase [template] { +// CHECK:STDOUT: %SelfBase.decl: SelfBase = fn_decl @SelfBase [template = constants.%struct.1] { // 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: @SelfBase.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase [template] { +// CHECK:STDOUT: %AddrSelfBase.decl: AddrSelfBase = fn_decl @AddrSelfBase [template = constants.%struct.2] { // 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: %.loc22_40: type = ptr_type Base [template = constants.%.6] // 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: } -// CHECK:STDOUT: %Call: = fn_decl @Call [template] { +// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.3] { // 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: %.loc26: type = ptr_type Derived [template = constants.%.9] // CHECK:STDOUT: %p.loc26_9.1: Derived* = param p // CHECK:STDOUT: @Call.%p: Derived* = bind_name p, %p.loc26_9.1 // CHECK:STDOUT: @Call.%return: ref i32 = var @@ -89,15 +95,15 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: class @Derived { // 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: %SelfBase.decl: SelfBase = fn_decl @SelfBase [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase [template] { +// CHECK:STDOUT: %AddrSelfBase.decl: AddrSelfBase = fn_decl @AddrSelfBase [template = constants.%struct.2] { // 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: %.loc15_34: type = ptr_type Base [template = constants.%.6] // 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 @@ -106,8 +112,8 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived // CHECK:STDOUT: .base = %.loc12 -// CHECK:STDOUT: .SelfBase = %SelfBase -// CHECK:STDOUT: .AddrSelfBase = %AddrSelfBase +// CHECK:STDOUT: .SelfBase = %SelfBase.decl +// CHECK:STDOUT: .AddrSelfBase = %AddrSelfBase.decl // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -126,7 +132,7 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: %.loc23_4: ref Base = deref %self.ref // CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc8 [template = @Base.%.loc8] // CHECK:STDOUT: %.loc23_10: ref i32 = class_element_access %.loc23_4, element0 -// CHECK:STDOUT: %.loc23_15: i32 = int_literal 1 [template = constants.%.7] +// CHECK:STDOUT: %.loc23_15: i32 = int_literal 1 [template = constants.%.8] // CHECK:STDOUT: assign %.loc23_10, %.loc23_15 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -135,24 +141,24 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref.loc27: Derived* = name_ref p, %p // CHECK:STDOUT: %.loc27_4.1: ref Derived = deref %p.ref.loc27 -// CHECK:STDOUT: %AddrSelfBase.ref: = name_ref AddrSelfBase, @Derived.%AddrSelfBase [template = @Derived.%AddrSelfBase] +// CHECK:STDOUT: %AddrSelfBase.ref: AddrSelfBase = name_ref AddrSelfBase, @Derived.%AddrSelfBase.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc27_7: = bound_method %.loc27_4.1, %AddrSelfBase.ref // CHECK:STDOUT: %.loc27_4.2: Derived* = addr_of %.loc27_4.1 // CHECK:STDOUT: %.loc27_20.1: ref Derived = deref %.loc27_4.2 // CHECK:STDOUT: %.loc27_20.2: ref Base = class_element_access %.loc27_20.1, element0 // CHECK:STDOUT: %.loc27_20.3: Base* = addr_of %.loc27_20.2 // CHECK:STDOUT: %.loc27_20.4: Base* = converted %.loc27_4.2, %.loc27_20.3 -// CHECK:STDOUT: %.loc27_20.5: init () = call %.loc27_7(%.loc27_20.4) +// CHECK:STDOUT: %AddrSelfBase.call: init () = call %.loc27_7(%.loc27_20.4) // CHECK:STDOUT: %p.ref.loc28: Derived* = name_ref p, %p // CHECK:STDOUT: %.loc28_11: ref Derived = deref %p.ref.loc28 -// CHECK:STDOUT: %SelfBase.ref: = name_ref SelfBase, @Derived.%SelfBase [template = @Derived.%SelfBase] +// CHECK:STDOUT: %SelfBase.ref: SelfBase = name_ref SelfBase, @Derived.%SelfBase.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc28_14: = bound_method %.loc28_11, %SelfBase.ref // CHECK:STDOUT: %.loc28_23.1: ref Base = class_element_access %.loc28_11, element0 // CHECK:STDOUT: %.loc28_23.2: ref Base = converted %.loc28_11, %.loc28_23.1 // CHECK:STDOUT: %.loc28_23.3: Base = bind_value %.loc28_23.2 -// CHECK:STDOUT: %.loc28_23.4: init i32 = call %.loc28_14(%.loc28_23.3) -// CHECK:STDOUT: %.loc28_25.1: i32 = value_of_initializer %.loc28_23.4 -// CHECK:STDOUT: %.loc28_25.2: i32 = converted %.loc28_23.4, %.loc28_25.1 +// CHECK:STDOUT: %SelfBase.call: init i32 = call %.loc28_14(%.loc28_23.3) +// CHECK:STDOUT: %.loc28_25.1: i32 = value_of_initializer %SelfBase.call +// CHECK:STDOUT: %.loc28_25.2: i32 = converted %SelfBase.call, %.loc28_25.1 // CHECK:STDOUT: return %.loc28_25.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/self_type.carbon b/toolchain/check/testdata/class/self_type.carbon index 1e821d83a984..8453a6fef961 100644 --- a/toolchain/check/testdata/class/self_type.carbon +++ b/toolchain/check/testdata/class/self_type.carbon @@ -22,10 +22,15 @@ fn Class.F[self: Self]() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = ptr_type Class [template] -// CHECK:STDOUT: %.2: type = unbound_element_type Class, Class* [template] -// CHECK:STDOUT: %.3: type = struct_type {.p: Class*} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.p: Class*} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %Make: type = fn_type @Make [template] +// CHECK:STDOUT: %struct.2: Make = struct_value () [template] +// CHECK:STDOUT: %.2: type = ptr_type Class [template] +// CHECK:STDOUT: %.3: type = unbound_element_type Class, Class* [template] +// CHECK:STDOUT: %.4: type = struct_type {.p: Class*} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.p: Class*} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -35,7 +40,7 @@ fn Class.F[self: Self]() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %self.loc17_12.1: Class = param self // CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc17_12.1 @@ -44,24 +49,24 @@ fn Class.F[self: Self]() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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.loc8: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Make: = fn_decl @Make [template] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %return.var.loc9: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %Self.ref.loc14: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc14_14: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %.loc14_14: type = ptr_type Class [template = constants.%.2] // CHECK:STDOUT: %.loc14_8: = field_decl p, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .Make = %Make +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .Make = %Make.decl // CHECK:STDOUT: .p = %.loc14_8 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -72,12 +77,12 @@ fn Class.F[self: Self]() -> i32 { // CHECK:STDOUT: %.loc18_16.1: ref Class* = class_element_access %self.ref, element0 // CHECK:STDOUT: %.loc18_16.2: Class* = bind_value %.loc18_16.1 // CHECK:STDOUT: %.loc18_11.1: ref Class = deref %.loc18_16.2 -// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc18_19: = bound_method %.loc18_11.1, %F.ref // CHECK:STDOUT: %.loc18_11.2: Class = bind_value %.loc18_11.1 -// CHECK:STDOUT: %.loc18_21: init i32 = call %.loc18_19(%.loc18_11.2) -// CHECK:STDOUT: %.loc18_23.1: i32 = value_of_initializer %.loc18_21 -// CHECK:STDOUT: %.loc18_23.2: i32 = converted %.loc18_21, %.loc18_23.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc18_19(%.loc18_11.2) +// CHECK:STDOUT: %.loc18_23.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc18_23.2: i32 = converted %F.call, %.loc18_23.1 // CHECK:STDOUT: return %.loc18_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/static_method.carbon b/toolchain/check/testdata/class/static_method.carbon index 005597032f41..d0b034c63ab6 100644 --- a/toolchain/check/testdata/class/static_method.carbon +++ b/toolchain/check/testdata/class/static_method.carbon @@ -17,8 +17,12 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %struct.2: Run = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -26,23 +30,23 @@ fn Run() -> i32 { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Class = %Class.decl -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] { +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] { // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32; @@ -53,7 +57,7 @@ fn Run() -> i32 { // CHECK:STDOUT: %c.var: ref Class = var c // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c -// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F [template = @Class.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() // CHECK:STDOUT: %.loc13_15.1: i32 = value_of_initializer %F.call // CHECK:STDOUT: %.loc13_15.2: i32 = converted %F.call, %.loc13_15.1 diff --git a/toolchain/check/testdata/const/basic.carbon b/toolchain/check/testdata/const/basic.carbon index 0980deaa44c2..2ce4165cc237 100644 --- a/toolchain/check/testdata/const/basic.carbon +++ b/toolchain/check/testdata/const/basic.carbon @@ -18,18 +18,23 @@ fn B(p: const (i32*)) -> const (i32*) { // CHECK:STDOUT: %.1: type = const_type i32 [template] // CHECK:STDOUT: %.2: type = ptr_type const i32 [template] // CHECK:STDOUT: %.3: type = ptr_type const i32* [template] -// CHECK:STDOUT: %.4: type = ptr_type i32 [template] -// CHECK:STDOUT: %.5: type = const_type i32* [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %.5: type = ptr_type i32 [template] +// CHECK:STDOUT: %.6: type = const_type i32* [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .B = %B +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { // 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] @@ -40,13 +45,13 @@ fn B(p: const (i32*)) -> const (i32*) { // CHECK:STDOUT: %.loc7_35: type = ptr_type const i32* [template = constants.%.3] // CHECK:STDOUT: @A.%return: ref const i32** = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B: = fn_decl @B [template] { -// CHECK:STDOUT: %.loc11_19: type = ptr_type i32 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_9: type = const_type i32* [template = constants.%.5] +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc11_19: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_9: type = const_type i32* [template = constants.%.6] // 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: %.loc11_36: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_26: type = const_type i32* [template = constants.%.6] // CHECK:STDOUT: @B.%return: ref const (i32*) = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/const/collapse.carbon b/toolchain/check/testdata/const/collapse.carbon index 89484288ebb7..e8dbaf531b4f 100644 --- a/toolchain/check/testdata/const/collapse.carbon +++ b/toolchain/check/testdata/const/collapse.carbon @@ -18,15 +18,18 @@ fn F(p: const i32**) -> const (const i32)** { // CHECK:STDOUT: %.1: type = const_type i32 [template] // CHECK:STDOUT: %.2: type = ptr_type const i32 [template] // CHECK:STDOUT: %.3: type = ptr_type const i32* [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // 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] diff --git a/toolchain/check/testdata/const/fail_collapse.carbon b/toolchain/check/testdata/const/fail_collapse.carbon index 02eb40d21f2e..a673fa83750b 100644 --- a/toolchain/check/testdata/const/fail_collapse.carbon +++ b/toolchain/check/testdata/const/fail_collapse.carbon @@ -23,15 +23,18 @@ fn G(p: const (const i32)**) -> i32** { // CHECK:STDOUT: %.3: type = ptr_type const i32* [template] // CHECK:STDOUT: %.4: type = ptr_type i32 [template] // CHECK:STDOUT: %.5: type = ptr_type i32* [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %struct: G = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct] { // CHECK:STDOUT: %.loc11_16: type = const_type i32 [template = constants.%.1] // CHECK:STDOUT: %.loc11_9: type = const_type const i32 [template = constants.%.1] // CHECK:STDOUT: %.loc11_26: type = ptr_type const i32 [template = constants.%.2] diff --git a/toolchain/check/testdata/const/import.carbon b/toolchain/check/testdata/const/import.carbon index 4cd001234b4f..1bb2731d491a 100644 --- a/toolchain/check/testdata/const/import.carbon +++ b/toolchain/check/testdata/const/import.carbon @@ -26,18 +26,21 @@ var a_ptr: const i32* = a_ptr_ref; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = const_type i32 [template] -// CHECK:STDOUT: %.2: type = ptr_type const i32 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = ptr_type const i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .a_ref = %a_ref // CHECK:STDOUT: .a_ptr_ref = %a_ptr_ref // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %.loc4: type = const_type i32 [template = constants.%.1] // CHECK:STDOUT: @F.%return: ref const i32 = var // CHECK:STDOUT: } @@ -45,7 +48,7 @@ var a_ptr: const i32* = a_ptr_ref; // 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 // CHECK:STDOUT: %.loc7_16: type = const_type i32 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_25: type = ptr_type const i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_25: type = ptr_type const i32 [template = constants.%.3] // CHECK:STDOUT: %a_ptr_ref.var: ref const i32* = var a_ptr_ref // CHECK:STDOUT: %a_ptr_ref: ref const i32* = bind_name a_ptr_ref, %a_ptr_ref.var // CHECK:STDOUT: } @@ -54,7 +57,7 @@ var a_ptr: const i32* = a_ptr_ref; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct] // CHECK:STDOUT: %F.call: init const i32 = call %F.ref() // CHECK:STDOUT: assign file.%a_ref.var, %F.call // CHECK:STDOUT: %a_ref.ref: ref const i32 = name_ref a_ref, file.%a_ref @@ -80,8 +83,8 @@ var a_ptr: const i32* = a_ptr_ref; // CHECK:STDOUT: .a_ptr = %a_ptr // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir0, inst+5, unloaded -// CHECK:STDOUT: %import_ref.2: ref const i32 = import_ref ir0, inst+8, loc_12 -// CHECK:STDOUT: %import_ref.3: ref const i32* = import_ref ir0, inst+16, loc_22 +// CHECK:STDOUT: %import_ref.2: ref const i32 = import_ref ir0, inst+11, loc_12 +// CHECK:STDOUT: %import_ref.3: ref const i32* = import_ref ir0, inst+19, loc_22 // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc6_8: type = const_type i32 [template = constants.%.1] // CHECK:STDOUT: %.loc6_17: type = ptr_type const i32 [template = constants.%.2] diff --git a/toolchain/check/testdata/eval/fail_symbolic.carbon b/toolchain/check/testdata/eval/fail_symbolic.carbon index e914ecf4a727..bd42f417aa12 100644 --- a/toolchain/check/testdata/eval/fail_symbolic.carbon +++ b/toolchain/check/testdata/eval/fail_symbolic.carbon @@ -16,15 +16,18 @@ fn G(N:! i32) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %N: i32 = bind_symbolic_name N 0 [symbolic] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: G = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct] { // CHECK:STDOUT: %N.loc8_6.1: i32 = param N // CHECK:STDOUT: @G.%N: i32 = bind_symbolic_name N 0, %N.loc8_6.1 [symbolic = constants.%N] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/eval/symbolic.carbon b/toolchain/check/testdata/eval/symbolic.carbon index 6476a45770d5..b81195911b1a 100644 --- a/toolchain/check/testdata/eval/symbolic.carbon +++ b/toolchain/check/testdata/eval/symbolic.carbon @@ -15,25 +15,28 @@ fn F(T:! type) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] -// CHECK:STDOUT: %.1: type = ptr_type T [symbolic] -// CHECK:STDOUT: %.2: type = const_type T [symbolic] -// CHECK:STDOUT: %.3: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.4: type = tuple_type (T*, const T) [symbolic] -// CHECK:STDOUT: %.5: type = tuple_type (T*, T) [symbolic] -// CHECK:STDOUT: %.6: type = ptr_type (T*, T) [symbolic] -// CHECK:STDOUT: %.7: type = struct_type {.a: T} [symbolic] -// CHECK:STDOUT: %.8: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.9: type = array_type %.8, T [symbolic] -// CHECK:STDOUT: %.10: type = ptr_type [T; 5] [symbolic] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = ptr_type T [symbolic] +// CHECK:STDOUT: %.3: type = const_type T [symbolic] +// CHECK:STDOUT: %.4: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.5: type = tuple_type (T*, const T) [symbolic] +// CHECK:STDOUT: %.6: type = tuple_type (T*, T) [symbolic] +// CHECK:STDOUT: %.7: type = ptr_type (T*, T) [symbolic] +// CHECK:STDOUT: %.8: type = struct_type {.a: T} [symbolic] +// CHECK:STDOUT: %.9: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.10: type = array_type %.9, T [symbolic] +// CHECK:STDOUT: %.11: type = ptr_type [T; 5] [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %T.loc8_6.1: type = param T // CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc8_6.1 [symbolic = constants.%T] // CHECK:STDOUT: } @@ -42,20 +45,20 @@ fn F(T:! type) { // CHECK:STDOUT: fn @F(%T: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref.loc9_11: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc9_12: type = ptr_type T [symbolic = constants.%.1] +// CHECK:STDOUT: %.loc9_12: type = ptr_type T [symbolic = constants.%.2] // CHECK:STDOUT: %T.ref.loc9_21: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc9_15: type = const_type T [symbolic = constants.%.2] +// CHECK:STDOUT: %.loc9_15: type = const_type T [symbolic = constants.%.3] // CHECK:STDOUT: %.loc9_22.1: (type, type) = tuple_literal (%.loc9_12, %.loc9_15) -// CHECK:STDOUT: %.loc9_22.2: type = converted %.loc9_22.1, constants.%.4 [symbolic = constants.%.4] +// CHECK:STDOUT: %.loc9_22.2: type = converted %.loc9_22.1, constants.%.5 [symbolic = constants.%.5] // CHECK:STDOUT: %u.var: ref (T*, const T) = var u // CHECK:STDOUT: %u: ref (T*, const T) = bind_name u, %u.var // CHECK:STDOUT: %T.ref.loc10: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc10: type = struct_type {.a: T} [symbolic = constants.%.7] +// CHECK:STDOUT: %.loc10: type = struct_type {.a: T} [symbolic = constants.%.8] // CHECK:STDOUT: %v.var: ref {.a: T} = var v // CHECK:STDOUT: %v: ref {.a: T} = bind_name v, %v.var // CHECK:STDOUT: %T.ref.loc11: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc11_14: i32 = int_literal 5 [template = constants.%.8] -// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, T [symbolic = constants.%.9] +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 5 [template = constants.%.9] +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, T [symbolic = constants.%.10] // CHECK:STDOUT: %w.var: ref [T; 5] = var w // CHECK:STDOUT: %w: ref [T; 5] = bind_name w, %w.var // CHECK:STDOUT: return 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 cec0e9cc246a..0de81dc8dc7d 100644 --- a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon +++ b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon @@ -21,29 +21,36 @@ fn H() -> i32 { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 0 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %H: type = fn_type @H [template] +// CHECK:STDOUT: %struct.3: H = struct_value () [template] +// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .H = %H +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .H = %H.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // 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: } -// CHECK:STDOUT: %H: = fn_decl @H [template] { +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] { // CHECK:STDOUT: @H.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -56,16 +63,16 @@ fn H() -> i32 { // CHECK:STDOUT: %.loc10_19.2: type = converted %.loc10_19.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %v.var: ref (i32, i32) = var v // CHECK:STDOUT: %v: ref (i32, i32) = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref.loc10: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_7: ref (i32, i32) = splice_block %v.var {} // CHECK:STDOUT: %F.call.loc10: init (i32, i32) = call %F.ref.loc10() to %.loc10_7 // CHECK:STDOUT: assign %v.var, %F.call.loc10 // CHECK:STDOUT: %v.ref: ref (i32, i32) = name_ref v, %v -// CHECK:STDOUT: %F.ref.loc11: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref.loc11: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc11: ref (i32, i32) = splice_block %v.ref {} // CHECK:STDOUT: %F.call.loc11: init (i32, i32) = call %F.ref.loc11() to %.loc11 // CHECK:STDOUT: assign %v.ref, %F.call.loc11 -// CHECK:STDOUT: %F.ref.loc12: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref.loc12: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc9: ref (i32, i32) = splice_block %return {} // CHECK:STDOUT: %F.call.loc12: init (i32, i32) = call %F.ref.loc12() to %.loc9 // CHECK:STDOUT: return %F.call.loc12 to %return @@ -73,10 +80,10 @@ fn H() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @H() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc16_11.1: ref (i32, i32) = temporary_storage // CHECK:STDOUT: %G.call: init (i32, i32) = call %G.ref() to %.loc16_11.1 -// CHECK:STDOUT: %.loc16_14: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc16_14: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc16_11.2: ref (i32, i32) = temporary %.loc16_11.1, %G.call // CHECK:STDOUT: %.loc16_15.1: ref i32 = tuple_index %.loc16_11.2, %.loc16_14 // CHECK:STDOUT: %.loc16_15.2: i32 = bind_value %.loc16_15.1 diff --git a/toolchain/check/testdata/function/builtin/call.carbon b/toolchain/check/testdata/function/builtin/call.carbon index ad5ab3dab7da..fea1eeb81df1 100644 --- a/toolchain/check/testdata/function/builtin/call.carbon +++ b/toolchain/check/testdata/function/builtin/call.carbon @@ -11,32 +11,35 @@ var arr: [i32; Add(1, 2)]; // CHECK:STDOUT: --- call.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %Add: type = fn_type @Add [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Add = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 3] [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Add = %Add +// CHECK:STDOUT: .Add = %Add.decl // CHECK:STDOUT: .arr = %arr // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Add: = fn_decl @Add [template] { +// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct] { // CHECK:STDOUT: %a.loc7_8.1: i32 = param a // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: %b.loc7_16.1: i32 = param b // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc7_16.1 // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Add.ref: = name_ref Add, %Add [template = %Add] -// CHECK:STDOUT: %.loc9_20: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_23: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc9_20, %.loc9_23) [template = constants.%.3] -// CHECK:STDOUT: %.loc9_25: type = array_type %int.sadd, i32 [template = constants.%.4] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc9_20: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_23: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc9_20, %.loc9_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc9_25: type = array_type %int.sadd, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/builtin/call_from_operator.carbon b/toolchain/check/testdata/function/builtin/call_from_operator.carbon index f16453f3442d..1ef394d5e716 100644 --- a/toolchain/check/testdata/function/builtin/call_from_operator.carbon +++ b/toolchain/check/testdata/function/builtin/call_from_operator.carbon @@ -29,8 +29,11 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Add [template] // CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Add, [template] -// CHECK:STDOUT: %.3: in Add> = assoc_entity element0, @Add.%Op [template] +// CHECK:STDOUT: %Op: type = fn_type @Op [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Add, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Add.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -42,7 +45,7 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: // CHECK:STDOUT: interface @Add { // CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %Op: = fn_decl @Op [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op [template = constants.%struct] { // CHECK:STDOUT: %Self.ref.loc5_15: Add = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self] @@ -58,12 +61,12 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in Add> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op[@Add.%self.loc5_9.2: Self](@Add.%other.loc5_21.2: Self) -> Self; @@ -73,21 +76,26 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Add [template] // CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: = interface_witness (@impl.%Op) [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.5: type = assoc_entity_type @Add, [template] -// CHECK:STDOUT: %.6: in Add> = assoc_entity element0, file.%import_ref.6 [template] -// CHECK:STDOUT: %.7: = bound_method %.3, @impl.%Op [template] -// CHECK:STDOUT: %.8: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.9: type = array_type %.8, i32 [template] -// CHECK:STDOUT: %.10: type = ptr_type [i32; 3] [template] -// CHECK:STDOUT: %.11: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.12: = bound_method %.8, @impl.%Op [template] -// CHECK:STDOUT: %.13: i32 = int_literal 7 [template] -// CHECK:STDOUT: %.14: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.15: i32 = int_literal 0 [template] -// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.8, %.11, %.13) [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.3: = interface_witness (%struct.1) [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.6: type = assoc_entity_type @Add, Op [template] +// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.6 [template] +// CHECK:STDOUT: %.8: = bound_method %.4, %struct.1 [template] +// CHECK:STDOUT: %.9: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.10: type = array_type %.9, i32 [template] +// CHECK:STDOUT: %.11: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %.12: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.13: = bound_method %.9, %struct.1 [template] +// CHECK:STDOUT: %.14: i32 = int_literal 7 [template] +// CHECK:STDOUT: %.15: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.16: i32 = int_literal 0 [template] +// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.9, %.12, %.14) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -97,22 +105,22 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_9 [template = constants.%.1] -// CHECK:STDOUT: %import_ref.2: in Add> = import_ref ir2, inst+21, loc_36 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+24, loc_36 [template = constants.%.7] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+19, loc_10 [template = imports.%Op] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+19, loc_10 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Add.decl: type = interface_decl @Add [template = constants.%.1] {} // CHECK:STDOUT: %Add.ref: type = name_ref Add, %import_ref.1 [template = constants.%.1] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_20: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_20: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+1, loc_36 [template = constants.%.1] // CHECK:STDOUT: %import_ref.6 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Op] -// CHECK:STDOUT: %.loc10_18: = bound_method %.loc10_16, %.1 [template = constants.%.7] -// CHECK:STDOUT: %int.sadd: init i32 = call %.loc10_18(%.loc10_16, %.loc10_20) [template = constants.%.8] -// CHECK:STDOUT: %.loc10_21: type = array_type %int.sadd, i32 [template = constants.%.9] +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc10_18: = bound_method %.loc10_16, %.1 [template = constants.%.8] +// CHECK:STDOUT: %int.sadd: init i32 = call %.loc10_18(%.loc10_16, %.loc10_20) [template = constants.%.9] +// CHECK:STDOUT: %.loc10_21: type = array_type %int.sadd, i32 [template = constants.%.10] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // CHECK:STDOUT: %import_ref.7: type = import_ref ir2, inst+1, loc_47 [template = constants.%.1] @@ -126,7 +134,7 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as Add { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc7_15: type = name_ref Self, i32 [template = i32] // CHECK:STDOUT: %self.loc7_9.1: i32 = param self // CHECK:STDOUT: %self.loc7_9.2: i32 = bind_name self, %self.loc7_9.1 @@ -136,10 +144,10 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: %Self.ref.loc7_37: type = name_ref Self, i32 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.2] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -149,23 +157,23 @@ var arr: [i32; 1 + 2] = (3, 4, 3 + 4); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_26: i32 = int_literal 3 [template = constants.%.8] -// CHECK:STDOUT: %.loc10_29: i32 = int_literal 4 [template = constants.%.11] -// CHECK:STDOUT: %.loc10_32: i32 = int_literal 3 [template = constants.%.8] -// CHECK:STDOUT: %.loc10_36: i32 = int_literal 4 [template = constants.%.11] -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Op] -// CHECK:STDOUT: %.loc10_34: = bound_method %.loc10_32, %.1 [template = constants.%.12] -// CHECK:STDOUT: %int.sadd: init i32 = call %.loc10_34(%.loc10_32, %.loc10_36) [template = constants.%.13] +// CHECK:STDOUT: %.loc10_26: i32 = int_literal 3 [template = constants.%.9] +// CHECK:STDOUT: %.loc10_29: i32 = int_literal 4 [template = constants.%.12] +// CHECK:STDOUT: %.loc10_32: i32 = int_literal 3 [template = constants.%.9] +// CHECK:STDOUT: %.loc10_36: i32 = int_literal 4 [template = constants.%.12] +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc10_34: = bound_method %.loc10_32, %.1 [template = constants.%.13] +// CHECK:STDOUT: %int.sadd: init i32 = call %.loc10_34(%.loc10_32, %.loc10_36) [template = constants.%.14] // CHECK:STDOUT: %.loc10_37.1: (i32, i32, i32) = tuple_literal (%.loc10_26, %.loc10_29, %int.sadd) -// CHECK:STDOUT: %.loc10_37.2: i32 = int_literal 0 [template = constants.%.15] +// CHECK:STDOUT: %.loc10_37.2: i32 = int_literal 0 [template = constants.%.16] // CHECK:STDOUT: %.loc10_37.3: ref i32 = array_index file.%arr.var, %.loc10_37.2 -// CHECK:STDOUT: %.loc10_37.4: init i32 = initialize_from %.loc10_26 to %.loc10_37.3 [template = constants.%.8] -// CHECK:STDOUT: %.loc10_37.5: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_37.4: init i32 = initialize_from %.loc10_26 to %.loc10_37.3 [template = constants.%.9] +// CHECK:STDOUT: %.loc10_37.5: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_37.6: ref i32 = array_index file.%arr.var, %.loc10_37.5 -// CHECK:STDOUT: %.loc10_37.7: init i32 = initialize_from %.loc10_29 to %.loc10_37.6 [template = constants.%.11] -// CHECK:STDOUT: %.loc10_37.8: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_37.7: init i32 = initialize_from %.loc10_29 to %.loc10_37.6 [template = constants.%.12] +// CHECK:STDOUT: %.loc10_37.8: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %.loc10_37.9: ref i32 = array_index file.%arr.var, %.loc10_37.8 -// CHECK:STDOUT: %.loc10_37.10: init i32 = initialize_from %int.sadd to %.loc10_37.9 [template = constants.%.13] +// CHECK:STDOUT: %.loc10_37.10: init i32 = initialize_from %int.sadd to %.loc10_37.9 [template = constants.%.14] // CHECK:STDOUT: %.loc10_37.11: init [i32; 3] = array_init (%.loc10_37.4, %.loc10_37.7, %.loc10_37.10) to file.%arr.var [template = constants.%array] // CHECK:STDOUT: %.loc10_38: init [i32; 3] = converted %.loc10_37.1, %.loc10_37.11 [template = constants.%array] // CHECK:STDOUT: assign file.%arr.var, %.loc10_38 diff --git a/toolchain/check/testdata/function/builtin/definition.carbon b/toolchain/check/testdata/function/builtin/definition.carbon index 39aa1a750486..2285333d459e 100644 --- a/toolchain/check/testdata/function/builtin/definition.carbon +++ b/toolchain/check/testdata/function/builtin/definition.carbon @@ -8,13 +8,19 @@ fn Add(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: --- definition.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Add: type = fn_type @Add [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Add = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Add = %Add +// CHECK:STDOUT: .Add = %Add.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Add: = fn_decl @Add [template] { +// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct] { // CHECK:STDOUT: %a.loc7_8.1: i32 = param a // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: %b.loc7_16.1: i32 = param b diff --git a/toolchain/check/testdata/function/builtin/fail_redefined.carbon b/toolchain/check/testdata/function/builtin/fail_redefined.carbon index 24d69207f292..45b0d0caf5e8 100644 --- a/toolchain/check/testdata/function/builtin/fail_redefined.carbon +++ b/toolchain/check/testdata/function/builtin/fail_redefined.carbon @@ -35,50 +35,60 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: --- fail_redefined.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A.loc7 -// CHECK:STDOUT: .B = %B.loc17 -// CHECK:STDOUT: .C = %C.loc27 +// CHECK:STDOUT: .A = %A.decl.loc7 +// CHECK:STDOUT: .B = %B.decl.loc17 +// CHECK:STDOUT: .C = %C.decl.loc27 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.loc7: = fn_decl @A [template] { +// CHECK:STDOUT: %A.decl.loc7: A = fn_decl @A [template = constants.%struct.1] { // CHECK:STDOUT: %n.loc7_6.1: i32 = param n // CHECK:STDOUT: %n.loc7_6.2: i32 = bind_name n, %n.loc7_6.1 // CHECK:STDOUT: %m.loc7_14.1: i32 = param m // CHECK:STDOUT: %m.loc7_14.2: i32 = bind_name m, %m.loc7_14.1 // CHECK:STDOUT: %return.var.loc7: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %A.loc15: = fn_decl @A [template] { +// CHECK:STDOUT: %A.decl.loc15: A = fn_decl @A [template = constants.%struct.1] { // CHECK:STDOUT: %n.loc15_6.1: i32 = param n // CHECK:STDOUT: @A.%n: i32 = bind_name n, %n.loc15_6.1 // CHECK:STDOUT: %m.loc15_14.1: i32 = param m // CHECK:STDOUT: @A.%m: i32 = bind_name m, %m.loc15_14.1 // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B.loc17: = fn_decl @B [template] { +// CHECK:STDOUT: %B.decl.loc17: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: %n.loc17_6.1: i32 = param n // CHECK:STDOUT: %n.loc17_6.2: i32 = bind_name n, %n.loc17_6.1 // CHECK:STDOUT: %m.loc17_14.1: i32 = param m // CHECK:STDOUT: %m.loc17_14.2: i32 = bind_name m, %m.loc17_14.1 // CHECK:STDOUT: %return.var.loc17: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B.loc25: = fn_decl @B [template] { +// CHECK:STDOUT: %B.decl.loc25: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: %n.loc25_6.1: i32 = param n // CHECK:STDOUT: @B.%n: i32 = bind_name n, %n.loc25_6.1 // CHECK:STDOUT: %m.loc25_14.1: i32 = param m // CHECK:STDOUT: @B.%m: i32 = bind_name m, %m.loc25_14.1 // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C.loc27: = fn_decl @C [template] { +// CHECK:STDOUT: %C.decl.loc27: C = fn_decl @C [template = constants.%struct.3] { // CHECK:STDOUT: %n.loc27_6.1: i32 = param n // CHECK:STDOUT: %n.loc27_6.2: i32 = bind_name n, %n.loc27_6.1 // CHECK:STDOUT: %m.loc27_14.1: i32 = param m // CHECK:STDOUT: %m.loc27_14.2: i32 = bind_name m, %m.loc27_14.1 // CHECK:STDOUT: %return.var.loc27: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C.loc34: = fn_decl @C [template] { +// CHECK:STDOUT: %C.decl.loc34: C = fn_decl @C [template = constants.%struct.3] { // CHECK:STDOUT: %n.loc34_6.1: i32 = param n // CHECK:STDOUT: @C.%n: i32 = bind_name n, %n.loc34_6.1 // CHECK:STDOUT: %m.loc34_14.1: i32 = param m diff --git a/toolchain/check/testdata/function/builtin/fail_unknown.carbon b/toolchain/check/testdata/function/builtin/fail_unknown.carbon index c214d07aea56..d0c677f24e9b 100644 --- a/toolchain/check/testdata/function/builtin/fail_unknown.carbon +++ b/toolchain/check/testdata/function/builtin/fail_unknown.carbon @@ -11,13 +11,19 @@ fn UnknownBuiltin() = "unknown.builtin.name"; // CHECK:STDOUT: --- fail_unknown.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %UnknownBuiltin: type = fn_type @UnknownBuiltin [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: UnknownBuiltin = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .UnknownBuiltin = %UnknownBuiltin +// CHECK:STDOUT: .UnknownBuiltin = %UnknownBuiltin.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %UnknownBuiltin: = fn_decl @UnknownBuiltin [template] {} +// CHECK:STDOUT: %UnknownBuiltin.decl: UnknownBuiltin = fn_decl @UnknownBuiltin [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @UnknownBuiltin(); diff --git a/toolchain/check/testdata/function/builtin/import.carbon b/toolchain/check/testdata/function/builtin/import.carbon index 0ace0420bd08..4165d920b831 100644 --- a/toolchain/check/testdata/function/builtin/import.carbon +++ b/toolchain/check/testdata/function/builtin/import.carbon @@ -20,11 +20,17 @@ var arr: [i32; Core.Add(1, 2)] = (1, 2, 3); // CHECK:STDOUT: --- core.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Add: type = fn_type @Add [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Add = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Add = %Add +// CHECK:STDOUT: .Add = %Add.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Add: = fn_decl @Add [template] { +// CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct] { // CHECK:STDOUT: %a.loc6_8.1: i32 = param a // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc6_8.1 // CHECK:STDOUT: %b.loc6_16.1: i32 = param b @@ -38,14 +44,17 @@ var arr: [i32; Core.Add(1, 2)] = (1, 2, 3); // CHECK:STDOUT: --- use.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.4: type = array_type %.3, i32 [template] -// CHECK:STDOUT: %.5: type = ptr_type [i32; 3] [template] -// CHECK:STDOUT: %.6: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] -// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.1, %.2, %.3) [template] +// CHECK:STDOUT: %Add: type = fn_type @Add [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Add = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] +// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.2, %.3, %.4) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -55,12 +64,12 @@ var arr: [i32; Core.Add(1, 2)] = (1, 2, 3); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] -// CHECK:STDOUT: %import_ref: = import_ref ir2, inst+6, loc_11 [template = imports.%Add] -// CHECK:STDOUT: %Add.ref: = name_ref Add, %import_ref [template = imports.%Add] -// CHECK:STDOUT: %.loc4_25: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_28: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc4_25, %.loc4_28) [template = constants.%.3] -// CHECK:STDOUT: %.loc4_30: type = array_type %int.sadd, i32 [template = constants.%.4] +// CHECK:STDOUT: %import_ref: Add = import_ref ir2, inst+6, loc_11 [template = constants.%struct] +// CHECK:STDOUT: %Add.ref: Add = name_ref Add, %import_ref [template = constants.%struct] +// CHECK:STDOUT: %.loc4_25: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_28: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc4_25, %.loc4_28) [template = constants.%.4] +// CHECK:STDOUT: %.loc4_30: type = array_type %int.sadd, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // CHECK:STDOUT: } @@ -69,19 +78,19 @@ var arr: [i32; Core.Add(1, 2)] = (1, 2, 3); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4_35: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_38: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_41: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc4_35: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_38: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc4_41: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: %.loc4_42.1: (i32, i32, i32) = tuple_literal (%.loc4_35, %.loc4_38, %.loc4_41) -// CHECK:STDOUT: %.loc4_42.2: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc4_42.2: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc4_42.3: ref i32 = array_index file.%arr.var, %.loc4_42.2 -// CHECK:STDOUT: %.loc4_42.4: init i32 = initialize_from %.loc4_35 to %.loc4_42.3 [template = constants.%.1] -// CHECK:STDOUT: %.loc4_42.5: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc4_42.4: init i32 = initialize_from %.loc4_35 to %.loc4_42.3 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_42.5: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc4_42.6: ref i32 = array_index file.%arr.var, %.loc4_42.5 -// CHECK:STDOUT: %.loc4_42.7: init i32 = initialize_from %.loc4_38 to %.loc4_42.6 [template = constants.%.2] -// CHECK:STDOUT: %.loc4_42.8: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc4_42.7: init i32 = initialize_from %.loc4_38 to %.loc4_42.6 [template = constants.%.3] +// CHECK:STDOUT: %.loc4_42.8: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %.loc4_42.9: ref i32 = array_index file.%arr.var, %.loc4_42.8 -// CHECK:STDOUT: %.loc4_42.10: init i32 = initialize_from %.loc4_41 to %.loc4_42.9 [template = constants.%.3] +// CHECK:STDOUT: %.loc4_42.10: init i32 = initialize_from %.loc4_41 to %.loc4_42.9 [template = constants.%.4] // CHECK:STDOUT: %.loc4_42.11: init [i32; 3] = array_init (%.loc4_42.4, %.loc4_42.7, %.loc4_42.10) to file.%arr.var [template = constants.%array] // CHECK:STDOUT: %.loc4_43: init [i32; 3] = converted %.loc4_42.1, %.loc4_42.11 [template = constants.%array] // CHECK:STDOUT: assign file.%arr.var, %.loc4_43 diff --git a/toolchain/check/testdata/function/builtin/method.carbon b/toolchain/check/testdata/function/builtin/method.carbon index 44f867b9cec2..3305c009e729 100644 --- a/toolchain/check/testdata/function/builtin/method.carbon +++ b/toolchain/check/testdata/function/builtin/method.carbon @@ -19,15 +19,20 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @I, [template] -// CHECK:STDOUT: %.3: in I> = assoc_entity element0, @I.%F [template] -// CHECK:STDOUT: %.4: = interface_witness (@impl.%F) [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.6: = bound_method %.5, @impl.%F [template] -// CHECK:STDOUT: %.7: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.8: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.9: type = array_type %.8, i32 [template] -// CHECK:STDOUT: %.10: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @I, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @I.%F.decl [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.5: = interface_witness (%struct.2) [template] +// CHECK:STDOUT: %.6: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.7: = bound_method %.6, %struct.2 [template] +// CHECK:STDOUT: %.8: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.9: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.10: type = array_type %.9, i32 [template] +// CHECK:STDOUT: %.11: type = ptr_type [i32; 3] [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -41,21 +46,21 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %I.ref.loc11: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15_16: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_16: i32 = int_literal 1 [template = constants.%.6] // CHECK:STDOUT: %I.ref.loc15: type = name_ref I, %I.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: in I> = name_ref F, @I.%.loc8_40 [template = constants.%.3] -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] -// CHECK:STDOUT: %.loc15_17: = bound_method %.loc15_16, %.1 [template = constants.%.6] -// CHECK:STDOUT: %.loc15_24: i32 = int_literal 2 [template = constants.%.7] -// CHECK:STDOUT: %int.sadd: init i32 = call %.loc15_17(%.loc15_16, %.loc15_24) [template = constants.%.8] -// CHECK:STDOUT: %.loc15_26: type = array_type %int.sadd, i32 [template = constants.%.9] +// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc8_40 [template = constants.%.4] +// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc15_17: = bound_method %.loc15_16, %.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc15_24: i32 = int_literal 2 [template = constants.%.8] +// CHECK:STDOUT: %int.sadd: init i32 = call %.loc15_17(%.loc15_16, %.loc15_24) [template = constants.%.9] +// CHECK:STDOUT: %.loc15_26: type = array_type %int.sadd, i32 [template = constants.%.10] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc8_14: I = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc8_14.1: type = facet_type_access %Self.ref.loc8_14 [symbolic = constants.%Self] // CHECK:STDOUT: %.loc8_14.2: type = converted %Self.ref.loc8_14, %.loc8_14.1 [symbolic = constants.%Self] @@ -71,26 +76,26 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: %.loc8_36.2: type = converted %Self.ref.loc8_36, %.loc8_36.1 [symbolic = constants.%Self] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_40: in I> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %.loc8_40: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8_40 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as I { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: %self.loc12_8.1: i32 = param self // CHECK:STDOUT: %self.loc12_8.2: i32 = bind_name self, %self.loc12_8.1 // CHECK:STDOUT: %other.loc12_19.1: i32 = param other // CHECK:STDOUT: %other.loc12_19.2: i32 = bind_name other, %other.loc12_19.1 // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.4] +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/fail_not_callable.carbon b/toolchain/check/testdata/function/call/fail_not_callable.carbon index 2acf5dc9559d..28466c7e6ad7 100644 --- a/toolchain/check/testdata/function/call/fail_not_callable.carbon +++ b/toolchain/check/testdata/function/call/fail_not_callable.carbon @@ -14,24 +14,27 @@ fn Run() { // CHECK:STDOUT: --- fail_not_callable.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type String [template] -// CHECK:STDOUT: %.2: String = string_literal "hello" [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Run = struct_value () [template] +// CHECK:STDOUT: %.2: type = ptr_type String [template] +// CHECK:STDOUT: %.3: String = string_literal "hello" [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc11: String = string_literal "hello" [template = constants.%.2] +// CHECK:STDOUT: %.loc11: String = string_literal "hello" [template = constants.%.3] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/fail_param_count.carbon b/toolchain/check/testdata/function/call/fail_param_count.carbon index 7cfc3d20657e..93bcd7408305 100644 --- a/toolchain/check/testdata/function/call/fail_param_count.carbon +++ b/toolchain/check/testdata/function/call/fail_param_count.carbon @@ -63,32 +63,40 @@ fn Main() { // CHECK:STDOUT: --- fail_param_count.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %Run0: type = fn_type @Run0 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Run0 = struct_value () [template] +// CHECK:STDOUT: %Run1: type = fn_type @Run1 [template] +// CHECK:STDOUT: %struct.2: Run1 = struct_value () [template] +// CHECK:STDOUT: %Run2: type = fn_type @Run2 [template] +// CHECK:STDOUT: %struct.3: Run2 = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.4: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Run0 = %Run0 -// CHECK:STDOUT: .Run1 = %Run1 -// CHECK:STDOUT: .Run2 = %Run2 -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Run0 = %Run0.decl +// CHECK:STDOUT: .Run1 = %Run1.decl +// CHECK:STDOUT: .Run2 = %Run2.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Run0: = fn_decl @Run0 [template] {} -// CHECK:STDOUT: %Run1: = fn_decl @Run1 [template] { +// CHECK:STDOUT: %Run0.decl: Run0 = fn_decl @Run0 [template = constants.%struct.1] {} +// CHECK:STDOUT: %Run1.decl: Run1 = fn_decl @Run1 [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc8_9.1: i32 = param a // CHECK:STDOUT: @Run1.%a: i32 = bind_name a, %a.loc8_9.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %Run2: = fn_decl @Run2 [template] { +// CHECK:STDOUT: %Run2.decl: Run2 = fn_decl @Run2 [template = constants.%struct.3] { // 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: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.4] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run0() { @@ -108,22 +116,22 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Run0.ref.loc19: = name_ref Run0, file.%Run0 [template = file.%Run0] -// CHECK:STDOUT: %.loc19: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %Run0.ref.loc19: Run0 = name_ref Run0, file.%Run0.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc19: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %Run0.call.loc19: init () = call %Run0.ref.loc19() [template = ] -// CHECK:STDOUT: %Run0.ref.loc27: = name_ref Run0, file.%Run0 [template = file.%Run0] +// CHECK:STDOUT: %Run0.ref.loc27: Run0 = name_ref Run0, file.%Run0.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc27_8: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc27_11: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc27_11: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %Run0.call.loc27: init () = call %Run0.ref.loc27() [template = ] -// CHECK:STDOUT: %Run1.ref.loc36: = name_ref Run1, file.%Run1 [template = file.%Run1] +// CHECK:STDOUT: %Run1.ref.loc36: Run1 = name_ref Run1, file.%Run1.decl [template = constants.%struct.2] // CHECK:STDOUT: %Run1.call.loc36: init () = call %Run1.ref.loc36() [template = ] -// CHECK:STDOUT: %Run1.ref.loc44: = name_ref Run1, file.%Run1 [template = file.%Run1] +// CHECK:STDOUT: %Run1.ref.loc44: Run1 = name_ref Run1, file.%Run1.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc44_8: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc44_11: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc44_11: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %Run1.call.loc44: init () = call %Run1.ref.loc44() [template = ] -// CHECK:STDOUT: %Run2.ref.loc53: = name_ref Run2, file.%Run2 [template = file.%Run2] +// CHECK:STDOUT: %Run2.ref.loc53: Run2 = name_ref Run2, file.%Run2.decl [template = constants.%struct.3] // CHECK:STDOUT: %Run2.call.loc53: init () = call %Run2.ref.loc53() [template = ] -// CHECK:STDOUT: %Run2.ref.loc60: = name_ref Run2, file.%Run2 [template = file.%Run2] +// CHECK:STDOUT: %Run2.ref.loc60: Run2 = name_ref Run2, file.%Run2.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc60: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %Run2.call.loc60: init () = call %Run2.ref.loc60() [template = ] // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/fail_param_type.carbon b/toolchain/check/testdata/function/call/fail_param_type.carbon index d0fb9c4d601d..845537ad9bf5 100644 --- a/toolchain/check/testdata/function/call/fail_param_type.carbon +++ b/toolchain/check/testdata/function/call/fail_param_type.carbon @@ -19,22 +19,26 @@ fn F() { // CHECK:STDOUT: --- fail_param_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: f64 = float_literal 1 [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.2: f64 = float_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc7_6.1: i32 = param a // CHECK:STDOUT: @G.%a: i32 = bind_name a, %a.loc7_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%a: i32) { @@ -44,8 +48,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] -// CHECK:STDOUT: %.loc16: f64 = float_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc16: f64 = float_literal 1 [template = constants.%.2] // CHECK:STDOUT: %G.call: init () = call %G.ref() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } 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 16a1c3d9c7af..d1b1a32ec0d9 100644 --- a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon @@ -16,25 +16,30 @@ fn Run() { // CHECK:STDOUT: --- fail_return_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: f64 = float_literal 1 [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %.2: f64 = float_literal 1 [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %struct.2: Run = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Foo = %Foo -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Foo = %Foo.decl +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] { // CHECK:STDOUT: @Foo.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: f64 = float_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc7: f64 = float_literal 1 [template = constants.%.2] // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -42,7 +47,7 @@ fn Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] +// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] // CHECK:STDOUT: %Foo.call: init f64 = call %Foo.ref() // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/i32.carbon b/toolchain/check/testdata/function/call/i32.carbon index 4bb6b8225050..5bede83e8db3 100644 --- a/toolchain/check/testdata/function/call/i32.carbon +++ b/toolchain/check/testdata/function/call/i32.carbon @@ -15,22 +15,27 @@ fn Main() { // CHECK:STDOUT: --- i32.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] +// CHECK:STDOUT: %Echo: type = fn_type @Echo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Echo = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Echo = %Echo -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Echo = %Echo.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Echo: = fn_decl @Echo [template] { +// CHECK:STDOUT: %Echo.decl: Echo = fn_decl @Echo [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc7_9.1: i32 = param a // CHECK:STDOUT: @Echo.%a: i32 = bind_name a, %a.loc7_9.1 // CHECK:STDOUT: @Echo.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Echo(%a: i32) -> i32 { @@ -43,8 +48,8 @@ fn Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %Echo.ref: = name_ref Echo, file.%Echo [template = file.%Echo] -// CHECK:STDOUT: %.loc12: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %Echo.ref: Echo = name_ref Echo, file.%Echo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc12: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %Echo.call: init i32 = call %Echo.ref(%.loc12) // CHECK:STDOUT: assign %b.var, %Echo.call // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/more_param_ir.carbon b/toolchain/check/testdata/function/call/more_param_ir.carbon index e42db6ae27ee..89f99bef88a2 100644 --- a/toolchain/check/testdata/function/call/more_param_ir.carbon +++ b/toolchain/check/testdata/function/call/more_param_ir.carbon @@ -15,29 +15,33 @@ fn Main() { // CHECK:STDOUT: --- more_param_ir.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.3) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 6 [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %.2: type = tuple_type (type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.4) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Foo = %Foo -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Foo = %Foo.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { @@ -48,19 +52,19 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_15.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc10_15.2: type = converted %.loc10_15.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_15.2: type = converted %.loc10_15.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref (i32,) = var x // CHECK:STDOUT: %x: ref (i32,) = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc10_22.1: (i32,) = tuple_literal (%.loc10_20) // CHECK:STDOUT: %.loc10_22.2: init (i32,) = tuple_init (%.loc10_20) to %x.var [template = constants.%tuple] // CHECK:STDOUT: %.loc10_23: init (i32,) = converted %.loc10_22.1, %.loc10_22.2 [template = constants.%tuple] // CHECK:STDOUT: assign %x.var, %.loc10_23 -// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] +// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] // CHECK:STDOUT: %x.ref: ref (i32,) = name_ref x, %x -// CHECK:STDOUT: %.loc12_9: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_9: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc12_10.1: ref i32 = tuple_index %x.ref, %.loc12_9 -// CHECK:STDOUT: %.loc12_13: i32 = int_literal 6 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_13: i32 = int_literal 6 [template = constants.%.6] // CHECK:STDOUT: %.loc12_10.2: i32 = bind_value %.loc12_10.1 // CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc12_10.2, %.loc12_13) // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/no_prelude/alias.carbon b/toolchain/check/testdata/function/call/no_prelude/alias.carbon index f26300dfebe6..3f7936ca23dd 100644 --- a/toolchain/check/testdata/function/call/no_prelude/alias.carbon +++ b/toolchain/check/testdata/function/call/no_prelude/alias.carbon @@ -16,23 +16,27 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: .B = %B -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { // CHECK:STDOUT: %.loc7_12.1: () = tuple_literal () // CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @A.%return: ref () = var // CHECK:STDOUT: } -// 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: %A.ref: A = name_ref A, %A.decl [template = constants.%struct.1] +// CHECK:STDOUT: %B: A = bind_alias B, %A.decl [template = constants.%struct.1] +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> () { @@ -49,7 +53,7 @@ fn Main() { // CHECK:STDOUT: %.loc12_11.2: type = converted %.loc12_11.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %b.var: ref () = var b // CHECK:STDOUT: %b: ref () = bind_name b, %b.var -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%A] +// CHECK:STDOUT: %B.ref: A = name_ref B, file.%B [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %B.ref() // CHECK:STDOUT: assign %b.var, %A.call // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/no_prelude/empty_struct.carbon b/toolchain/check/testdata/function/call/no_prelude/empty_struct.carbon index f9afb8b67ba5..dc04726a1ad0 100644 --- a/toolchain/check/testdata/function/call/no_prelude/empty_struct.carbon +++ b/toolchain/check/testdata/function/call/no_prelude/empty_struct.carbon @@ -16,16 +16,20 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %Echo: type = fn_type @Echo [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %struct: {} = struct_value () [template] +// CHECK:STDOUT: %struct.1: Echo = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %struct.3: {} = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Echo = %Echo -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Echo = %Echo.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Echo: = fn_decl @Echo [template] { +// CHECK:STDOUT: %Echo.decl: Echo = fn_decl @Echo [template = constants.%struct.1] { // 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 @@ -34,7 +38,7 @@ fn Main() { // CHECK:STDOUT: %.loc7_20.2: type = converted %.loc7_20.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @Echo.%return: ref {} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Echo(%a: {}) -> {} { @@ -45,10 +49,10 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Echo.ref: = name_ref Echo, file.%Echo [template = file.%Echo] +// CHECK:STDOUT: %Echo.ref: Echo = name_ref Echo, file.%Echo.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc12_9: {} = struct_literal () -// CHECK:STDOUT: %struct: {} = struct_value () [template = constants.%struct] -// CHECK:STDOUT: %.loc12_7: {} = converted %.loc12_9, %struct [template = constants.%struct] +// CHECK:STDOUT: %struct: {} = struct_value () [template = constants.%struct.3] +// CHECK:STDOUT: %.loc12_7: {} = converted %.loc12_9, %struct [template = constants.%struct.3] // CHECK:STDOUT: %Echo.call: init {} = call %Echo.ref(%.loc12_7) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/no_prelude/empty_tuple.carbon b/toolchain/check/testdata/function/call/no_prelude/empty_tuple.carbon index 80b289d6ea67..0cc49d298b44 100644 --- a/toolchain/check/testdata/function/call/no_prelude/empty_tuple.carbon +++ b/toolchain/check/testdata/function/call/no_prelude/empty_tuple.carbon @@ -16,15 +16,19 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %Echo: type = fn_type @Echo [template] +// CHECK:STDOUT: %struct.1: Echo = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Echo = %Echo -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Echo = %Echo.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Echo: = fn_decl @Echo [template] { +// CHECK:STDOUT: %Echo.decl: Echo = fn_decl @Echo [template = constants.%struct.1] { // 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 @@ -33,7 +37,7 @@ fn Main() { // CHECK:STDOUT: %.loc7_20.2: type = converted %.loc7_20.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @Echo.%return: ref () = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Echo(%a: ()) -> () { @@ -44,7 +48,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Echo.ref: = name_ref Echo, file.%Echo [template = file.%Echo] +// CHECK:STDOUT: %Echo.ref: Echo = name_ref Echo, file.%Echo.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc12_9: () = tuple_literal () // CHECK:STDOUT: %tuple: () = tuple_value () [template = constants.%tuple] // CHECK:STDOUT: %.loc12_7: () = converted %.loc12_9, %tuple [template = constants.%tuple] diff --git a/toolchain/check/testdata/function/call/no_prelude/params_zero.carbon b/toolchain/check/testdata/function/call/no_prelude/params_zero.carbon index 570258f5fb75..e2de634e2924 100644 --- a/toolchain/check/testdata/function/call/no_prelude/params_zero.carbon +++ b/toolchain/check/testdata/function/call/no_prelude/params_zero.carbon @@ -13,16 +13,20 @@ fn Main() { // CHECK:STDOUT: --- params_zero.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Foo = %Foo -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Foo = %Foo.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { @@ -32,7 +36,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] +// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] // CHECK:STDOUT: %Foo.call: init () = call %Foo.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/no_prelude/return_implicit.carbon b/toolchain/check/testdata/function/call/no_prelude/return_implicit.carbon index c0ee661e4a77..5dba99d46b98 100644 --- a/toolchain/check/testdata/function/call/no_prelude/return_implicit.carbon +++ b/toolchain/check/testdata/function/call/no_prelude/return_implicit.carbon @@ -14,16 +14,20 @@ fn Main() { // CHECK:STDOUT: --- return_implicit.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %MakeImplicitEmptyTuple: type = fn_type @MakeImplicitEmptyTuple [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: MakeImplicitEmptyTuple = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .MakeImplicitEmptyTuple = %MakeImplicitEmptyTuple -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .MakeImplicitEmptyTuple = %MakeImplicitEmptyTuple.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %MakeImplicitEmptyTuple: = fn_decl @MakeImplicitEmptyTuple [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %MakeImplicitEmptyTuple.decl: MakeImplicitEmptyTuple = fn_decl @MakeImplicitEmptyTuple [template = constants.%struct.1] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeImplicitEmptyTuple() { @@ -37,7 +41,7 @@ fn Main() { // CHECK:STDOUT: %.loc11_11.2: type = converted %.loc11_11.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %b.var: ref () = var b // CHECK:STDOUT: %b: ref () = bind_name b, %b.var -// CHECK:STDOUT: %MakeImplicitEmptyTuple.ref: = name_ref MakeImplicitEmptyTuple, file.%MakeImplicitEmptyTuple [template = file.%MakeImplicitEmptyTuple] +// CHECK:STDOUT: %MakeImplicitEmptyTuple.ref: MakeImplicitEmptyTuple = name_ref MakeImplicitEmptyTuple, file.%MakeImplicitEmptyTuple.decl [template = constants.%struct.1] // CHECK:STDOUT: %MakeImplicitEmptyTuple.call: init () = call %MakeImplicitEmptyTuple.ref() // CHECK:STDOUT: assign %b.var, %MakeImplicitEmptyTuple.call // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/params_one.carbon b/toolchain/check/testdata/function/call/params_one.carbon index 727a4c3af9cf..9990434a0c41 100644 --- a/toolchain/check/testdata/function/call/params_one.carbon +++ b/toolchain/check/testdata/function/call/params_one.carbon @@ -13,22 +13,26 @@ fn Main() { // CHECK:STDOUT: --- params_one.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Foo = %Foo -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Foo = %Foo.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc7_8.1: i32 = param a // CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { @@ -38,8 +42,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc10: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc10: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc10) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/params_one_comma.carbon b/toolchain/check/testdata/function/call/params_one_comma.carbon index 4d7c7f0a7981..0432976def61 100644 --- a/toolchain/check/testdata/function/call/params_one_comma.carbon +++ b/toolchain/check/testdata/function/call/params_one_comma.carbon @@ -14,22 +14,26 @@ fn Main() { // CHECK:STDOUT: --- params_one_comma.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Foo = %Foo -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Foo = %Foo.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc7_8.1: i32 = param a // CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { @@ -39,11 +43,11 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref.loc10: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc10: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %Foo.ref.loc10: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc10: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %Foo.call.loc10: init () = call %Foo.ref.loc10(%.loc10) -// CHECK:STDOUT: %Foo.ref.loc11: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc11: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %Foo.ref.loc11: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc11: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %Foo.call.loc11: init () = call %Foo.ref.loc11(%.loc11) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/params_two.carbon b/toolchain/check/testdata/function/call/params_two.carbon index 5f339f1df650..991ec5e59ca6 100644 --- a/toolchain/check/testdata/function/call/params_two.carbon +++ b/toolchain/check/testdata/function/call/params_two.carbon @@ -13,25 +13,29 @@ fn Main() { // CHECK:STDOUT: --- params_two.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Foo = %Foo -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Foo = %Foo.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { @@ -41,9 +45,9 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc10_7, %.loc10_10) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/params_two_comma.carbon b/toolchain/check/testdata/function/call/params_two_comma.carbon index cb26a12bc8d5..bf04c4e239cd 100644 --- a/toolchain/check/testdata/function/call/params_two_comma.carbon +++ b/toolchain/check/testdata/function/call/params_two_comma.carbon @@ -14,25 +14,29 @@ fn Main() { // CHECK:STDOUT: --- params_two_comma.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Foo = %Foo -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Foo = %Foo.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { @@ -42,13 +46,13 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref.loc10: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %Foo.ref.loc10: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %Foo.call.loc10: init () = call %Foo.ref.loc10(%.loc10_7, %.loc10_10) -// CHECK:STDOUT: %Foo.ref.loc11: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_10: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %Foo.ref.loc11: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_10: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %Foo.call.loc11: init () = call %Foo.ref.loc11(%.loc11_7, %.loc11_10) // CHECK:STDOUT: return // CHECK:STDOUT: } 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 c14e32c51191..6da21485a715 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon @@ -11,13 +11,19 @@ fn F(n: i32, a: [i32; n]*); // CHECK:STDOUT: --- fail_param_in_type.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // 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 diff --git a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon index f91953161f94..f93df2a21838 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon @@ -14,13 +14,19 @@ fn F(n: i32, n: i32); // CHECK:STDOUT: --- fail_param_redecl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // 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 diff --git a/toolchain/check/testdata/function/declaration/import.carbon b/toolchain/check/testdata/function/declaration/import.carbon index 10fe4b9caf4f..a93ad71ef521 100644 --- a/toolchain/check/testdata/function/declaration/import.carbon +++ b/toolchain/check/testdata/function/declaration/import.carbon @@ -387,40 +387,51 @@ import library "extern_api"; // CHECK:STDOUT: --- api.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %.2: type = tuple_type (type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %E: type = fn_type @E [template] +// CHECK:STDOUT: %struct.5: E = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .B = %B -// CHECK:STDOUT: .C = %C -// CHECK:STDOUT: .D = %D +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .B = %B.decl +// CHECK:STDOUT: .C = %C.decl +// CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .NS = %NS // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} -// CHECK:STDOUT: %B: = fn_decl @B [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: %b.loc5_6.1: i32 = param b // CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_6.1 // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C: = fn_decl @C [template] { +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { // 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: %.loc6_14.2: type = converted %.loc6_14.1, constants.%.3 [template = constants.%.3] // 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: %.loc6_28: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: @C.%return: ref {.c: i32} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %D: = fn_decl @D [template] {} +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {} // CHECK:STDOUT: %NS: = namespace [template] { -// CHECK:STDOUT: .E = %E +// CHECK:STDOUT: .E = %E.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %E: = fn_decl @E [template] {} +// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); @@ -436,40 +447,51 @@ import library "extern_api"; // CHECK:STDOUT: --- extern_api.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %.2: type = tuple_type (type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %E: type = fn_type @E [template] +// CHECK:STDOUT: %struct.5: E = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .B = %B -// CHECK:STDOUT: .C = %C -// CHECK:STDOUT: .D = %D +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .B = %B.decl +// CHECK:STDOUT: .C = %C.decl +// CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .NS = %NS // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} -// CHECK:STDOUT: %B: = fn_decl @B [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: %b.loc5_13.1: i32 = param b // CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_13.1 // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C: = fn_decl @C [template] { +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { // CHECK:STDOUT: %.loc6_21.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc6_21.2: type = converted %.loc6_21.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc6_21.2: type = converted %.loc6_21.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %c.loc6_13.1: (i32,) = param c // CHECK:STDOUT: @C.%c: (i32,) = bind_name c, %c.loc6_13.1 -// CHECK:STDOUT: %.loc6_35: type = struct_type {.c: i32} [template = constants.%.3] +// CHECK:STDOUT: %.loc6_35: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: @C.%return: ref {.c: i32} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %D: = fn_decl @D [template] {} +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {} // CHECK:STDOUT: %NS: = namespace [template] { -// CHECK:STDOUT: .E = %E +// CHECK:STDOUT: .E = %E.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %E: = fn_decl @E [template] {} +// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A(); @@ -486,10 +508,20 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %.4: type = tuple_type (i32) [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.2) [template] +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %E: type = fn_type @E [template] +// CHECK:STDOUT: %struct.5: E = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -506,15 +538,15 @@ import library "extern_api"; // CHECK:STDOUT: .d = %d // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loc_15 [template = imports.%A] -// CHECK:STDOUT: %import_ref.2: = import_ref ir1, inst+6, loc_24 [template = imports.%B] -// CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+18, loc_39 [template = imports.%C] -// CHECK:STDOUT: %import_ref.4: = import_ref ir1, inst+19, loc_53 [template = imports.%D] -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+20, loaded +// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_15 [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loc_24 [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loc_39 [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loc_53 [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6: = import_ref ir1, inst+21, loc_65 [template = imports.%E] +// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loc_65 [template = constants.%struct.5] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc6_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1] @@ -547,25 +579,25 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call -// CHECK:STDOUT: %B.ref: = name_ref B, file.%import_ref.2 [template = imports.%B] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2] // CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc7) // CHECK:STDOUT: assign file.%b.var, %B.call -// CHECK:STDOUT: %C.ref: = name_ref C, file.%import_ref.3 [template = imports.%C] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3] // CHECK:STDOUT: %.loc8_23: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc8_25: (i32,) = tuple_literal (%.loc8_23) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc8_23) [template = constants.%tuple] // CHECK:STDOUT: %.loc8_21: (i32,) = converted %.loc8_25, %tuple [template = constants.%tuple] // CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc8_21) // CHECK:STDOUT: assign file.%c.var, %C.call -// CHECK:STDOUT: %D.ref: = name_ref D, file.%import_ref.4 [template = imports.%D] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.4] // CHECK:STDOUT: %D.call: init () = call %D.ref() // CHECK:STDOUT: assign file.%d.var, %D.call // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %E.ref: = name_ref E, file.%import_ref.6 [template = imports.%E] +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.5] // CHECK:STDOUT: %E.call: init () = call %E.ref() // CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return @@ -574,10 +606,20 @@ import library "extern_api"; // CHECK:STDOUT: --- redecl_api.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %.2: type = tuple_type (type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %E: type = fn_type @E [template] +// CHECK:STDOUT: %struct.5: E = struct_value () [template] // CHECK:STDOUT: %.5: i32 = int_literal 1 [template] // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.5) [template] // CHECK:STDOUT: } @@ -586,57 +628,57 @@ import library "extern_api"; // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .NS = %NS // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .B = %B -// CHECK:STDOUT: .C = %C -// CHECK:STDOUT: .D = %D +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .B = %B.decl +// CHECK:STDOUT: .C = %C.decl +// CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .a = %a // CHECK:STDOUT: .b = %b.loc13 // CHECK:STDOUT: .c = %c.loc14 // CHECK:STDOUT: .d = %d // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loaded [template = imports.%A] -// CHECK:STDOUT: %import_ref.2: = import_ref ir1, inst+6, loaded [template = imports.%B] -// CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+18, loaded [template = imports.%C] -// CHECK:STDOUT: %import_ref.4: = import_ref ir1, inst+19, loaded [template = imports.%D] -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+20, loaded +// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { -// CHECK:STDOUT: .E = %E +// CHECK:STDOUT: .E = %E.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6: = import_ref ir1, inst+21, loaded [template = imports.%E] +// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loaded [template = constants.%struct.5] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} -// CHECK:STDOUT: %B: = fn_decl @B [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: %b.loc7_13.1: i32 = param b // CHECK:STDOUT: %b.loc7_13.2: i32 = bind_name b, %b.loc7_13.1 // CHECK:STDOUT: %return.var.loc7: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C: = fn_decl @C [template] { +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { // CHECK:STDOUT: %.loc8_21.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc8_21.2: type = converted %.loc8_21.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_21.2: type = converted %.loc8_21.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %c.loc8_13.1: (i32,) = param c // CHECK:STDOUT: %c.loc8_13.2: (i32,) = bind_name c, %c.loc8_13.1 -// CHECK:STDOUT: %.loc8_35: type = struct_type {.c: i32} [template = constants.%.3] +// CHECK:STDOUT: %.loc8_35: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: %return.var.loc8: ref {.c: i32} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %D: = fn_decl @D [template] {} -// CHECK:STDOUT: %E: = fn_decl @E [template] {} +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {} +// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {} // CHECK:STDOUT: %.loc12_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b.loc13: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %.loc14: type = struct_type {.c: i32} [template = constants.%.3] +// CHECK:STDOUT: %.loc14: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: %c.var: ref {.c: i32} = var c // CHECK:STDOUT: %c.loc14: ref {.c: i32} = bind_name c, %c.var // CHECK:STDOUT: %.loc15_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc15_9.2: type = converted %.loc15_9.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc15_9.2: type = converted %.loc15_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %d.var: ref () = var d // CHECK:STDOUT: %d: ref () = bind_name d, %d.var // CHECK:STDOUT: %.loc16_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %e.var: ref () = var e // CHECK:STDOUT: %e: ref () = bind_name e, %e.var // CHECK:STDOUT: } @@ -653,25 +695,25 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc13) // CHECK:STDOUT: assign file.%b.var, %B.call -// CHECK:STDOUT: %C.ref: = name_ref C, file.%C [template = file.%C] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc14_23: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc14_25: (i32,) = tuple_literal (%.loc14_23) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc14_23) [template = constants.%tuple] // CHECK:STDOUT: %.loc14_21: (i32,) = converted %.loc14_25, %tuple [template = constants.%tuple] // CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc14_21) // CHECK:STDOUT: assign file.%c.var, %C.call -// CHECK:STDOUT: %D.ref: = name_ref D, file.%D [template = file.%D] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.4] // CHECK:STDOUT: %D.call: init () = call %D.ref() // CHECK:STDOUT: assign file.%d.var, %D.call // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %E.ref: = name_ref E, file.%E [template = file.%E] +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.5] // CHECK:STDOUT: %E.call: init () = call %E.ref() // CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return @@ -680,10 +722,20 @@ import library "extern_api"; // CHECK:STDOUT: --- redecl_extern_api.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %.2: type = tuple_type (type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %E: type = fn_type @E [template] +// CHECK:STDOUT: %struct.5: E = struct_value () [template] // CHECK:STDOUT: %.5: i32 = int_literal 1 [template] // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.5) [template] // CHECK:STDOUT: } @@ -692,57 +744,57 @@ import library "extern_api"; // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .NS = %NS // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .B = %B -// CHECK:STDOUT: .C = %C -// CHECK:STDOUT: .D = %D +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .B = %B.decl +// CHECK:STDOUT: .C = %C.decl +// CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .a = %a // CHECK:STDOUT: .b = %b.loc13 // CHECK:STDOUT: .c = %c.loc14 // CHECK:STDOUT: .d = %d // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loaded [template = imports.%A] -// CHECK:STDOUT: %import_ref.2: = import_ref ir1, inst+6, loaded [template = imports.%B] -// CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+18, loaded [template = imports.%C] -// CHECK:STDOUT: %import_ref.4: = import_ref ir1, inst+19, loaded [template = imports.%D] -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+20, loaded +// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loaded [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loaded [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { -// CHECK:STDOUT: .E = %E +// CHECK:STDOUT: .E = %E.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6: = import_ref ir1, inst+21, loaded [template = imports.%E] +// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loaded [template = constants.%struct.5] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} -// CHECK:STDOUT: %B: = fn_decl @B [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: %b.loc7_13.1: i32 = param b // CHECK:STDOUT: %b.loc7_13.2: i32 = bind_name b, %b.loc7_13.1 // CHECK:STDOUT: %return.var.loc7: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C: = fn_decl @C [template] { +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { // CHECK:STDOUT: %.loc8_21.1: (type,) = tuple_literal (i32) -// CHECK:STDOUT: %.loc8_21.2: type = converted %.loc8_21.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_21.2: type = converted %.loc8_21.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %c.loc8_13.1: (i32,) = param c // CHECK:STDOUT: %c.loc8_13.2: (i32,) = bind_name c, %c.loc8_13.1 -// CHECK:STDOUT: %.loc8_35: type = struct_type {.c: i32} [template = constants.%.3] +// CHECK:STDOUT: %.loc8_35: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: %return.var.loc8: ref {.c: i32} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %D: = fn_decl @D [template] {} -// CHECK:STDOUT: %E: = fn_decl @E [template] {} +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {} +// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] {} // CHECK:STDOUT: %.loc12_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b.loc13: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %.loc14: type = struct_type {.c: i32} [template = constants.%.3] +// CHECK:STDOUT: %.loc14: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: %c.var: ref {.c: i32} = var c // CHECK:STDOUT: %c.loc14: ref {.c: i32} = bind_name c, %c.var // CHECK:STDOUT: %.loc15_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc15_9.2: type = converted %.loc15_9.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc15_9.2: type = converted %.loc15_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %d.var: ref () = var d // CHECK:STDOUT: %d: ref () = bind_name d, %d.var // CHECK:STDOUT: %.loc16_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %e.var: ref () = var e // CHECK:STDOUT: %e: ref () = bind_name e, %e.var // CHECK:STDOUT: } @@ -759,25 +811,25 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] // CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc13) // CHECK:STDOUT: assign file.%b.var, %B.call -// CHECK:STDOUT: %C.ref: = name_ref C, file.%C [template = file.%C] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.3] // CHECK:STDOUT: %.loc14_23: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc14_25: (i32,) = tuple_literal (%.loc14_23) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc14_23) [template = constants.%tuple] // CHECK:STDOUT: %.loc14_21: (i32,) = converted %.loc14_25, %tuple [template = constants.%tuple] // CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc14_21) // CHECK:STDOUT: assign file.%c.var, %C.call -// CHECK:STDOUT: %D.ref: = name_ref D, file.%D [template = file.%D] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.4] // CHECK:STDOUT: %D.call: init () = call %D.ref() // CHECK:STDOUT: assign file.%d.var, %D.call // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %E.ref: = name_ref E, file.%E [template = file.%E] +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.5] // CHECK:STDOUT: %E.call: init () = call %E.ref() // CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return @@ -787,10 +839,20 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %.4: type = tuple_type (i32) [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.2) [template] +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %E: type = fn_type @E [template] +// CHECK:STDOUT: %struct.5: E = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -807,20 +869,20 @@ import library "extern_api"; // CHECK:STDOUT: .d = %d // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loc_19 [template = imports.%A] -// CHECK:STDOUT: %import_ref.2: = import_ref ir1, inst+6, loc_28 [template = imports.%B] -// CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+18, loc_43 [template = imports.%C] -// CHECK:STDOUT: %import_ref.4: = import_ref ir1, inst+19, loc_57 [template = imports.%D] -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+20, loaded +// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_19 [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loc_28 [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loc_43 [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loc_57 [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6: = import_ref ir1, inst+21, loc_69 [template = imports.%E] +// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loc_69 [template = constants.%struct.5] // CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+2, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+6, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+18, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+21, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+9, unloaded +// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+23, unloaded +// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+26, unloaded +// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+30, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc72_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc72_9.2: type = converted %.loc72_9.1, constants.%.1 [template = constants.%.1] @@ -853,25 +915,25 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call -// CHECK:STDOUT: %B.ref: = name_ref B, file.%import_ref.2 [template = imports.%B] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2] // CHECK:STDOUT: %.loc73: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc73) // CHECK:STDOUT: assign file.%b.var, %B.call -// CHECK:STDOUT: %C.ref: = name_ref C, file.%import_ref.3 [template = imports.%C] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3] // CHECK:STDOUT: %.loc74_23: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc74_25: (i32,) = tuple_literal (%.loc74_23) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc74_23) [template = constants.%tuple] // CHECK:STDOUT: %.loc74_21: (i32,) = converted %.loc74_25, %tuple [template = constants.%tuple] // CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc74_21) // CHECK:STDOUT: assign file.%c.var, %C.call -// CHECK:STDOUT: %D.ref: = name_ref D, file.%import_ref.4 [template = imports.%D] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.4] // CHECK:STDOUT: %D.call: init () = call %D.ref() // CHECK:STDOUT: assign file.%d.var, %D.call // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %E.ref: = name_ref E, file.%import_ref.6 [template = imports.%E] +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.5] // CHECK:STDOUT: %E.call: init () = call %E.ref() // CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return @@ -881,10 +943,20 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %.4: type = tuple_type (i32) [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.2) [template] +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %E: type = fn_type @E [template] +// CHECK:STDOUT: %struct.5: E = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -901,20 +973,20 @@ import library "extern_api"; // CHECK:STDOUT: .d = %d // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loc_19 [template = imports.%A] -// CHECK:STDOUT: %import_ref.2: = import_ref ir1, inst+6, loc_28 [template = imports.%B] -// CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+18, loc_43 [template = imports.%C] -// CHECK:STDOUT: %import_ref.4: = import_ref ir1, inst+19, loc_57 [template = imports.%D] -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+20, loaded +// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_19 [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+9, loc_28 [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+23, loc_43 [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+26, loc_57 [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6: = import_ref ir1, inst+21, loc_69 [template = imports.%E] +// CHECK:STDOUT: %import_ref.6: E = import_ref ir1, inst+30, loc_69 [template = constants.%struct.5] // CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+2, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+6, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+18, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+21, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+9, unloaded +// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+23, unloaded +// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+26, unloaded +// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+30, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc72_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc72_9.2: type = converted %.loc72_9.1, constants.%.1 [template = constants.%.1] @@ -947,25 +1019,25 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call -// CHECK:STDOUT: %B.ref: = name_ref B, file.%import_ref.2 [template = imports.%B] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2] // CHECK:STDOUT: %.loc73: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc73) // CHECK:STDOUT: assign file.%b.var, %B.call -// CHECK:STDOUT: %C.ref: = name_ref C, file.%import_ref.3 [template = imports.%C] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3] // CHECK:STDOUT: %.loc74_23: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc74_25: (i32,) = tuple_literal (%.loc74_23) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc74_23) [template = constants.%tuple] // CHECK:STDOUT: %.loc74_21: (i32,) = converted %.loc74_25, %tuple [template = constants.%tuple] // CHECK:STDOUT: %C.call: init {.c: i32} = call %C.ref(%.loc74_21) // CHECK:STDOUT: assign file.%c.var, %C.call -// CHECK:STDOUT: %D.ref: = name_ref D, file.%import_ref.4 [template = imports.%D] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct.4] // CHECK:STDOUT: %D.call: init () = call %D.ref() // CHECK:STDOUT: assign file.%d.var, %D.call // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %E.ref: = name_ref E, file.%import_ref.6 [template = imports.%E] +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%import_ref.6 [template = constants.%struct.5] // CHECK:STDOUT: %E.call: init () = call %E.ref() // CHECK:STDOUT: assign file.%e.var, %E.call // CHECK:STDOUT: return @@ -975,6 +1047,8 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -985,30 +1059,30 @@ import library "extern_api"; // CHECK:STDOUT: .NS = %NS // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .a = %a -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loc_15 [template = imports.%A] -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+6, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+20, loaded +// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_15 [template = constants.%struct] +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc6_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: return @@ -1018,6 +1092,10 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %.2: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.2: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1030,21 +1108,21 @@ import library "extern_api"; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loc_15 [template = imports.%A] -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+6, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+20, loaded +// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_15 [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc6_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var -// CHECK:STDOUT: %.loc25: = fn_decl @.1 [template] { +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] { // CHECK:STDOUT: @.1.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1055,7 +1133,7 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: return @@ -1065,6 +1143,8 @@ import library "extern_api"; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1075,30 +1155,30 @@ import library "extern_api"; // CHECK:STDOUT: .NS = %NS // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .a = %a -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loc_15 [template = imports.%A] -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+6, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+20, loaded +// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_15 [template = constants.%struct] +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc6_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: return @@ -1116,14 +1196,14 @@ import library "extern_api"; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+6, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+20, loaded +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1139,14 +1219,14 @@ import library "extern_api"; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+6, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+20, loaded +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1162,19 +1242,19 @@ import library "extern_api"; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+6, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+20, loaded +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+9, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+23, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+26, unloaded +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+29, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.5, [template] { // CHECK:STDOUT: .E = %import_ref.6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+30, unloaded // CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+2, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+6, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+18, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+21, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+9, unloaded +// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+23, unloaded +// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+26, unloaded +// CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+30, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/no_prelude/extern.carbon b/toolchain/check/testdata/function/declaration/no_prelude/extern.carbon index e2854b591b57..6a9de2602d10 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/extern.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/extern.carbon @@ -54,35 +54,53 @@ class C { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @F(); // CHECK:STDOUT: // CHECK:STDOUT: --- fail_redecl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F.loc4 +// CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.loc4: = fn_decl @F [template] {} -// CHECK:STDOUT: %F.loc12: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl.loc4: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl.loc12: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @F(); // CHECK:STDOUT: // CHECK:STDOUT: --- fail_redecl_extern.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F.loc12 +// CHECK:STDOUT: .F = %F.decl.loc12 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.loc4: = fn_decl @F [template] {} -// CHECK:STDOUT: %F.loc12: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl.loc4: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl.loc12: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); @@ -91,7 +109,12 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -102,8 +125,8 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %F: = fn_decl @F [template] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C] // CHECK:STDOUT: %self.loc11_15.1: C = param self // CHECK:STDOUT: %self.loc11_15.2: C = bind_name self, %self.loc11_15.1 @@ -111,8 +134,8 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); diff --git a/toolchain/check/testdata/function/declaration/no_prelude/fail_import_incomplete_return.carbon b/toolchain/check/testdata/function/declaration/no_prelude/fail_import_incomplete_return.carbon index 61ba866fe6d5..f8df41c763f1 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/fail_import_incomplete_return.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/fail_import_incomplete_return.carbon @@ -76,38 +76,49 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %D: type = class_type @D [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %ReturnCUnused: type = fn_type @ReturnCUnused [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: ReturnCUnused = struct_value () [template] +// CHECK:STDOUT: %ReturnCUsed: type = fn_type @ReturnCUsed [template] +// CHECK:STDOUT: %struct.2: ReturnCUsed = struct_value () [template] +// CHECK:STDOUT: %ReturnDUnused: type = fn_type @ReturnDUnused [template] +// CHECK:STDOUT: %struct.3: ReturnDUnused = struct_value () [template] +// CHECK:STDOUT: %ReturnDUsed: type = fn_type @ReturnDUsed [template] +// CHECK:STDOUT: %struct.4: ReturnDUsed = struct_value () [template] +// CHECK:STDOUT: %Call: type = fn_type @Call [template] +// CHECK:STDOUT: %struct.5: Call = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl.loc5 -// CHECK:STDOUT: .ReturnCUnused = %ReturnCUnused -// CHECK:STDOUT: .ReturnCUsed = %ReturnCUsed -// CHECK:STDOUT: .ReturnDUnused = %ReturnDUnused -// CHECK:STDOUT: .ReturnDUsed = %ReturnDUsed -// CHECK:STDOUT: .Call = %Call +// CHECK:STDOUT: .ReturnCUnused = %ReturnCUnused.decl +// CHECK:STDOUT: .ReturnCUsed = %ReturnCUsed.decl +// CHECK:STDOUT: .ReturnDUnused = %ReturnDUnused.decl +// CHECK:STDOUT: .ReturnDUsed = %ReturnDUsed.decl +// CHECK:STDOUT: .Call = %Call.decl // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %D.decl.loc5: type = class_decl @D [template = constants.%D] {} -// CHECK:STDOUT: %ReturnCUnused: = fn_decl @ReturnCUnused [template] { +// CHECK:STDOUT: %ReturnCUnused.decl: ReturnCUnused = fn_decl @ReturnCUnused [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc7: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @ReturnCUnused.%return: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ReturnCUsed: = fn_decl @ReturnCUsed [template] { +// CHECK:STDOUT: %ReturnCUsed.decl: ReturnCUsed = fn_decl @ReturnCUsed [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @ReturnCUsed.%return: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ReturnDUnused: = fn_decl @ReturnDUnused [template] { +// CHECK:STDOUT: %ReturnDUnused.decl: ReturnDUnused = fn_decl @ReturnDUnused [template = constants.%struct.3] { // CHECK:STDOUT: %D.ref.loc9: type = name_ref D, %D.decl.loc5 [template = constants.%D] // CHECK:STDOUT: @ReturnDUnused.%return: ref D = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ReturnDUsed: = fn_decl @ReturnDUsed [template] { +// CHECK:STDOUT: %ReturnDUsed.decl: ReturnDUsed = fn_decl @ReturnDUsed [template = constants.%struct.4] { // CHECK:STDOUT: %D.ref.loc10: type = name_ref D, %D.decl.loc5 [template = constants.%D] // CHECK:STDOUT: @ReturnDUsed.%return: ref D = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Call: = fn_decl @Call [template] {} +// CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.5] {} // CHECK:STDOUT: %D.decl.loc37: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -128,9 +139,9 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Call() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %ReturnCUsed.ref: = name_ref ReturnCUsed, file.%ReturnCUsed [template = file.%ReturnCUsed] +// CHECK:STDOUT: %ReturnCUsed.ref: ReturnCUsed = name_ref ReturnCUsed, file.%ReturnCUsed.decl [template = constants.%struct.2] // CHECK:STDOUT: %ReturnCUsed.call: init = call %ReturnCUsed.ref() -// CHECK:STDOUT: %ReturnDUsed.ref: = name_ref ReturnDUsed, file.%ReturnDUsed [template = file.%ReturnDUsed] +// CHECK:STDOUT: %ReturnDUsed.ref: ReturnDUsed = name_ref ReturnDUsed, file.%ReturnDUsed.decl [template = constants.%struct.4] // CHECK:STDOUT: %ReturnDUsed.call: init = call %ReturnDUsed.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -138,11 +149,21 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: --- fail_use_imported.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %CallFAndGIncomplete: type = fn_type @CallFAndGIncomplete [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: CallFAndGIncomplete = struct_value () [template] // CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %ReturnCUnused: type = fn_type @ReturnCUnused [template] +// CHECK:STDOUT: %struct.2: ReturnCUnused = struct_value () [template] +// CHECK:STDOUT: %ReturnCUsed: type = fn_type @ReturnCUsed [template] +// CHECK:STDOUT: %struct.3: ReturnCUsed = struct_value () [template] // CHECK:STDOUT: %D: type = class_type @D [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %ReturnDUnused: type = fn_type @ReturnDUnused [template] +// CHECK:STDOUT: %struct.4: ReturnDUnused = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] +// CHECK:STDOUT: %ReturnDUsed: type = fn_type @ReturnDUsed [template] +// CHECK:STDOUT: %struct.5: ReturnDUsed = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -154,16 +175,16 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: .ReturnDUnused = %import_ref.5 // CHECK:STDOUT: .ReturnDUsed = %import_ref.6 // CHECK:STDOUT: .Call = %import_ref.7 -// CHECK:STDOUT: .CallFAndGIncomplete = %CallFAndGIncomplete +// CHECK:STDOUT: .CallFAndGIncomplete = %CallFAndGIncomplete.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+1, unloaded // CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+3, unloaded -// CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+7, loc_14 [template = imports.%ReturnCUnused] -// CHECK:STDOUT: %import_ref.4: = import_ref ir1, inst+10, loc_18 [template = imports.%ReturnCUsed] -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+13, loc_22 [template = imports.%ReturnDUnused] -// CHECK:STDOUT: %import_ref.6: = import_ref ir1, inst+16, loc_26 [template = imports.%ReturnDUsed] -// CHECK:STDOUT: %import_ref.7 = import_ref ir1, inst+17, unloaded -// CHECK:STDOUT: %CallFAndGIncomplete: = fn_decl @CallFAndGIncomplete [template] {} +// CHECK:STDOUT: %import_ref.3: ReturnCUnused = import_ref ir1, inst+7, loc_14 [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.4: ReturnCUsed = import_ref ir1, inst+13, loc_18 [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.5: ReturnDUnused = import_ref ir1, inst+18, loc_22 [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.6: ReturnDUsed = import_ref ir1, inst+23, loc_26 [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.7 = import_ref ir1, inst+26, unloaded +// CHECK:STDOUT: %CallFAndGIncomplete.decl: CallFAndGIncomplete = fn_decl @CallFAndGIncomplete [template = constants.%struct.1] {} // CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+4, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: @@ -177,16 +198,16 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: fn @CallFAndGIncomplete() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %ReturnCUnused.ref: = name_ref ReturnCUnused, file.%import_ref.3 [template = imports.%ReturnCUnused] +// CHECK:STDOUT: %ReturnCUnused.ref: ReturnCUnused = name_ref ReturnCUnused, file.%import_ref.3 [template = constants.%struct.2] // CHECK:STDOUT: %ReturnCUnused.call: init = call %ReturnCUnused.ref() -// CHECK:STDOUT: %ReturnCUsed.ref: = name_ref ReturnCUsed, file.%import_ref.4 [template = imports.%ReturnCUsed] +// CHECK:STDOUT: %ReturnCUsed.ref: ReturnCUsed = name_ref ReturnCUsed, file.%import_ref.4 [template = constants.%struct.3] // CHECK:STDOUT: %ReturnCUsed.call: init = call %ReturnCUsed.ref() // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} -// CHECK:STDOUT: %ReturnDUnused.ref: = name_ref ReturnDUnused, file.%import_ref.5 [template = imports.%ReturnDUnused] +// CHECK:STDOUT: %ReturnDUnused.ref: ReturnDUnused = name_ref ReturnDUnused, file.%import_ref.5 [template = constants.%struct.4] // CHECK:STDOUT: %.loc24_16.1: ref D = temporary_storage // CHECK:STDOUT: %ReturnDUnused.call: init D = call %ReturnDUnused.ref() to %.loc24_16.1 // CHECK:STDOUT: %.loc24_16.2: ref D = temporary %.loc24_16.1, %ReturnDUnused.call -// CHECK:STDOUT: %ReturnDUsed.ref: = name_ref ReturnDUsed, file.%import_ref.6 [template = imports.%ReturnDUsed] +// CHECK:STDOUT: %ReturnDUsed.ref: ReturnDUsed = name_ref ReturnDUsed, file.%import_ref.6 [template = constants.%struct.5] // CHECK:STDOUT: %ReturnDUsed.call: init = call %ReturnDUsed.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/declaration/no_prelude/fail_modifiers.carbon b/toolchain/check/testdata/function/declaration/no_prelude/fail_modifiers.carbon index 13199a828878..9140b534562c 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/fail_modifiers.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/fail_modifiers.carbon @@ -96,23 +96,41 @@ extern private fn ExternOrderAndConflict() {} // CHECK:STDOUT: --- fail_modifiers.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %WrongOrder: type = fn_type @WrongOrder [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: WrongOrder = struct_value () [template] +// CHECK:STDOUT: %DuplicateVirtual: type = fn_type @DuplicateVirtual [template] +// CHECK:STDOUT: %struct.2: DuplicateVirtual = struct_value () [template] +// CHECK:STDOUT: %TwoAccess: type = fn_type @TwoAccess [template] +// CHECK:STDOUT: %struct.3: TwoAccess = struct_value () [template] +// CHECK:STDOUT: %ModifiersConflict: type = fn_type @ModifiersConflict [template] +// CHECK:STDOUT: %struct.4: ModifiersConflict = struct_value () [template] +// CHECK:STDOUT: %InvalidModifier: type = fn_type @InvalidModifier [template] +// CHECK:STDOUT: %struct.5: InvalidModifier = struct_value () [template] +// CHECK:STDOUT: %ModifiersConflict2: type = fn_type @ModifiersConflict2 [template] +// CHECK:STDOUT: %struct.6: ModifiersConflict2 = struct_value () [template] +// CHECK:STDOUT: %ExternOrderAndConflict: type = fn_type @ExternOrderAndConflict [template] +// CHECK:STDOUT: %struct.7: ExternOrderAndConflict = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .WrongOrder = %WrongOrder -// CHECK:STDOUT: .DuplicateVirtual = %DuplicateVirtual -// CHECK:STDOUT: .TwoAccess = %TwoAccess -// CHECK:STDOUT: .ModifiersConflict = %ModifiersConflict -// CHECK:STDOUT: .InvalidModifier = %InvalidModifier -// CHECK:STDOUT: .ModifiersConflict2 = %ModifiersConflict2 -// CHECK:STDOUT: .ExternOrderAndConflict = %ExternOrderAndConflict +// CHECK:STDOUT: .WrongOrder = %WrongOrder.decl +// CHECK:STDOUT: .DuplicateVirtual = %DuplicateVirtual.decl +// CHECK:STDOUT: .TwoAccess = %TwoAccess.decl +// CHECK:STDOUT: .ModifiersConflict = %ModifiersConflict.decl +// CHECK:STDOUT: .InvalidModifier = %InvalidModifier.decl +// CHECK:STDOUT: .ModifiersConflict2 = %ModifiersConflict2.decl +// CHECK:STDOUT: .ExternOrderAndConflict = %ExternOrderAndConflict.decl // CHECK:STDOUT: } -// 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: %ExternOrderAndConflict: = fn_decl @ExternOrderAndConflict [template] {} +// CHECK:STDOUT: %WrongOrder.decl: WrongOrder = fn_decl @WrongOrder [template = constants.%struct.1] {} +// CHECK:STDOUT: %DuplicateVirtual.decl: DuplicateVirtual = fn_decl @DuplicateVirtual [template = constants.%struct.2] {} +// CHECK:STDOUT: %TwoAccess.decl: TwoAccess = fn_decl @TwoAccess [template = constants.%struct.3] {} +// CHECK:STDOUT: %ModifiersConflict.decl: ModifiersConflict = fn_decl @ModifiersConflict [template = constants.%struct.4] {} +// CHECK:STDOUT: %InvalidModifier.decl: InvalidModifier = fn_decl @InvalidModifier [template = constants.%struct.5] {} +// CHECK:STDOUT: %ModifiersConflict2.decl: ModifiersConflict2 = fn_decl @ModifiersConflict2 [template = constants.%struct.6] {} +// CHECK:STDOUT: %ExternOrderAndConflict.decl: ExternOrderAndConflict = fn_decl @ExternOrderAndConflict [template = constants.%struct.7] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @WrongOrder(); diff --git a/toolchain/check/testdata/function/declaration/no_prelude/fail_redecl.carbon b/toolchain/check/testdata/function/declaration/no_prelude/fail_redecl.carbon index 443068d965a1..0af1e14588aa 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/fail_redecl.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/fail_redecl.carbon @@ -56,42 +56,54 @@ fn E() {} // CHECK:STDOUT: --- fail_redecl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %.2: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.4: = struct_value () [template] +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %struct.5: D = struct_value () [template] +// CHECK:STDOUT: %E: type = fn_type @E [template] +// CHECK:STDOUT: %struct.6: E = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A.loc7 -// CHECK:STDOUT: .B = %B.loc17 -// CHECK:STDOUT: .C = %C -// CHECK:STDOUT: .D = %D.loc37 -// CHECK:STDOUT: .E = %E.loc47 +// CHECK:STDOUT: .A = %A.decl.loc7 +// CHECK:STDOUT: .B = %B.decl.loc17 +// CHECK:STDOUT: .C = %C.decl +// CHECK:STDOUT: .D = %D.decl.loc37 +// CHECK:STDOUT: .E = %E.decl.loc47 // CHECK:STDOUT: } -// CHECK:STDOUT: %A.loc7: = fn_decl @A [template] {} -// CHECK:STDOUT: %A.loc15: = fn_decl @A [template] {} -// CHECK:STDOUT: %B.loc17: = fn_decl @B [template] { +// CHECK:STDOUT: %A.decl.loc7: A = fn_decl @A [template = constants.%struct.1] {} +// CHECK:STDOUT: %A.decl.loc15: A = fn_decl @A [template = constants.%struct.1] {} +// CHECK:STDOUT: %B.decl.loc17: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: %.loc17_10.1: () = tuple_literal () // CHECK:STDOUT: %.loc17_10.2: type = converted %.loc17_10.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.loc17_6.1: () = param x // CHECK:STDOUT: @B.%x: () = bind_name x, %x.loc17_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %B.loc25: = fn_decl @B [template] { +// CHECK:STDOUT: %B.decl.loc25: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: %.loc25_10.1: () = tuple_literal () // CHECK:STDOUT: %.loc25_10.2: type = converted %.loc25_10.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.loc25_6.1: () = param x // CHECK:STDOUT: %x.loc25_6.2: () = bind_name x, %x.loc25_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %C: = fn_decl @C [template] {} -// CHECK:STDOUT: %.loc35_12: = fn_decl @.1 [template] { +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] {} +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.4] { // CHECK:STDOUT: %.loc35_10.1: () = tuple_literal () // CHECK:STDOUT: %.loc35_10.2: type = converted %.loc35_10.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.loc35_6.1: () = param x // CHECK:STDOUT: @.1.%x: () = bind_name x, %x.loc35_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %D.loc37: = fn_decl @D [template] {} -// CHECK:STDOUT: %D.loc45: = fn_decl @D [template] {} -// CHECK:STDOUT: %E.loc47: = fn_decl @E [template] {} -// CHECK:STDOUT: %E.loc54: = fn_decl @E [template] {} +// CHECK:STDOUT: %D.decl.loc37: D = fn_decl @D [template = constants.%struct.5] {} +// CHECK:STDOUT: %D.decl.loc45: D = fn_decl @D [template = constants.%struct.5] {} +// CHECK:STDOUT: %E.decl.loc47: E = fn_decl @E [template = constants.%struct.6] {} +// CHECK:STDOUT: %E.decl.loc54: E = fn_decl @E [template = constants.%struct.6] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); diff --git a/toolchain/check/testdata/function/declaration/no_prelude/fail_todo_modifiers.carbon b/toolchain/check/testdata/function/declaration/no_prelude/fail_todo_modifiers.carbon index 68bd6715c9a7..05e8857eca68 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/fail_todo_modifiers.carbon @@ -11,11 +11,17 @@ private fn F(); // CHECK:STDOUT: --- fail_todo_modifiers.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); diff --git a/toolchain/check/testdata/function/declaration/no_prelude/implicit_import.carbon b/toolchain/check/testdata/function/declaration/no_prelude/implicit_import.carbon index 4cdf55af801d..0591331a0558 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/implicit_import.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/implicit_import.carbon @@ -61,69 +61,105 @@ extern fn A(); // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: // CHECK:STDOUT: --- basic.impl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir0, inst+1, loaded [template = imports.%A] -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %import_ref: A = import_ref ir0, inst+1, loaded [template = constants.%struct] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: // CHECK:STDOUT: --- extern_api.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A(); // CHECK:STDOUT: // CHECK:STDOUT: --- fail_extern_api.impl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir0, inst+1, loaded [template = imports.%A] -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %import_ref: A = import_ref ir0, inst+1, loaded [template = constants.%struct] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: // CHECK:STDOUT: --- extern_impl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: // CHECK:STDOUT: --- fail_extern_impl.impl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir0, inst+1, loaded [template = imports.%A] -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %import_ref: A = import_ref ir0, inst+1, loaded [template = constants.%struct] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A(); diff --git a/toolchain/check/testdata/function/declaration/no_prelude/simple.carbon b/toolchain/check/testdata/function/declaration/no_prelude/simple.carbon index 758bdbaf6ee4..16b16d24d7ab 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/simple.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/simple.carbon @@ -11,23 +11,27 @@ fn G() { F(); } // CHECK:STDOUT: --- simple.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/declaration/param_same_name.carbon b/toolchain/check/testdata/function/declaration/param_same_name.carbon index b3e6b27c4c0b..1a7abd660302 100644 --- a/toolchain/check/testdata/function/declaration/param_same_name.carbon +++ b/toolchain/check/testdata/function/declaration/param_same_name.carbon @@ -10,18 +10,26 @@ fn G(a: i32); // CHECK:STDOUT: --- param_same_name.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %a.loc7_6.1: i32 = param a // CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc7_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc9_6.1: i32 = param a // CHECK:STDOUT: @G.%a: i32 = bind_name a, %a.loc9_6.1 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/definition/import.carbon b/toolchain/check/testdata/function/definition/import.carbon index 1052f28facce..2a617240e80d 100644 --- a/toolchain/check/testdata/function/definition/import.carbon +++ b/toolchain/check/testdata/function/definition/import.carbon @@ -93,36 +93,45 @@ fn D() {} // CHECK:STDOUT: --- fns.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] -// CHECK:STDOUT: %.4: i32 = int_literal 0 [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %.2: type = tuple_type (type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %struct.4: D = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .B = %B -// CHECK:STDOUT: .C = %C -// CHECK:STDOUT: .D = %D +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .B = %B.decl +// CHECK:STDOUT: .C = %C.decl +// CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} -// CHECK:STDOUT: %B: = fn_decl @B [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: %b.loc5_6.1: i32 = param b // CHECK:STDOUT: @B.%b: i32 = bind_name b, %b.loc5_6.1 // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C: = fn_decl @C [template] { +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { // 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: %.loc6_14.2: type = converted %.loc6_14.1, constants.%.3 [template = constants.%.3] // 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: %.loc6_28: type = struct_type {.c: i32} [template = constants.%.4] // CHECK:STDOUT: @C.%return: ref {.c: i32} = var // CHECK:STDOUT: } -// CHECK:STDOUT: %D: = fn_decl @D [template] {} +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -139,7 +148,7 @@ fn D() {} // CHECK:STDOUT: fn @C(%c: (i32,)) -> {.c: i32} { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: (i32,) = name_ref c, %c -// CHECK:STDOUT: %.loc6_47: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc6_47: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc6_48: i32 = tuple_index %c.ref, %.loc6_47 // CHECK:STDOUT: %.loc6_49: {.c: i32} = struct_literal (%.loc6_48) // CHECK:STDOUT: %struct: {.c: i32} = struct_value (%.loc6_48) @@ -151,13 +160,19 @@ fn D() {} // CHECK:STDOUT: // CHECK:STDOUT: --- extern.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A(); @@ -166,9 +181,15 @@ fn D() {} // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template] // CHECK:STDOUT: %.4: type = tuple_type (i32) [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.2) [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -183,10 +204,10 @@ fn D() {} // CHECK:STDOUT: .b = %b // CHECK:STDOUT: .c = %c // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loc_15 [template = imports.%A] -// CHECK:STDOUT: %import_ref.2: = import_ref ir1, inst+7, loc_24 [template = imports.%B] -// CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+21, loc_39 [template = imports.%C] -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+31, unloaded +// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loc_15 [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+10, loc_24 [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.3: C = import_ref ir1, inst+26, loc_39 [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+38, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc6_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1] @@ -207,14 +228,14 @@ fn D() {} // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.1 [template = imports.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.1 [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call -// CHECK:STDOUT: %B.ref: = name_ref B, file.%import_ref.2 [template = imports.%B] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%import_ref.2 [template = constants.%struct.2] // CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc7) // CHECK:STDOUT: assign file.%b.var, %B.call -// CHECK:STDOUT: %C.ref: = name_ref C, file.%import_ref.3 [template = imports.%C] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%import_ref.3 [template = constants.%struct.3] // CHECK:STDOUT: %.loc8_23: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc8_25: (i32,) = tuple_literal (%.loc8_23) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc8_23) [template = constants.%tuple] @@ -226,21 +247,29 @@ fn D() {} // CHECK:STDOUT: // CHECK:STDOUT: --- fail_def_ownership.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .C = %import_ref.3 // CHECK:STDOUT: .D = %import_ref.4 // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .B = %B +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loaded [template = imports.%A] -// CHECK:STDOUT: %import_ref.2: = import_ref ir1, inst+7, loaded [template = imports.%B] -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+21, unloaded -// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+31, unloaded +// CHECK:STDOUT: %import_ref.1: A = import_ref ir1, inst+2, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: B = import_ref ir1, inst+10, loaded [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+26, unloaded +// CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+38, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} -// CHECK:STDOUT: %B: = fn_decl @B [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: %b.loc27_6.1: i32 = param b // CHECK:STDOUT: %b.loc27_6.2: i32 = bind_name b, %b.loc27_6.1 // CHECK:STDOUT: %return.var: ref i32 = var @@ -256,15 +285,21 @@ fn D() {} // CHECK:STDOUT: // CHECK:STDOUT: --- redecl_then_def.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A.loc6 +// CHECK:STDOUT: .A = %A.decl.loc6 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+2, loaded [template = imports.%A] +// CHECK:STDOUT: %import_ref: A = import_ref ir1, inst+2, loaded [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.loc6: = fn_decl @A [template] {} -// CHECK:STDOUT: %A.loc7: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl.loc6: A = fn_decl @A [template = constants.%struct] {} +// CHECK:STDOUT: %A.decl.loc7: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -274,21 +309,27 @@ fn D() {} // CHECK:STDOUT: // CHECK:STDOUT: --- fail_mix_extern_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: D = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .A = %import_ref.1 // CHECK:STDOUT: .B = %import_ref.2 // CHECK:STDOUT: .C = %import_ref.3 // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .D = %D.loc13 +// CHECK:STDOUT: .D = %D.decl.loc13 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+2, unloaded -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+7, unloaded -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+21, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir1, inst+31, loaded [template = imports.%D] +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+10, unloaded +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+26, unloaded +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+38, loaded [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %D.loc6: = fn_decl @D [template] {} -// CHECK:STDOUT: %D.loc13: = fn_decl @D [template] {} +// CHECK:STDOUT: %D.decl.loc6: D = fn_decl @D [template = constants.%struct] {} +// CHECK:STDOUT: %D.decl.loc13: D = fn_decl @D [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @D() { diff --git a/toolchain/check/testdata/function/definition/no_prelude/extern.carbon b/toolchain/check/testdata/function/definition/no_prelude/extern.carbon index 73ff775432c6..3453bfabd177 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/extern.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/extern.carbon @@ -58,11 +58,17 @@ extern fn F(); // CHECK:STDOUT: --- fail_extern_def.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -72,12 +78,18 @@ extern fn F(); // CHECK:STDOUT: // CHECK:STDOUT: --- fail_def_for_extern_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F.loc12 +// CHECK:STDOUT: .F = %F.decl.loc12 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.loc4: = fn_decl @F [template] {} -// CHECK:STDOUT: %F.loc12: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl.loc4: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl.loc12: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -87,13 +99,19 @@ extern fn F(); // CHECK:STDOUT: // CHECK:STDOUT: --- fail_extern_diag_suppressed.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F.loc12 +// CHECK:STDOUT: .F = %F.decl.loc12 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.loc4: = fn_decl @F [template] {} -// CHECK:STDOUT: %F.loc12: = fn_decl @F [template] {} -// CHECK:STDOUT: %F.loc13: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl.loc4: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl.loc12: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl.loc13: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -103,12 +121,18 @@ extern fn F(); // CHECK:STDOUT: // CHECK:STDOUT: --- fail_extern_decl_after_def.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F.loc4 +// CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.loc4: = fn_decl @F [template] {} -// CHECK:STDOUT: %F.loc11: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl.loc4: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl.loc11: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon b/toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon index 87794b908f23..c8a6211aa0fa 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon @@ -66,65 +66,89 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: --- fail_decl_param_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.2: = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.3: G = struct_value () [template] +// CHECK:STDOUT: %.3: type = fn_type @.2 [template] +// CHECK:STDOUT: %struct.4: = struct_value () [template] +// CHECK:STDOUT: %H: type = fn_type @H [template] +// CHECK:STDOUT: %struct.5: H = struct_value () [template] +// CHECK:STDOUT: %.4: type = fn_type @.3 [template] +// CHECK:STDOUT: %struct.6: = struct_value () [template] +// CHECK:STDOUT: %I: type = fn_type @I [template] +// CHECK:STDOUT: %struct.7: I = struct_value () [template] +// CHECK:STDOUT: %.5: type = fn_type @.4 [template] +// CHECK:STDOUT: %struct.8: = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] -// CHECK:STDOUT: %struct: {} = struct_value () [template] +// CHECK:STDOUT: %J: type = fn_type @J [template] +// CHECK:STDOUT: %struct.9: J = struct_value () [template] +// CHECK:STDOUT: %.6: type = fn_type @.5 [template] +// CHECK:STDOUT: %struct.10: = struct_value () [template] +// CHECK:STDOUT: %K: type = fn_type @K [template] +// CHECK:STDOUT: %struct.11: K = struct_value () [template] +// CHECK:STDOUT: %.7: type = struct_type {} [template] +// CHECK:STDOUT: %.8: type = fn_type @.6 [template] +// CHECK:STDOUT: %struct.12: = struct_value () [template] +// CHECK:STDOUT: %struct.13: {} = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .H = %H -// CHECK:STDOUT: .I = %I -// CHECK:STDOUT: .J = %J -// CHECK:STDOUT: .K = %K +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .H = %H.decl +// CHECK:STDOUT: .I = %I.decl +// CHECK:STDOUT: .J = %J.decl +// CHECK:STDOUT: .K = %K.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] {} -// CHECK:STDOUT: %.loc15_13: = fn_decl @.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %.decl.loc15: = fn_decl @.1 [template = constants.%struct.2] { // CHECK:STDOUT: %.loc15_10.1: () = tuple_literal () // CHECK:STDOUT: %.loc15_10.2: type = converted %.loc15_10.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.loc15_6.1: () = param x // CHECK:STDOUT: @.1.%x: () = bind_name x, %x.loc15_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { // CHECK:STDOUT: %.loc17_10.1: () = tuple_literal () // CHECK:STDOUT: %.loc17_10.2: type = converted %.loc17_10.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.loc17_6.1: () = param x // CHECK:STDOUT: @G.%x: () = bind_name x, %x.loc17_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc25: = fn_decl @.2 [template] {} -// CHECK:STDOUT: %H: = fn_decl @H [template] { +// CHECK:STDOUT: %.decl.loc25: = fn_decl @.2 [template = constants.%struct.4] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.5] { // CHECK:STDOUT: %.loc27_10.1: () = tuple_literal () // CHECK:STDOUT: %.loc27_10.2: type = converted %.loc27_10.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.loc27_6.1: () = param x // CHECK:STDOUT: @H.%x: () = bind_name x, %x.loc27_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc35: = fn_decl @.3 [template] { +// CHECK:STDOUT: %.decl.loc35: = fn_decl @.3 [template = constants.%struct.6] { // CHECK:STDOUT: %x.loc35_6.1: bool = param x // CHECK:STDOUT: @.3.%x: bool = bind_name x, %x.loc35_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %I: = fn_decl @I [template] {} -// CHECK:STDOUT: %.loc45_14: = fn_decl @.4 [template] { +// CHECK:STDOUT: %I.decl: I = fn_decl @I [template = constants.%struct.7] {} +// CHECK:STDOUT: %.decl.loc45: = fn_decl @.4 [template = constants.%struct.8] { // CHECK:STDOUT: %.loc45_12.1: () = tuple_literal () // CHECK:STDOUT: %.loc45_12.2: type = converted %.loc45_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @.4.%return: ref () = var // CHECK:STDOUT: } -// CHECK:STDOUT: %J: = fn_decl @J [template] { +// CHECK:STDOUT: %J.decl: J = fn_decl @J [template = constants.%struct.9] { // CHECK:STDOUT: %.loc47_12.1: () = tuple_literal () // CHECK:STDOUT: %.loc47_12.2: type = converted %.loc47_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @J.%return: ref () = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc55: = fn_decl @.5 [template] {} -// CHECK:STDOUT: %K: = fn_decl @K [template] { +// CHECK:STDOUT: %.decl.loc55: = fn_decl @.5 [template = constants.%struct.10] {} +// CHECK:STDOUT: %K.decl: K = fn_decl @K [template = constants.%struct.11] { // CHECK:STDOUT: %.loc57_12.1: () = tuple_literal () // CHECK:STDOUT: %.loc57_12.2: type = converted %.loc57_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @K.%return: ref () = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc64_14: = fn_decl @.6 [template] { +// CHECK:STDOUT: %.decl.loc64: = fn_decl @.6 [template = constants.%struct.12] { // CHECK:STDOUT: %.loc64_12.1: {} = struct_literal () -// CHECK:STDOUT: %.loc64_12.2: type = converted %.loc64_12.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc64_12.2: type = converted %.loc64_12.1, constants.%.7 [template = constants.%.7] // CHECK:STDOUT: @.6.%return: ref {} = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -172,8 +196,8 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: fn @.6() -> {} { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc64_24: {} = struct_literal () -// CHECK:STDOUT: %struct: {} = struct_value () [template = constants.%struct] -// CHECK:STDOUT: %.loc64_25: {} = converted %.loc64_24, %struct [template = constants.%struct] +// CHECK:STDOUT: %struct: {} = struct_value () [template = constants.%struct.13] +// CHECK:STDOUT: %.loc64_25: {} = converted %.loc64_24, %struct [template = constants.%struct.13] // CHECK:STDOUT: return %.loc64_25 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon b/toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon index 84ca23b3adbf..39de5a2d53ce 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon @@ -15,12 +15,18 @@ fn F() {} // CHECK:STDOUT: --- fail_redef.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F.loc7 +// CHECK:STDOUT: .F = %F.decl.loc7 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.loc7: = fn_decl @F [template] {} -// CHECK:STDOUT: %F.loc14: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl.loc7: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl.loc14: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/function/definition/no_prelude/forward_decl.carbon b/toolchain/check/testdata/function/definition/no_prelude/forward_decl.carbon index 4cf961af1ac4..ae45b1ede011 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/forward_decl.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/forward_decl.carbon @@ -10,12 +10,18 @@ fn Foo() {} // CHECK:STDOUT: --- forward_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Foo = %Foo.loc7 +// CHECK:STDOUT: .Foo = %Foo.decl.loc7 // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.loc7: = fn_decl @Foo [template] {} -// CHECK:STDOUT: %Foo.loc9: = fn_decl @Foo [template] {} +// CHECK:STDOUT: %Foo.decl.loc7: Foo = fn_decl @Foo [template = constants.%struct] {} +// CHECK:STDOUT: %Foo.decl.loc9: Foo = fn_decl @Foo [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { diff --git a/toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon b/toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon index 5416cb43c4d8..68dfe37fd85e 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon @@ -99,23 +99,35 @@ fn A() {} // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: // CHECK:STDOUT: --- basic.impl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir0, inst+1, loaded [template = imports.%A] -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %import_ref: A = import_ref ir0, inst+1, loaded [template = constants.%struct] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -125,23 +137,35 @@ fn A() {} // CHECK:STDOUT: // CHECK:STDOUT: --- extern_api.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A(); // CHECK:STDOUT: // CHECK:STDOUT: --- fail_extern_api.impl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir0, inst+1, loaded [template = imports.%A] -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %import_ref: A = import_ref ir0, inst+1, loaded [template = constants.%struct] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -151,23 +175,35 @@ fn A() {} // CHECK:STDOUT: // CHECK:STDOUT: --- extern_impl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: // CHECK:STDOUT: --- fail_extern_impl.impl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir0, inst+1, loaded [template = imports.%A] -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %import_ref: A = import_ref ir0, inst+1, loaded [template = constants.%struct] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -177,11 +213,17 @@ fn A() {} // CHECK:STDOUT: // CHECK:STDOUT: --- redecl_after_def.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -191,23 +233,35 @@ fn A() {} // CHECK:STDOUT: // CHECK:STDOUT: --- fail_redecl_after_def.impl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir0, inst+1, loaded [template = imports.%A] -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %import_ref: A = import_ref ir0, inst+1, loaded [template = constants.%struct] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: // CHECK:STDOUT: --- redef_after_def.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -217,12 +271,18 @@ fn A() {} // CHECK:STDOUT: // CHECK:STDOUT: --- fail_redef_after_def.impl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir0, inst+1, loaded [template = imports.%A] -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %import_ref: A = import_ref ir0, inst+1, loaded [template = constants.%struct] +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { diff --git a/toolchain/check/testdata/function/definition/no_prelude/order.carbon b/toolchain/check/testdata/function/definition/no_prelude/order.carbon index 73c9ef5637a7..16b0ec0111e7 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/order.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/order.carbon @@ -10,15 +10,25 @@ fn Baz() {} // CHECK:STDOUT: --- order.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %Bar: type = fn_type @Bar [template] +// CHECK:STDOUT: %struct.2: Bar = struct_value () [template] +// CHECK:STDOUT: %Baz: type = fn_type @Baz [template] +// CHECK:STDOUT: %struct.3: Baz = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Foo = %Foo -// CHECK:STDOUT: .Bar = %Bar -// CHECK:STDOUT: .Baz = %Baz +// CHECK:STDOUT: .Foo = %Foo.decl +// CHECK:STDOUT: .Bar = %Bar.decl +// CHECK:STDOUT: .Baz = %Baz.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] {} -// CHECK:STDOUT: %Bar: = fn_decl @Bar [template] {} -// CHECK:STDOUT: %Baz: = fn_decl @Baz [template] {} +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] {} +// CHECK:STDOUT: %Bar.decl: Bar = fn_decl @Bar [template = constants.%struct.2] {} +// CHECK:STDOUT: %Baz.decl: Baz = fn_decl @Baz [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { diff --git a/toolchain/check/testdata/function/definition/no_prelude/params_zero.carbon b/toolchain/check/testdata/function/definition/no_prelude/params_zero.carbon index 468306f0a8c2..3ce337761bf2 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/params_zero.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/params_zero.carbon @@ -8,11 +8,17 @@ fn Foo() {} // CHECK:STDOUT: --- params_zero.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] {} +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] {} // 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 26fd010d4410..42088f85afb0 100644 --- a/toolchain/check/testdata/function/definition/params_one.carbon +++ b/toolchain/check/testdata/function/definition/params_one.carbon @@ -8,13 +8,19 @@ fn Foo(a: i32) {} // CHECK:STDOUT: --- params_one.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] { // CHECK:STDOUT: %a.loc7_8.1: i32 = param a // CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/definition/params_one_comma.carbon b/toolchain/check/testdata/function/definition/params_one_comma.carbon index 00452ccbb212..e70ca5190785 100644 --- a/toolchain/check/testdata/function/definition/params_one_comma.carbon +++ b/toolchain/check/testdata/function/definition/params_one_comma.carbon @@ -8,13 +8,19 @@ fn Foo(a: i32,) {} // CHECK:STDOUT: --- params_one_comma.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] { // CHECK:STDOUT: %a.loc7_8.1: i32 = param a // CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/definition/params_two.carbon b/toolchain/check/testdata/function/definition/params_two.carbon index fe868415bc05..9ebba23b6b83 100644 --- a/toolchain/check/testdata/function/definition/params_two.carbon +++ b/toolchain/check/testdata/function/definition/params_two.carbon @@ -8,13 +8,19 @@ fn Foo(a: i32, b: i32) {} // CHECK:STDOUT: --- params_two.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] { // 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 diff --git a/toolchain/check/testdata/function/definition/params_two_comma.carbon b/toolchain/check/testdata/function/definition/params_two_comma.carbon index 6718329f7e29..665936884e26 100644 --- a/toolchain/check/testdata/function/definition/params_two_comma.carbon +++ b/toolchain/check/testdata/function/definition/params_two_comma.carbon @@ -8,13 +8,19 @@ fn Foo(a: i32, b: i32,) {} // CHECK:STDOUT: --- params_two_comma.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] { // 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 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 16131370b784..e39d4c45b040 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,15 +13,18 @@ fn F(N:! i32, a: [i32; N]*); // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %N: i32 = bind_symbolic_name N 0 [symbolic] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %N.loc10_6.1: i32 = param N // CHECK:STDOUT: @F.%N: i32 = bind_symbolic_name N 0, %N.loc10_6.1 [symbolic = constants.%N] // CHECK:STDOUT: %N.ref: i32 = name_ref N, @F.%N [symbolic = constants.%N] diff --git a/toolchain/check/testdata/function/generic/no_prelude/fail_type_param_mismatch.carbon b/toolchain/check/testdata/function/generic/no_prelude/fail_type_param_mismatch.carbon index 5b32ba7c7378..e77870ddbedd 100644 --- a/toolchain/check/testdata/function/generic/no_prelude/fail_type_param_mismatch.carbon +++ b/toolchain/check/testdata/function/generic/no_prelude/fail_type_param_mismatch.carbon @@ -17,14 +17,17 @@ fn F(T:! type, U:! type) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: %U: type = bind_symbolic_name U 1 [symbolic] -// CHECK:STDOUT: %.1: type = ptr_type T [symbolic] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = ptr_type T [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %T.loc7_6.1: type = param T // CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc7_6.1 [symbolic = constants.%T] // CHECK:STDOUT: %U.loc7_16.1: type = param U @@ -35,7 +38,7 @@ fn F(T:! type, U:! type) { // CHECK:STDOUT: fn @F(%T: type, %U: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc8: type = ptr_type T [symbolic = constants.%.1] +// CHECK:STDOUT: %.loc8: type = ptr_type T [symbolic = constants.%.2] // CHECK:STDOUT: %p.var: ref T* = var p // CHECK:STDOUT: %p: ref T* = bind_name p, %p.var // CHECK:STDOUT: %U.ref: type = name_ref U, %U [symbolic = constants.%U] diff --git a/toolchain/check/testdata/function/generic/no_prelude/type_param.carbon b/toolchain/check/testdata/function/generic/no_prelude/type_param.carbon index eba88fcbaae8..815fa224bb04 100644 --- a/toolchain/check/testdata/function/generic/no_prelude/type_param.carbon +++ b/toolchain/check/testdata/function/generic/no_prelude/type_param.carbon @@ -13,14 +13,17 @@ fn F(T:! type) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] -// CHECK:STDOUT: %.1: type = ptr_type T [symbolic] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = ptr_type T [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %T.loc7_6.1: type = param T // CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc7_6.1 [symbolic = constants.%T] // CHECK:STDOUT: } @@ -29,7 +32,7 @@ fn F(T:! type) { // CHECK:STDOUT: fn @F(%T: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref.loc8: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc8: type = ptr_type T [symbolic = constants.%.1] +// CHECK:STDOUT: %.loc8: type = ptr_type T [symbolic = constants.%.2] // CHECK:STDOUT: %p.var: ref T* = var p // CHECK:STDOUT: %p: ref T* = bind_name p, %p.var // CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T [symbolic = constants.%T] diff --git a/toolchain/check/testdata/function/generic/no_prelude/type_param_scope.carbon b/toolchain/check/testdata/function/generic/no_prelude/type_param_scope.carbon index 5a5d319c0e1e..6f6bb4605635 100644 --- a/toolchain/check/testdata/function/generic/no_prelude/type_param_scope.carbon +++ b/toolchain/check/testdata/function/generic/no_prelude/type_param_scope.carbon @@ -13,13 +13,16 @@ fn F(T:! type, n: T) -> T { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %T.loc7_6.1: type = param T // CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc7_6.1 [symbolic = constants.%T] // CHECK:STDOUT: %T.ref.loc7_19: type = name_ref T, @F.%T [symbolic = constants.%T] diff --git a/toolchain/check/testdata/function/generic/redeclare.carbon b/toolchain/check/testdata/function/generic/redeclare.carbon index 337852a363b7..03808f612038 100644 --- a/toolchain/check/testdata/function/generic/redeclare.carbon +++ b/toolchain/check/testdata/function/generic/redeclare.carbon @@ -102,22 +102,25 @@ fn F(U:! type, T:! type) -> U* { // CHECK:STDOUT: constants { // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: %.1: type = ptr_type T [symbolic] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F.loc4 +// CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F.loc4: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl.loc4: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %T.loc4_6.1: type = param T // CHECK:STDOUT: %T.loc4_6.2: type = bind_symbolic_name T 0, %T.loc4_6.1 [symbolic = constants.%T] // CHECK:STDOUT: %T.ref.loc4: type = name_ref T, %T.loc4_6.2 [symbolic = constants.%T] // CHECK:STDOUT: %.loc4: type = ptr_type T [symbolic = constants.%.1] // CHECK:STDOUT: %return.var.loc4: ref T* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F.loc6: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl.loc6: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %T.loc6_6.1: type = param T // CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc6_6.1 [symbolic = constants.%T] // CHECK:STDOUT: %T.ref.loc6: type = name_ref T, @F.%T [symbolic = constants.%T] @@ -128,7 +131,7 @@ fn F(U:! type, T:! type) -> U* { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%T: type) -> T* { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F.loc4 [template = file.%F.loc4] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl.loc4 [template = constants.%struct] // CHECK:STDOUT: %T.ref: type = name_ref T, %T [symbolic = constants.%T] // CHECK:STDOUT: %F.call: init T* = call %F.ref(%T.ref) // CHECK:STDOUT: %.loc7_14.1: T* = value_of_initializer %F.call @@ -142,16 +145,21 @@ fn F(U:! type, T:! type) -> U* { // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: %U: type = bind_symbolic_name U 1 [symbolic] // CHECK:STDOUT: %.1: type = ptr_type T [symbolic] -// CHECK:STDOUT: %.2: type = ptr_type U [symbolic] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = ptr_type U [symbolic] +// CHECK:STDOUT: %.4: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.2: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %T.loc4_6.1: type = param T // CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc4_6.1 [symbolic = constants.%T] // CHECK:STDOUT: %U.loc4_16.1: type = param U @@ -160,13 +168,13 @@ fn F(U:! type, T:! type) -> U* { // CHECK:STDOUT: %.loc4: type = ptr_type T [symbolic = constants.%.1] // CHECK:STDOUT: @F.%return: ref T* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc13_32: = fn_decl @.1 [template] { +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] { // CHECK:STDOUT: %T.loc13_6.1: type = param T // CHECK:STDOUT: @.1.%T: type = bind_symbolic_name T 0, %T.loc13_6.1 [symbolic = constants.%T] // CHECK:STDOUT: %U.loc13_16.1: type = param U // CHECK:STDOUT: @.1.%U: type = bind_symbolic_name U 1, %U.loc13_16.1 [symbolic = constants.%U] // CHECK:STDOUT: %U.ref: type = name_ref U, @.1.%U [symbolic = constants.%U] -// CHECK:STDOUT: %.loc13_30: type = ptr_type U [symbolic = constants.%.2] +// CHECK:STDOUT: %.loc13: type = ptr_type U [symbolic = constants.%.3] // CHECK:STDOUT: @.1.%return: ref U* = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -175,7 +183,7 @@ fn F(U:! type, T:! type) -> U* { // CHECK:STDOUT: // CHECK:STDOUT: fn @.1(%T: type, %U: type) -> U* { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %T.ref: type = name_ref T, %T [symbolic = constants.%T] // CHECK:STDOUT: %F.call: init T* = call %F.ref() [template = ] // CHECK:STDOUT: return @@ -187,18 +195,23 @@ fn F(U:! type, T:! type) -> U* { // CHECK:STDOUT: %T.1: type = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: %U.1: type = bind_symbolic_name U 1 [symbolic] // CHECK:STDOUT: %.1: type = ptr_type T [symbolic] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] // CHECK:STDOUT: %U.2: type = bind_symbolic_name U 0 [symbolic] // CHECK:STDOUT: %T.2: type = bind_symbolic_name T 1 [symbolic] -// CHECK:STDOUT: %.2: type = ptr_type T [symbolic] +// CHECK:STDOUT: %.3: type = ptr_type T [symbolic] +// CHECK:STDOUT: %.4: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.2: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %T.loc4_6.1: type = param T // CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc4_6.1 [symbolic = constants.%T.1] // CHECK:STDOUT: %U.loc4_16.1: type = param U @@ -207,13 +220,13 @@ fn F(U:! type, T:! type) -> U* { // CHECK:STDOUT: %.loc4: type = ptr_type T [symbolic = constants.%.1] // CHECK:STDOUT: @F.%return: ref T* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc13_32: = fn_decl @.1 [template] { +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] { // CHECK:STDOUT: %U.loc13_6.1: type = param U // CHECK:STDOUT: @.1.%U: type = bind_symbolic_name U 0, %U.loc13_6.1 [symbolic = constants.%U.2] // CHECK:STDOUT: %T.loc13_16.1: type = param T // CHECK:STDOUT: @.1.%T: type = bind_symbolic_name T 1, %T.loc13_16.1 [symbolic = constants.%T.2] // CHECK:STDOUT: %T.ref.loc13: type = name_ref T, @.1.%T [symbolic = constants.%T.2] -// CHECK:STDOUT: %.loc13_30: type = ptr_type T [symbolic = constants.%.2] +// CHECK:STDOUT: %.loc13: type = ptr_type T [symbolic = constants.%.3] // CHECK:STDOUT: @.1.%return: ref T* = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -222,7 +235,7 @@ fn F(U:! type, T:! type) -> U* { // CHECK:STDOUT: // CHECK:STDOUT: fn @.1(%U: type, %T: type) -> T* { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %T.ref: type = name_ref T, %T [symbolic = constants.%T.2] // CHECK:STDOUT: %F.call: init T* = call %F.ref() [template = ] // CHECK:STDOUT: return @@ -234,18 +247,23 @@ fn F(U:! type, T:! type) -> U* { // CHECK:STDOUT: %T.1: type = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: %U.1: type = bind_symbolic_name U 1 [symbolic] // CHECK:STDOUT: %.1: type = ptr_type T [symbolic] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] // CHECK:STDOUT: %U.2: type = bind_symbolic_name U 0 [symbolic] // CHECK:STDOUT: %T.2: type = bind_symbolic_name T 1 [symbolic] -// CHECK:STDOUT: %.2: type = ptr_type U [symbolic] +// CHECK:STDOUT: %.3: type = ptr_type U [symbolic] +// CHECK:STDOUT: %.4: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.2: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %T.loc4_6.1: type = param T // CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc4_6.1 [symbolic = constants.%T.1] // CHECK:STDOUT: %U.loc4_16.1: type = param U @@ -254,13 +272,13 @@ fn F(U:! type, T:! type) -> U* { // CHECK:STDOUT: %.loc4: type = ptr_type T [symbolic = constants.%.1] // CHECK:STDOUT: @F.%return: ref T* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc13_32: = fn_decl @.1 [template] { +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] { // CHECK:STDOUT: %U.loc13_6.1: type = param U // CHECK:STDOUT: @.1.%U: type = bind_symbolic_name U 0, %U.loc13_6.1 [symbolic = constants.%U.2] // CHECK:STDOUT: %T.loc13_16.1: type = param T // CHECK:STDOUT: @.1.%T: type = bind_symbolic_name T 1, %T.loc13_16.1 [symbolic = constants.%T.2] // CHECK:STDOUT: %U.ref: type = name_ref U, @.1.%U [symbolic = constants.%U.2] -// CHECK:STDOUT: %.loc13_30: type = ptr_type U [symbolic = constants.%.2] +// CHECK:STDOUT: %.loc13: type = ptr_type U [symbolic = constants.%.3] // CHECK:STDOUT: @.1.%return: ref U* = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -269,7 +287,7 @@ fn F(U:! type, T:! type) -> U* { // CHECK:STDOUT: // CHECK:STDOUT: fn @.1(%U: type, %T: type) -> U* { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %T.ref: type = name_ref T, %T [symbolic = constants.%T.2] // CHECK:STDOUT: %F.call: init T* = call %F.ref() [template = ] // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/global/class_with_fun.carbon b/toolchain/check/testdata/global/class_with_fun.carbon index 6e467d9f3530..914c9ceaa41c 100644 --- a/toolchain/check/testdata/global/class_with_fun.carbon +++ b/toolchain/check/testdata/global/class_with_fun.carbon @@ -16,21 +16,23 @@ var a: A = {}; // CHECK:STDOUT: constants { // CHECK:STDOUT: %A: type = class_type @A [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %ret_a: type = fn_type @ret_a [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: ret_a = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: %struct.2: A = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .A = %A.decl -// CHECK:STDOUT: .ret_a = %ret_a +// CHECK:STDOUT: .ret_a = %ret_a.decl // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} -// CHECK:STDOUT: %ret_a: = fn_decl @ret_a [template] { +// CHECK:STDOUT: %ret_a.decl: ret_a = fn_decl @ret_a [template = constants.%struct.1] { // CHECK:STDOUT: %A.ref.loc8: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: @ret_a.%return: ref A = var // CHECK:STDOUT: } @@ -47,16 +49,16 @@ var a: A = {}; // CHECK:STDOUT: fn @ret_a() -> %return: A { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc9_11.1: {} = struct_literal () -// CHECK:STDOUT: %.loc9_11.2: init A = class_init (), %return [template = constants.%struct] -// CHECK:STDOUT: %.loc9_12: init A = converted %.loc9_11.1, %.loc9_11.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc9_11.2: init A = class_init (), %return [template = constants.%struct.2] +// CHECK:STDOUT: %.loc9_12: init A = converted %.loc9_11.1, %.loc9_11.2 [template = constants.%struct.2] // CHECK:STDOUT: return %.loc9_12 to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc12_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc12_13.2: init A = class_init (), file.%a.var [template = constants.%struct] -// CHECK:STDOUT: %.loc12_14: init A = converted %.loc12_13.1, %.loc12_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc12_13.2: init A = class_init (), file.%a.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc12_14: init A = converted %.loc12_13.1, %.loc12_13.2 [template = constants.%struct.2] // CHECK:STDOUT: assign file.%a.var, %.loc12_14 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/global/simple_with_fun.carbon b/toolchain/check/testdata/global/simple_with_fun.carbon index bdb4c45990cf..0e56875e75d7 100644 --- a/toolchain/check/testdata/global/simple_with_fun.carbon +++ b/toolchain/check/testdata/global/simple_with_fun.carbon @@ -13,17 +13,20 @@ var a: i32 = test_a(); // CHECK:STDOUT: --- simple_with_fun.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] +// CHECK:STDOUT: %test_a: type = fn_type @test_a [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: test_a = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .test_a = %test_a +// CHECK:STDOUT: .test_a = %test_a.decl // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %test_a: = fn_decl @test_a [template] { +// CHECK:STDOUT: %test_a.decl: test_a = fn_decl @test_a [template = constants.%struct] { // CHECK:STDOUT: @test_a.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %a.var: ref i32 = var a @@ -32,13 +35,13 @@ var a: i32 = test_a(); // CHECK:STDOUT: // CHECK:STDOUT: fn @test_a() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %test_a.ref: = name_ref test_a, file.%test_a [template = file.%test_a] +// CHECK:STDOUT: %test_a.ref: test_a = name_ref test_a, file.%test_a.decl [template = constants.%struct] // CHECK:STDOUT: %test_a.call: init i32 = call %test_a.ref() // CHECK:STDOUT: assign file.%a.var, %test_a.call // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/if/else.carbon b/toolchain/check/testdata/if/else.carbon index f97b5bf58594..565fa2d88d2e 100644 --- a/toolchain/check/testdata/if/else.carbon +++ b/toolchain/check/testdata/if/else.carbon @@ -20,22 +20,30 @@ fn If(b: bool) { // CHECK:STDOUT: --- else.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %H: type = fn_type @H [template] +// CHECK:STDOUT: %struct.3: H = struct_value () [template] +// CHECK:STDOUT: %If: type = fn_type @If [template] +// CHECK:STDOUT: %struct.4: If = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .H = %H -// CHECK:STDOUT: .If = %If +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .H = %H.decl +// CHECK:STDOUT: .If = %If.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [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.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] {} +// CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct.4] { // CHECK:STDOUT: %b.loc11_7.1: bool = param b // CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc11_7.1 // CHECK:STDOUT: } @@ -62,17 +70,17 @@ fn If(b: bool) { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: br !if.done // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %G.call: init () = call %G.ref() // CHECK:STDOUT: br !if.done // CHECK:STDOUT: // CHECK:STDOUT: !if.done: -// CHECK:STDOUT: %H.ref: = name_ref H, file.%H [template = file.%H] +// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.3] // CHECK:STDOUT: %H.call: init () = call %H.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon index d0619ee2dcf5..bc8b64eac798 100644 --- a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon @@ -38,29 +38,36 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: --- fail_reachable_fallthrough.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] +// CHECK:STDOUT: %If1: type = fn_type @If1 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: If1 = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %If2: type = fn_type @If2 [template] +// CHECK:STDOUT: %struct.2: If2 = struct_value () [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %If3: type = fn_type @If3 [template] +// CHECK:STDOUT: %struct.3: If3 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .If1 = %If1 -// CHECK:STDOUT: .If2 = %If2 -// CHECK:STDOUT: .If3 = %If3 +// CHECK:STDOUT: .If1 = %If1.decl +// CHECK:STDOUT: .If2 = %If2.decl +// CHECK:STDOUT: .If3 = %If3.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %If1: = fn_decl @If1 [template] { +// CHECK:STDOUT: %If1.decl: If1 = fn_decl @If1 [template = constants.%struct.1] { // CHECK:STDOUT: %b.loc7_8.1: bool = param b // CHECK:STDOUT: @If1.%b: bool = bind_name b, %b.loc7_8.1 // CHECK:STDOUT: @If1.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %If2: = fn_decl @If2 [template] { +// CHECK:STDOUT: %If2.decl: If2 = fn_decl @If2 [template = constants.%struct.2] { // CHECK:STDOUT: %b.loc18_8.1: bool = param b // CHECK:STDOUT: @If2.%b: bool = bind_name b, %b.loc18_8.1 // CHECK:STDOUT: @If2.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %If3: = fn_decl @If3 [template] { +// CHECK:STDOUT: %If3.decl: If3 = fn_decl @If3 [template = constants.%struct.3] { // CHECK:STDOUT: %b.loc29_8.1: bool = param b // CHECK:STDOUT: @If3.%b: bool = bind_name b, %b.loc29_8.1 // CHECK:STDOUT: @If3.%return: ref i32 = var @@ -73,7 +80,7 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: return %.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: @@ -91,7 +98,7 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: br !if.done // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc21: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc21: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: return %.loc21 // CHECK:STDOUT: // CHECK:STDOUT: !if.done: @@ -103,7 +110,7 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc31: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc31: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: return %.loc31 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: diff --git a/toolchain/check/testdata/if/fail_scope.carbon b/toolchain/check/testdata/if/fail_scope.carbon index 77e7fa6499ee..d084bf098416 100644 --- a/toolchain/check/testdata/if/fail_scope.carbon +++ b/toolchain/check/testdata/if/fail_scope.carbon @@ -18,16 +18,19 @@ fn VarScope(b: bool) -> i32 { // CHECK:STDOUT: --- fail_scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 2 [template] +// CHECK:STDOUT: %VarScope: type = fn_type @VarScope [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: VarScope = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .VarScope = %VarScope +// CHECK:STDOUT: .VarScope = %VarScope.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %VarScope: = fn_decl @VarScope [template] { +// CHECK:STDOUT: %VarScope.decl: VarScope = fn_decl @VarScope [template = constants.%struct] { // CHECK:STDOUT: %b.loc7_13.1: bool = param b // CHECK:STDOUT: @VarScope.%b: bool = bind_name b, %b.loc7_13.1 // CHECK:STDOUT: @VarScope.%return: ref i32 = var @@ -42,7 +45,7 @@ fn VarScope(b: bool) -> i32 { // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc9: i32 = int_literal 2 [template = constants.%.1] +// CHECK:STDOUT: %.loc9: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: assign %n.var, %.loc9 // CHECK:STDOUT: %n.ref.loc10: ref i32 = name_ref n, %n // CHECK:STDOUT: %.loc10: i32 = bind_value %n.ref.loc10 diff --git a/toolchain/check/testdata/if/no_else.carbon b/toolchain/check/testdata/if/no_else.carbon index 07e2892fa7ec..fd05461e9063 100644 --- a/toolchain/check/testdata/if/no_else.carbon +++ b/toolchain/check/testdata/if/no_else.carbon @@ -17,20 +17,26 @@ fn If(b: bool) { // CHECK:STDOUT: --- no_else.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %If: type = fn_type @If [template] +// CHECK:STDOUT: %struct.3: If = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .If = %If +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .If = %If.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [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.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} +// CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct.3] { // CHECK:STDOUT: %b.loc10_7.1: bool = param b // CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc10_7.1 // CHECK:STDOUT: } @@ -52,12 +58,12 @@ fn If(b: bool) { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %G.call: init () = call %G.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if/unreachable_fallthrough.carbon b/toolchain/check/testdata/if/unreachable_fallthrough.carbon index 31826e8a0e78..a29c670905a7 100644 --- a/toolchain/check/testdata/if/unreachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/unreachable_fallthrough.carbon @@ -16,17 +16,20 @@ fn If(b: bool) -> i32 { // CHECK:STDOUT: --- unreachable_fallthrough.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] +// CHECK:STDOUT: %If: type = fn_type @If [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: If = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .If = %If +// CHECK:STDOUT: .If = %If.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %If: = fn_decl @If [template] { +// CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct] { // CHECK:STDOUT: %b.loc7_7.1: bool = param b // CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc7_7.1 // CHECK:STDOUT: @If.%return: ref i32 = var @@ -39,11 +42,11 @@ fn If(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: return %.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc11: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc11: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: return %.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/basic.carbon b/toolchain/check/testdata/if_expr/basic.carbon index 9e90c34e9b99..68c05f08fb2d 100644 --- a/toolchain/check/testdata/if_expr/basic.carbon +++ b/toolchain/check/testdata/if_expr/basic.carbon @@ -12,21 +12,24 @@ fn F(b: bool, n: i32, m: i32) -> i32 { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] -// CHECK:STDOUT: %.3: type = ptr_type [i32; 1] [template] -// CHECK:STDOUT: %.4: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.5: type = tuple_type (i32) [template] -// CHECK:STDOUT: %array: [i32; 1] = tuple_value (%.4) [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template] +// CHECK:STDOUT: %.4: type = ptr_type [i32; 1] [template] +// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.6: type = tuple_type (i32) [template] +// CHECK:STDOUT: %array: [i32; 1] = tuple_value (%.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // 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 @@ -39,15 +42,15 @@ fn F(b: bool, n: i32, m: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b: bool, %n: i32, %m: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_17: type = array_type %.loc8_16, i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_17: type = array_type %.loc8_16, i32 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref [i32; 1] = var x // CHECK:STDOUT: %x: ref [i32; 1] = bind_name x, %x.var -// CHECK:STDOUT: %.loc8_22: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_22: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc8_24.1: (i32,) = tuple_literal (%.loc8_22) -// CHECK:STDOUT: %.loc8_24.2: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_24.2: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc8_24.3: ref i32 = array_index %x.var, %.loc8_24.2 -// CHECK:STDOUT: %.loc8_24.4: init i32 = initialize_from %.loc8_22 to %.loc8_24.3 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_24.4: init i32 = initialize_from %.loc8_22 to %.loc8_24.3 [template = constants.%.5] // CHECK:STDOUT: %.loc8_24.5: init [i32; 1] = array_init (%.loc8_24.4) to %x.var [template = constants.%array] // CHECK:STDOUT: %.loc8_25: init [i32; 1] = converted %.loc8_24.1, %.loc8_24.5 [template = constants.%array] // CHECK:STDOUT: assign %x.var, %.loc8_25 diff --git a/toolchain/check/testdata/if_expr/constant_condition.carbon b/toolchain/check/testdata/if_expr/constant_condition.carbon index a986f04854c8..fe07e8fe2986 100644 --- a/toolchain/check/testdata/if_expr/constant_condition.carbon +++ b/toolchain/check/testdata/if_expr/constant_condition.carbon @@ -30,40 +30,53 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: --- constant_condition.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: bool = bool_literal true [template] -// CHECK:STDOUT: %.4: bool = bool_literal false [template] -// CHECK:STDOUT: %.5: type = ptr_type i32 [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %.4: bool = bool_literal true [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.4: G = struct_value () [template] +// CHECK:STDOUT: %.5: bool = bool_literal false [template] +// CHECK:STDOUT: %Constant: type = fn_type @Constant [template] +// CHECK:STDOUT: %struct.5: Constant = struct_value () [template] +// CHECK:STDOUT: %.6: type = ptr_type i32 [template] +// CHECK:STDOUT: %PartiallyConstant: type = fn_type @PartiallyConstant [template] +// CHECK:STDOUT: %struct.6: PartiallyConstant = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .B = %B -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .Constant = %Constant -// CHECK:STDOUT: .PartiallyConstant = %PartiallyConstant +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .B = %B.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .Constant = %Constant.decl +// CHECK:STDOUT: .PartiallyConstant = %PartiallyConstant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B: = fn_decl @B [template] { +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.4] { // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Constant: = fn_decl @Constant [template] { +// CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.5] { // CHECK:STDOUT: @Constant.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %PartiallyConstant: = fn_decl @PartiallyConstant [template] { +// CHECK:STDOUT: %PartiallyConstant.decl: PartiallyConstant = fn_decl @PartiallyConstant [template = constants.%struct.6] { // CHECK:STDOUT: %t.loc24_22.1: type = param t // CHECK:STDOUT: @PartiallyConstant.%t: type = bind_name t, %t.loc24_22.1 // CHECK:STDOUT: @PartiallyConstant.%return: ref i32 = var @@ -72,30 +85,30 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc8: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_13: bool = bool_literal true [template = constants.%.3] +// CHECK:STDOUT: %.loc11_13: bool = bool_literal true [template = constants.%.4] // CHECK:STDOUT: if %.loc11_13 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() // CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %A.call // CHECK:STDOUT: %.loc11_24.2: i32 = converted %A.call, %.loc11_24.1 // CHECK:STDOUT: br !if.expr.result(%.loc11_24.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] // CHECK:STDOUT: %B.call: init i32 = call %B.ref() // CHECK:STDOUT: %.loc11_27.1: i32 = value_of_initializer %B.call // CHECK:STDOUT: %.loc11_27.2: i32 = converted %B.call, %.loc11_27.1 @@ -108,18 +121,18 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13: bool = bool_literal false [template = constants.%.4] +// CHECK:STDOUT: %.loc15_13: bool = bool_literal false [template = constants.%.5] // CHECK:STDOUT: if %.loc15_13 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() // CHECK:STDOUT: %.loc15_25.1: i32 = value_of_initializer %A.call // CHECK:STDOUT: %.loc15_25.2: i32 = converted %A.call, %.loc15_25.1 // CHECK:STDOUT: br !if.expr.result(%.loc15_25.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] // CHECK:STDOUT: %B.call: init i32 = call %B.ref() // CHECK:STDOUT: %.loc15_28.1: i32 = value_of_initializer %B.call // CHECK:STDOUT: %.loc15_28.2: i32 = converted %B.call, %.loc15_28.1 @@ -132,34 +145,34 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Constant() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc19_13: bool = bool_literal true [template = constants.%.3] +// CHECK:STDOUT: %.loc19_13: bool = bool_literal true [template = constants.%.4] // CHECK:STDOUT: if %.loc19_13 br !if.expr.then.loc19 else br !if.expr.else.loc19 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc19: // CHECK:STDOUT: br !if.expr.result.loc19(i32) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc19: -// CHECK:STDOUT: %.loc19_35: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc19_35: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: br !if.expr.result.loc19(%.loc19_35) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc19: // CHECK:STDOUT: %.loc19_10: type = block_arg !if.expr.result.loc19 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc19_39: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc19_39: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: assign %v.var, %.loc19_39 -// CHECK:STDOUT: %.loc20_13: bool = bool_literal false [template = constants.%.4] +// CHECK:STDOUT: %.loc20_13: bool = bool_literal false [template = constants.%.5] // CHECK:STDOUT: if %.loc20_13 br !if.expr.then.loc20 else br !if.expr.else.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc20: // CHECK:STDOUT: br !if.expr.result.loc20(i32) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc20: -// CHECK:STDOUT: %.loc20_36: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc20_36: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_36) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc20: -// CHECK:STDOUT: %.loc20_10: type = block_arg !if.expr.result.loc20 [template = constants.%.5] +// CHECK:STDOUT: %.loc20_10: type = block_arg !if.expr.result.loc20 [template = constants.%.6] // CHECK:STDOUT: %w.var: ref i32* = var w // CHECK:STDOUT: %w: ref i32* = bind_name w, %w.var // CHECK:STDOUT: %v.ref: ref i32 = name_ref v, %v @@ -174,7 +187,7 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @PartiallyConstant(%t: type) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc25_13: bool = bool_literal true [template = constants.%.3] +// CHECK:STDOUT: %.loc25_13: bool = bool_literal true [template = constants.%.4] // CHECK:STDOUT: if %.loc25_13 br !if.expr.then.loc25 else br !if.expr.else.loc25 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc25: @@ -188,9 +201,9 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: %.loc25_10: type = block_arg !if.expr.result.loc25 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc25_36: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc25_36: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: assign %v.var, %.loc25_36 -// CHECK:STDOUT: %.loc26_13: bool = bool_literal false [template = constants.%.4] +// CHECK:STDOUT: %.loc26_13: bool = bool_literal false [template = constants.%.5] // CHECK:STDOUT: if %.loc26_13 br !if.expr.then.loc26 else br !if.expr.else.loc26 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc26: @@ -198,11 +211,11 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: br !if.expr.result.loc26(%t.ref.loc26) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc26: -// CHECK:STDOUT: %.loc26_34: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc26_34: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: br !if.expr.result.loc26(%.loc26_34) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc26: -// CHECK:STDOUT: %.loc26_10: type = block_arg !if.expr.result.loc26 [template = constants.%.5] +// CHECK:STDOUT: %.loc26_10: type = block_arg !if.expr.result.loc26 [template = constants.%.6] // CHECK:STDOUT: %w.var: ref i32* = var w // CHECK:STDOUT: %w: ref i32* = bind_name w, %w.var // CHECK:STDOUT: %v.ref: ref i32 = name_ref v, %v diff --git a/toolchain/check/testdata/if_expr/control_flow.carbon b/toolchain/check/testdata/if_expr/control_flow.carbon index 1e45c1cd0db5..6c38b2086714 100644 --- a/toolchain/check/testdata/if_expr/control_flow.carbon +++ b/toolchain/check/testdata/if_expr/control_flow.carbon @@ -14,25 +14,32 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: --- control_flow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .B = %B -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .B = %B.decl +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B: = fn_decl @B [template] { +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %b.loc10_6.1: bool = param b // CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc10_6.1 // CHECK:STDOUT: @F.%return: ref i32 = var @@ -41,13 +48,13 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc8: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -57,14 +64,14 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() // CHECK:STDOUT: %.loc11_21.1: i32 = value_of_initializer %A.call // CHECK:STDOUT: %.loc11_21.2: i32 = converted %A.call, %.loc11_21.1 // CHECK:STDOUT: br !if.expr.result(%.loc11_21.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] // CHECK:STDOUT: %B.call: init i32 = call %B.ref() // CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %B.call // CHECK:STDOUT: %.loc11_24.2: i32 = converted %B.call, %.loc11_24.1 diff --git a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon index c807e24a62b7..60ece97855d2 100644 --- a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon +++ b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon @@ -38,16 +38,19 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: --- fail_non_constant_condition.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] +// CHECK:STDOUT: %ConditionIsNonConstant: type = fn_type @ConditionIsNonConstant [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: ConditionIsNonConstant = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .ConditionIsNonConstant = %ConditionIsNonConstant +// CHECK:STDOUT: .ConditionIsNonConstant = %ConditionIsNonConstant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %ConditionIsNonConstant: = fn_decl @ConditionIsNonConstant [template] { +// CHECK:STDOUT: %ConditionIsNonConstant.decl: ConditionIsNonConstant = fn_decl @ConditionIsNonConstant [template = constants.%struct] { // CHECK:STDOUT: %b.loc4_27.1: bool = param b // CHECK:STDOUT: @ConditionIsNonConstant.%b: bool = bind_name b, %b.loc4_27.1 // CHECK:STDOUT: } @@ -68,7 +71,7 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: %.loc12_10: type = block_arg !if.expr.result // CHECK:STDOUT: %v.var: ref = var v // CHECK:STDOUT: %v: ref = bind_name v, %v.var -// CHECK:STDOUT: %.loc12_35: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_35: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: assign %v.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -76,18 +79,21 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: --- fail_non_constant_result.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: bool = bool_literal false [template] +// CHECK:STDOUT: %ChosenBranchIsNonConstant: type = fn_type @ChosenBranchIsNonConstant [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: ChosenBranchIsNonConstant = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal true [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: bool = bool_literal false [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .ChosenBranchIsNonConstant = %ChosenBranchIsNonConstant +// CHECK:STDOUT: .ChosenBranchIsNonConstant = %ChosenBranchIsNonConstant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %ChosenBranchIsNonConstant: = fn_decl @ChosenBranchIsNonConstant [template] { +// CHECK:STDOUT: %ChosenBranchIsNonConstant.decl: ChosenBranchIsNonConstant = fn_decl @ChosenBranchIsNonConstant [template = constants.%struct] { // CHECK:STDOUT: %t.loc4_30.1: type = param t // CHECK:STDOUT: @ChosenBranchIsNonConstant.%t: type = bind_name t, %t.loc4_30.1 // CHECK:STDOUT: } @@ -95,7 +101,7 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: // CHECK:STDOUT: fn @ChosenBranchIsNonConstant(%t: type) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_13: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc9_13: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc9_13 br !if.expr.then.loc9 else br !if.expr.else.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc9: @@ -109,9 +115,9 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: %.loc9_10: type = block_arg !if.expr.result.loc9 // CHECK:STDOUT: %v.var: ref = var v // CHECK:STDOUT: %v: ref = bind_name v, %v.var -// CHECK:STDOUT: %.loc9_36: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_36: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: assign %v.var, -// CHECK:STDOUT: %.loc13_13: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc13_13: bool = bool_literal false [template = constants.%.4] // CHECK:STDOUT: if %.loc13_13 br !if.expr.then.loc13 else br !if.expr.else.loc13 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc13: @@ -125,7 +131,7 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: %.loc13_10: type = block_arg !if.expr.result.loc13 // CHECK:STDOUT: %w.var: ref = var w // CHECK:STDOUT: %w: ref = bind_name w, %w.var -// CHECK:STDOUT: %.loc13_37: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_37: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: assign %w.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if_expr/nested.carbon b/toolchain/check/testdata/if_expr/nested.carbon index 77d389c0b3fa..7d019fcf6e6c 100644 --- a/toolchain/check/testdata/if_expr/nested.carbon +++ b/toolchain/check/testdata/if_expr/nested.carbon @@ -11,19 +11,22 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: --- nested.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 4 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // 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 @@ -44,11 +47,11 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.expr.then.loc8_20 else br !if.expr.else.loc8_20 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc8_20: -// CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: br !if.expr.result.loc8_20(%.loc8_30) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc8_20: -// CHECK:STDOUT: %.loc8_37: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_37: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: br !if.expr.result.loc8_20(%.loc8_37) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc8_20: @@ -60,11 +63,11 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: if %c.ref br !if.expr.then.loc8_44 else br !if.expr.else.loc8_44 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc8_44: -// CHECK:STDOUT: %.loc8_54: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_54: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: br !if.expr.result.loc8_44(%.loc8_54) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc8_44: -// CHECK:STDOUT: %.loc8_61: i32 = int_literal 4 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_61: i32 = int_literal 4 [template = constants.%.5] // CHECK:STDOUT: br !if.expr.result.loc8_44(%.loc8_61) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc8_44: diff --git a/toolchain/check/testdata/if_expr/struct.carbon b/toolchain/check/testdata/if_expr/struct.carbon index 9c54d36b55b7..760e753d0585 100644 --- a/toolchain/check/testdata/if_expr/struct.carbon +++ b/toolchain/check/testdata/if_expr/struct.carbon @@ -15,26 +15,30 @@ fn F(cond: bool) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.3, %.4) [template] -// CHECK:STDOUT: %.5: type = tuple_type () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %struct.3: {.a: i32, .b: i32} = struct_value (%.4, %.5) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %cond.loc9_6.1: bool = param cond // CHECK:STDOUT: @F.%cond: bool = bind_name cond, %cond.loc9_6.1 // CHECK:STDOUT: } @@ -47,17 +51,17 @@ fn F(cond: bool) { // CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] // CHECK:STDOUT: %a.var: ref {.a: i32, .b: i32} = var a // CHECK:STDOUT: %a: ref {.a: i32, .b: i32} = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_45: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_45: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %.loc10_46.1: {.a: i32, .b: i32} = struct_literal (%.loc10_37, %.loc10_45) // CHECK:STDOUT: %.loc10_46.2: ref i32 = struct_access %a.var, element0 -// CHECK:STDOUT: %.loc10_46.3: init i32 = initialize_from %.loc10_37 to %.loc10_46.2 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_46.3: init i32 = initialize_from %.loc10_37 to %.loc10_46.2 [template = constants.%.4] // CHECK:STDOUT: %.loc10_46.4: ref i32 = struct_access %a.var, element1 -// CHECK:STDOUT: %.loc10_46.5: init i32 = initialize_from %.loc10_45 to %.loc10_46.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_46.6: init {.a: i32, .b: i32} = struct_init (%.loc10_46.3, %.loc10_46.5) to %a.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_47: init {.a: i32, .b: i32} = converted %.loc10_46.1, %.loc10_46.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_46.5: init i32 = initialize_from %.loc10_45 to %.loc10_46.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_46.6: init {.a: i32, .b: i32} = struct_init (%.loc10_46.3, %.loc10_46.5) to %a.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_47: init {.a: i32, .b: i32} = converted %.loc10_46.1, %.loc10_46.6 [template = constants.%struct.3] // CHECK:STDOUT: assign %a.var, %.loc10_47 -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.1] // CHECK:STDOUT: %cond.ref: bool = name_ref cond, %cond // CHECK:STDOUT: if %cond.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/compound.carbon b/toolchain/check/testdata/impl/compound.carbon index 35775d0ed2a4..fb3bf940b915 100644 --- a/toolchain/check/testdata/impl/compound.carbon +++ b/toolchain/check/testdata/impl/compound.carbon @@ -35,43 +35,60 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Simple [template] // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Simple, [template] -// CHECK:STDOUT: %.3: in Simple> = assoc_entity element0, @Simple.%F [template] -// CHECK:STDOUT: %.4: in Simple> = assoc_entity element1, @Simple.%G [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.%F, @impl.%G) [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] -// CHECK:STDOUT: %.7: type = ptr_type i32 [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Simple, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Simple.%F.decl [template] +// CHECK:STDOUT: %G.1: type = fn_type @G.1 [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @Simple, G [template] +// CHECK:STDOUT: %.6: = assoc_entity element1, @Simple.%G.decl [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %G.2: type = fn_type @G.2 [template] +// CHECK:STDOUT: %struct.4: G = struct_value () [template] +// CHECK:STDOUT: %.7: = interface_witness (%struct.3, %struct.4) [template] +// CHECK:STDOUT: %NonInstanceCall: type = fn_type @NonInstanceCall [template] +// CHECK:STDOUT: %struct.5: NonInstanceCall = struct_value () [template] +// CHECK:STDOUT: %InstanceCall: type = fn_type @InstanceCall [template] +// CHECK:STDOUT: %struct.6: InstanceCall = struct_value () [template] +// CHECK:STDOUT: %.8: type = ptr_type i32 [template] +// CHECK:STDOUT: %NonInstanceCallIndirect: type = fn_type @NonInstanceCallIndirect [template] +// CHECK:STDOUT: %struct.7: NonInstanceCallIndirect = struct_value () [template] +// CHECK:STDOUT: %InstanceCallIndirect: type = fn_type @InstanceCallIndirect [template] +// CHECK:STDOUT: %struct.8: InstanceCallIndirect = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Simple = %Simple.decl -// CHECK:STDOUT: .NonInstanceCall = %NonInstanceCall -// CHECK:STDOUT: .InstanceCall = %InstanceCall -// CHECK:STDOUT: .NonInstanceCallIndirect = %NonInstanceCallIndirect -// CHECK:STDOUT: .InstanceCallIndirect = %InstanceCallIndirect +// CHECK:STDOUT: .NonInstanceCall = %NonInstanceCall.decl +// CHECK:STDOUT: .InstanceCall = %InstanceCall.decl +// CHECK:STDOUT: .NonInstanceCallIndirect = %NonInstanceCallIndirect.decl +// CHECK:STDOUT: .InstanceCallIndirect = %InstanceCallIndirect.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Simple.decl: type = 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: %NonInstanceCall: = fn_decl @NonInstanceCall [template] { +// CHECK:STDOUT: %NonInstanceCall.decl: NonInstanceCall = fn_decl @NonInstanceCall [template = constants.%struct.5] { // CHECK:STDOUT: %n.loc17_20.1: i32 = param n // CHECK:STDOUT: @NonInstanceCall.%n: i32 = bind_name n, %n.loc17_20.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %InstanceCall: = fn_decl @InstanceCall [template] { +// CHECK:STDOUT: %InstanceCall.decl: InstanceCall = fn_decl @InstanceCall [template = constants.%struct.6] { // CHECK:STDOUT: %n.loc21_17.1: i32 = param n // CHECK:STDOUT: @InstanceCall.%n: i32 = bind_name n, %n.loc21_17.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %NonInstanceCallIndirect: = fn_decl @NonInstanceCallIndirect [template] { -// CHECK:STDOUT: %.loc25: type = ptr_type i32 [template = constants.%.7] +// CHECK:STDOUT: %NonInstanceCallIndirect.decl: NonInstanceCallIndirect = fn_decl @NonInstanceCallIndirect [template = constants.%struct.7] { +// CHECK:STDOUT: %.loc25: type = ptr_type i32 [template = constants.%.8] // CHECK:STDOUT: %p.loc25_28.1: i32* = param p // CHECK:STDOUT: @NonInstanceCallIndirect.%p: i32* = bind_name p, %p.loc25_28.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %InstanceCallIndirect: = fn_decl @InstanceCallIndirect [template] { -// CHECK:STDOUT: %.loc29: type = ptr_type i32 [template = constants.%.7] +// CHECK:STDOUT: %InstanceCallIndirect.decl: InstanceCallIndirect = fn_decl @InstanceCallIndirect [template = constants.%struct.8] { +// CHECK:STDOUT: %.loc29: type = ptr_type i32 [template = constants.%.8] // CHECK:STDOUT: %p.loc29_25.1: i32* = param p // CHECK:STDOUT: @InstanceCallIndirect.%p: i32* = bind_name p, %p.loc29_25.1 // CHECK:STDOUT: } @@ -79,35 +96,35 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc8: in Simple> = assoc_entity element0, %F [template = constants.%.3] -// CHECK:STDOUT: %G: = fn_decl @G.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %G.decl: G = fn_decl @G.1 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: Simple = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc9_14.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] // CHECK:STDOUT: %.loc9_14.2: type = converted %Self.ref, %.loc9_14.1 [symbolic = constants.%Self] // CHECK:STDOUT: %self.loc9_8.1: Self = param self // CHECK:STDOUT: %self.loc9_8.2: Self = bind_name self, %self.loc9_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc9_21: in Simple> = assoc_entity element1, %G [template = constants.%.4] +// CHECK:STDOUT: %.loc9_21: = assoc_entity element1, %G.decl [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8 // CHECK:STDOUT: .G = %.loc9_21 -// CHECK:STDOUT: witness = (%F, %G) +// CHECK:STDOUT: witness = (%F.decl, %G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as Simple { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} -// CHECK:STDOUT: %G: = fn_decl @G.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G.2 [template = constants.%struct.4] { // CHECK:STDOUT: %self.loc14_8.1: i32 = param self // CHECK:STDOUT: %self.loc14_8.2: i32 = bind_name self, %self.loc14_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%F, %G) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%F.decl, %G.decl) [template = constants.%.7] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -123,8 +140,8 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: in Simple> = name_ref F, @Simple.%.loc8 [template = constants.%.3] -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] +// CHECK:STDOUT: %F.ref: = name_ref F, @Simple.%.loc8 [template = constants.%.4] +// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.3] // CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -133,10 +150,10 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] -// CHECK:STDOUT: %G.ref: in Simple> = name_ref G, @Simple.%.loc9_21 [template = constants.%.4] -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element1 [template = @impl.%G] -// CHECK:STDOUT: %.loc22_4: = bound_method %n.ref, %.1 -// CHECK:STDOUT: %.loc22_15: init () = call %.loc22_4(%n.ref) +// CHECK:STDOUT: %G.ref: = name_ref G, @Simple.%.loc9_21 [template = constants.%.6] +// CHECK:STDOUT: %.1: G = interface_witness_access @impl.%.1, element1 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22: = bound_method %n.ref, %.1 +// CHECK:STDOUT: %G.call: init () = call %.loc22(%n.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -144,9 +161,9 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: i32* = name_ref p, %p // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: in Simple> = name_ref F, @Simple.%.loc8 [template = constants.%.3] +// CHECK:STDOUT: %F.ref: = name_ref F, @Simple.%.loc8 [template = constants.%.4] // CHECK:STDOUT: %.loc26: ref i32 = deref %p.ref -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] +// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.3] // CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -155,12 +172,12 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: i32* = name_ref p, %p // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] -// CHECK:STDOUT: %G.ref: in Simple> = name_ref G, @Simple.%.loc9_21 [template = constants.%.4] +// CHECK:STDOUT: %G.ref: = name_ref G, @Simple.%.loc9_21 [template = constants.%.6] // CHECK:STDOUT: %.loc30_4.1: ref i32 = deref %p.ref -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element1 [template = @impl.%G] +// CHECK:STDOUT: %.1: G = interface_witness_access @impl.%.1, element1 [template = constants.%struct.4] // CHECK:STDOUT: %.loc30_4.2: = bound_method %.loc30_4.1, %.1 // CHECK:STDOUT: %.loc30_4.3: i32 = bind_value %.loc30_4.1 -// CHECK:STDOUT: %.loc30_16: init () = call %.loc30_4.2(%.loc30_4.3) +// CHECK:STDOUT: %G.call: init () = call %.loc30_4.2(%.loc30_4.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/extend_impl.carbon b/toolchain/check/testdata/impl/extend_impl.carbon index 3544d9543db9..4caa8cc2eab7 100644 --- a/toolchain/check/testdata/impl/extend_impl.carbon +++ b/toolchain/check/testdata/impl/extend_impl.carbon @@ -24,12 +24,18 @@ fn G(c: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @HasF [template] // CHECK:STDOUT: %Self: HasF = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @HasF, [template] -// CHECK:STDOUT: %.3: in HasF> = assoc_entity element0, @HasF.%F [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @HasF, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @HasF.%F.decl [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.4: = interface_witness (@impl.%F) [template] -// CHECK:STDOUT: %.5: type = struct_type {} [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.5: = interface_witness (%struct.2) [template] +// CHECK:STDOUT: %.6: type = struct_type {} [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.3: G = struct_value () [template] // CHECK:STDOUT: %.7: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -38,12 +44,12 @@ fn G(c: C) { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .HasF = %HasF.decl // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [template = constants.%.1] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { // 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 @@ -52,21 +58,21 @@ fn G(c: C) { // CHECK:STDOUT: // CHECK:STDOUT: interface @HasF { // CHECK:STDOUT: %Self: HasF = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc8: in HasF> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as HasF { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.4] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -90,12 +96,12 @@ fn G(c: C) { // CHECK:STDOUT: fn @G(%c: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %F.ref.loc18: in HasF> = name_ref F, @HasF.%.loc8 [template = constants.%.3] -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] +// CHECK:STDOUT: %F.ref.loc18: = name_ref F, @HasF.%.loc8 [template = constants.%.4] +// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] // CHECK:STDOUT: %F.call.loc18: init () = call %.1() // CHECK:STDOUT: %c.ref: C = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc19: in HasF> = name_ref F, @HasF.%.loc8 [template = constants.%.3] -// CHECK:STDOUT: %.2: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] +// CHECK:STDOUT: %F.ref.loc19: = name_ref F, @HasF.%.loc8 [template = constants.%.4] +// CHECK:STDOUT: %.2: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] // CHECK:STDOUT: %F.call.loc19: init () = call %.2() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/fail_call_invalid.carbon b/toolchain/check/testdata/impl/fail_call_invalid.carbon index ad80c5f921e6..f838e190cc2f 100644 --- a/toolchain/check/testdata/impl/fail_call_invalid.carbon +++ b/toolchain/check/testdata/impl/fail_call_invalid.carbon @@ -24,22 +24,29 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Simple [template] // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Simple, [template] -// CHECK:STDOUT: %.3: in Simple> = assoc_entity element0, @Simple.%G [template] +// CHECK:STDOUT: %G.1: type = fn_type @G.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Simple, G [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Simple.%G.decl [template] +// CHECK:STDOUT: %G.2: type = fn_type @G.2 [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %InstanceCall: type = fn_type @InstanceCall [template] +// CHECK:STDOUT: %struct.3: InstanceCall = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Simple = %Simple.decl -// CHECK:STDOUT: .InstanceCall = %InstanceCall +// CHECK:STDOUT: .InstanceCall = %InstanceCall.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Simple.decl: type = 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: %InstanceCall: = fn_decl @InstanceCall [template] { +// CHECK:STDOUT: %InstanceCall.decl: InstanceCall = fn_decl @InstanceCall [template = constants.%struct.3] { // CHECK:STDOUT: %n.loc18_17.1: i32 = param n // CHECK:STDOUT: @InstanceCall.%n: i32 = bind_name n, %n.loc18_17.1 // CHECK:STDOUT: } @@ -47,23 +54,23 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %G: = fn_decl @G.1 [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: Simple = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc8_14.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] // CHECK:STDOUT: %.loc8_14.2: type = converted %Self.ref, %.loc8_14.1 [symbolic = constants.%Self] // CHECK:STDOUT: %self.loc8_8.1: Self = param self // CHECK:STDOUT: %self.loc8_8.2: Self = bind_name self, %self.loc8_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_21: in Simple> = assoc_entity element0, %G [template = constants.%.3] +// CHECK:STDOUT: %.loc8_21: = assoc_entity element0, %G.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .G = %.loc8_21 -// CHECK:STDOUT: witness = (%G) +// CHECK:STDOUT: witness = (%G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as Simple { -// CHECK:STDOUT: %G: = fn_decl @G.2 [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Undeclared.ref: = name_ref Undeclared, [template = ] // CHECK:STDOUT: %self.loc15_8.1: = param self // CHECK:STDOUT: %self.loc15_8.2: = bind_name self, %self.loc15_8.1 @@ -71,7 +78,7 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -83,8 +90,9 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] -// CHECK:STDOUT: %G.ref: in Simple> = name_ref G, @Simple.%.loc8_21 [template = constants.%.3] -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = ] +// CHECK:STDOUT: %G.ref: = name_ref G, @Simple.%.loc8_21 [template = constants.%.4] +// CHECK:STDOUT: %.1: G = interface_witness_access @impl.%.1, element0 [template = ] +// CHECK:STDOUT: %.loc19: = bound_method %n.ref, %.1 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon index 10410695a279..72c6ae1047c4 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon @@ -35,10 +35,15 @@ class C { // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] // CHECK:STDOUT: %.1: type = interface_type @GenericInterface [template] // CHECK:STDOUT: %Self: GenericInterface = bind_symbolic_name Self 1 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @GenericInterface, [template] -// CHECK:STDOUT: %.3: in GenericInterface> = assoc_entity element0, @GenericInterface.%F [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @GenericInterface, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @GenericInterface.%F.decl [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.4: type = struct_type {} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.5: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -57,28 +62,28 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: interface @GenericInterface { // CHECK:STDOUT: %Self: GenericInterface = bind_symbolic_name Self 1 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { // CHECK:STDOUT: %T.ref: type = name_ref T, file.%T.loc11_28.2 [symbolic = constants.%T] // CHECK:STDOUT: %x.loc12_8.1: T = param x // CHECK:STDOUT: %x.loc12_8.2: T = bind_name x, %x.loc12_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12: in GenericInterface> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc12 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: %T.ref: type = name_ref T, @C.%T.loc27_23.2 [symbolic = constants.%T] // CHECK:STDOUT: %x.loc28_10.1: T = param x // CHECK:STDOUT: %x.loc28_10.2: T = bind_name x, %x.loc28_10.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon index ca267ace2d00..4112a944967e 100644 --- a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon +++ b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon @@ -20,9 +20,14 @@ impl as Simple { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Simple [template] // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Simple, [template] -// CHECK:STDOUT: %.3: in Simple> = assoc_entity element0, @Simple.%F [template] -// CHECK:STDOUT: %.4: = interface_witness (@impl.%F) [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Simple, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Simple.%F.decl [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.5: = interface_witness (%struct.2) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -39,21 +44,21 @@ impl as Simple { // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc8: in Simple> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: as Simple { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.4] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon index 56222fa90c70..85324efd4f62 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon @@ -214,49 +214,82 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self.1: I = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @I, [template] -// CHECK:STDOUT: %.3: in I> = assoc_entity element0, @I.%F [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @I, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @I.%F.decl [template] // CHECK:STDOUT: %NoF: type = class_type @NoF [template] -// CHECK:STDOUT: %.4: type = struct_type {} [template] +// CHECK:STDOUT: %.5: type = struct_type {} [template] // CHECK:STDOUT: %FNotFunction: type = class_type @FNotFunction [template] -// CHECK:STDOUT: %F: type = class_type @F.16 [template] +// CHECK:STDOUT: %F.2: type = class_type @F.16 [template] +// CHECK:STDOUT: %PossiblyF: type = fn_type @PossiblyF [template] +// CHECK:STDOUT: %struct.2: PossiblyF = struct_value () [template] // CHECK:STDOUT: %FAlias: type = class_type @FAlias [template] // CHECK:STDOUT: %FExtraParam: type = class_type @FExtraParam [template] +// CHECK:STDOUT: %F.3: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %FExtraImplicitParam: type = class_type @FExtraImplicitParam [template] +// CHECK:STDOUT: %F.4: type = fn_type @F.3 [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] // CHECK:STDOUT: %FExtraReturnType: type = class_type @FExtraReturnType [template] -// CHECK:STDOUT: %.5: type = interface_type @J [template] +// CHECK:STDOUT: %F.5: type = fn_type @F.4 [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] +// CHECK:STDOUT: %.6: type = interface_type @J [template] // CHECK:STDOUT: %Self.2: J = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.6: type = assoc_entity_type @J, [template] -// CHECK:STDOUT: %.7: in J> = assoc_entity element0, @J.%F [template] +// CHECK:STDOUT: %F.6: type = fn_type @F.5 [template] +// CHECK:STDOUT: %struct.6: F = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @J, F [template] +// CHECK:STDOUT: %.8: = assoc_entity element0, @J.%F.decl [template] // CHECK:STDOUT: %FMissingParam: type = class_type @FMissingParam [template] +// CHECK:STDOUT: %F.7: type = fn_type @F.6 [template] +// CHECK:STDOUT: %struct.7: F = struct_value () [template] // CHECK:STDOUT: %FMissingImplicitParam: type = class_type @FMissingImplicitParam [template] +// CHECK:STDOUT: %F.8: type = fn_type @F.7 [template] +// CHECK:STDOUT: %struct.8: F = struct_value () [template] // CHECK:STDOUT: %FMissingReturnType: type = class_type @FMissingReturnType [template] +// CHECK:STDOUT: %F.9: type = fn_type @F.8 [template] +// CHECK:STDOUT: %struct.9: F = struct_value () [template] // CHECK:STDOUT: %FDifferentParamType: type = class_type @FDifferentParamType [template] +// CHECK:STDOUT: %F.10: type = fn_type @F.9 [template] +// CHECK:STDOUT: %struct.10: F = struct_value () [template] // CHECK:STDOUT: %FDifferentImplicitParamType: type = class_type @FDifferentImplicitParamType [template] +// CHECK:STDOUT: %F.11: type = fn_type @F.10 [template] +// CHECK:STDOUT: %struct.11: F = struct_value () [template] // CHECK:STDOUT: %FDifferentReturnType: type = class_type @FDifferentReturnType [template] +// CHECK:STDOUT: %F.12: type = fn_type @F.11 [template] +// CHECK:STDOUT: %struct.12: F = struct_value () [template] // CHECK:STDOUT: %FDifferentParamName: type = class_type @FDifferentParamName [template] -// CHECK:STDOUT: %.8: type = interface_type @SelfNested [template] +// CHECK:STDOUT: %F.13: type = fn_type @F.12 [template] +// CHECK:STDOUT: %struct.13: F = struct_value () [template] +// CHECK:STDOUT: %.9: type = interface_type @SelfNested [template] // CHECK:STDOUT: %Self.3: SelfNested = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.9: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.10: type = struct_type {.x: Self, .y: i32} [symbolic] -// CHECK:STDOUT: %.11: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.12: type = tuple_type (Self*, {.x: Self, .y: i32}) [symbolic] -// CHECK:STDOUT: %.13: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.14: type = array_type %.13, Self [symbolic] -// CHECK:STDOUT: %.15: type = assoc_entity_type @SelfNested, [template] -// CHECK:STDOUT: %.16: in SelfNested> = assoc_entity element0, @SelfNested.%F [template] +// CHECK:STDOUT: %.10: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %.11: type = struct_type {.x: Self, .y: i32} [symbolic] +// CHECK:STDOUT: %.12: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.13: type = tuple_type (Self*, {.x: Self, .y: i32}) [symbolic] +// CHECK:STDOUT: %.14: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.15: type = array_type %.14, Self [symbolic] +// CHECK:STDOUT: %F.14: type = fn_type @F.13 [template] +// CHECK:STDOUT: %struct.14: F = struct_value () [template] +// CHECK:STDOUT: %.16: type = assoc_entity_type @SelfNested, F [template] +// CHECK:STDOUT: %.17: = assoc_entity element0, @SelfNested.%F.decl [template] // CHECK:STDOUT: %SelfNestedBadParam: type = class_type @SelfNestedBadParam [template] -// CHECK:STDOUT: %.17: type = ptr_type SelfNestedBadParam [template] -// CHECK:STDOUT: %.18: type = struct_type {.x: i32, .y: i32} [template] -// CHECK:STDOUT: %.19: type = tuple_type (SelfNestedBadParam*, {.x: i32, .y: i32}) [template] -// CHECK:STDOUT: %.20: type = array_type %.13, SelfNestedBadParam [template] -// CHECK:STDOUT: %.21: type = struct_type {.x: SelfNestedBadParam, .y: i32} [template] -// CHECK:STDOUT: %.22: type = tuple_type (SelfNestedBadParam*, {.x: SelfNestedBadParam, .y: i32}) [template] +// CHECK:STDOUT: %.18: type = ptr_type SelfNestedBadParam [template] +// CHECK:STDOUT: %.19: type = struct_type {.x: i32, .y: i32} [template] +// CHECK:STDOUT: %.20: type = tuple_type (SelfNestedBadParam*, {.x: i32, .y: i32}) [template] +// CHECK:STDOUT: %.21: type = array_type %.14, SelfNestedBadParam [template] +// CHECK:STDOUT: %F.15: type = fn_type @F.14 [template] +// CHECK:STDOUT: %struct.15: F = struct_value () [template] +// CHECK:STDOUT: %.22: type = struct_type {.x: SelfNestedBadParam, .y: i32} [template] +// CHECK:STDOUT: %.23: type = tuple_type (SelfNestedBadParam*, {.x: SelfNestedBadParam, .y: i32}) [template] // CHECK:STDOUT: %SelfNestedBadReturnType: type = class_type @SelfNestedBadReturnType [template] -// CHECK:STDOUT: %.23: type = ptr_type SelfNestedBadReturnType [template] -// CHECK:STDOUT: %.24: type = struct_type {.x: SelfNestedBadReturnType, .y: i32} [template] -// CHECK:STDOUT: %.25: type = tuple_type (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) [template] -// CHECK:STDOUT: %.26: type = array_type %.13, SelfNestedBadReturnType [template] +// CHECK:STDOUT: %.24: type = ptr_type SelfNestedBadReturnType [template] +// CHECK:STDOUT: %.25: type = struct_type {.x: SelfNestedBadReturnType, .y: i32} [template] +// CHECK:STDOUT: %.26: type = tuple_type (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) [template] +// CHECK:STDOUT: %F.16: type = fn_type @F.15 [template] +// CHECK:STDOUT: %struct.16: F = struct_value () [template] +// CHECK:STDOUT: %.27: type = array_type %.14, SelfNestedBadReturnType [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -265,7 +298,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: .I = %I.decl // CHECK:STDOUT: .NoF = %NoF.decl // CHECK:STDOUT: .FNotFunction = %FNotFunction.decl -// CHECK:STDOUT: .PossiblyF = %PossiblyF +// CHECK:STDOUT: .PossiblyF = %PossiblyF.decl // CHECK:STDOUT: .FAlias = %FAlias.decl // CHECK:STDOUT: .FExtraParam = %FExtraParam.decl // CHECK:STDOUT: .FExtraImplicitParam = %FExtraImplicitParam.decl @@ -286,12 +319,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} // CHECK:STDOUT: %NoF.decl: type = class_decl @NoF [template = constants.%NoF] {} // CHECK:STDOUT: %FNotFunction.decl: type = class_decl @FNotFunction [template = constants.%FNotFunction] {} -// CHECK:STDOUT: %PossiblyF: = fn_decl @PossiblyF [template] {} +// CHECK:STDOUT: %PossiblyF.decl: PossiblyF = fn_decl @PossiblyF [template = constants.%struct.2] {} // CHECK:STDOUT: %FAlias.decl: type = class_decl @FAlias [template = constants.%FAlias] {} // CHECK:STDOUT: %FExtraParam.decl: type = class_decl @FExtraParam [template = constants.%FExtraParam] {} // CHECK:STDOUT: %FExtraImplicitParam.decl: type = class_decl @FExtraImplicitParam [template = constants.%FExtraImplicitParam] {} // CHECK:STDOUT: %FExtraReturnType.decl: type = class_decl @FExtraReturnType [template = constants.%FExtraReturnType] {} -// CHECK:STDOUT: %J.decl: type = interface_decl @J [template = constants.%.5] {} +// CHECK:STDOUT: %J.decl: type = interface_decl @J [template = constants.%.6] {} // CHECK:STDOUT: %FMissingParam.decl: type = class_decl @FMissingParam [template = constants.%FMissingParam] {} // CHECK:STDOUT: %FMissingImplicitParam.decl: type = class_decl @FMissingImplicitParam [template = constants.%FMissingImplicitParam] {} // CHECK:STDOUT: %FMissingReturnType.decl: type = class_decl @FMissingReturnType [template = constants.%FMissingReturnType] {} @@ -299,67 +332,67 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %FDifferentImplicitParamType.decl: type = class_decl @FDifferentImplicitParamType [template = constants.%FDifferentImplicitParamType] {} // CHECK:STDOUT: %FDifferentReturnType.decl: type = class_decl @FDifferentReturnType [template = constants.%FDifferentReturnType] {} // CHECK:STDOUT: %FDifferentParamName.decl: type = class_decl @FDifferentParamName [template = constants.%FDifferentParamName] {} -// CHECK:STDOUT: %SelfNested.decl: type = interface_decl @SelfNested [template = constants.%.8] {} +// CHECK:STDOUT: %SelfNested.decl: type = interface_decl @SelfNested [template = constants.%.9] {} // CHECK:STDOUT: %SelfNestedBadParam.decl: type = class_decl @SelfNestedBadParam [template = constants.%SelfNestedBadParam] {} // CHECK:STDOUT: %SelfNestedBadReturnType.decl: type = class_decl @SelfNestedBadReturnType [template = constants.%SelfNestedBadReturnType] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc7: in I> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc7: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc7 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @J { // CHECK:STDOUT: %Self: J = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %F: = fn_decl @F.5 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.5 [template = constants.%struct.6] { // CHECK:STDOUT: %self.loc89_20.1: bool = param self // CHECK:STDOUT: %self.loc89_20.2: bool = bind_name self, %self.loc89_20.1 // CHECK:STDOUT: %b.loc89_32.1: bool = param b // CHECK:STDOUT: %b.loc89_32.2: bool = bind_name b, %b.loc89_32.1 // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc89: in J> = assoc_entity element0, %F [template = constants.%.7] +// CHECK:STDOUT: %.loc89: = assoc_entity element0, %F.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc89 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @SelfNested { // CHECK:STDOUT: %Self: SelfNested = bind_symbolic_name Self 0 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %F: = fn_decl @F.13 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.13 [template = constants.%struct.14] { // CHECK:STDOUT: %Self.ref.loc184_12: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.3] // CHECK:STDOUT: %.loc184_16.1: type = facet_type_access %Self.ref.loc184_12 [symbolic = constants.%Self.3] // CHECK:STDOUT: %.loc184_16.2: type = converted %Self.ref.loc184_12, %.loc184_16.1 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc184_16.3: type = ptr_type Self [symbolic = constants.%.9] +// CHECK:STDOUT: %.loc184_16.3: type = ptr_type Self [symbolic = constants.%.10] // CHECK:STDOUT: %Self.ref.loc184_24: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.3] // CHECK:STDOUT: %.loc184_24.1: type = facet_type_access %Self.ref.loc184_24 [symbolic = constants.%Self.3] // CHECK:STDOUT: %.loc184_24.2: type = converted %Self.ref.loc184_24, %.loc184_24.1 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc184_37: type = struct_type {.x: Self, .y: i32} [symbolic = constants.%.10] +// CHECK:STDOUT: %.loc184_37: type = struct_type {.x: Self, .y: i32} [symbolic = constants.%.11] // CHECK:STDOUT: %.loc184_38.1: (type, type) = tuple_literal (%.loc184_16.3, %.loc184_37) -// CHECK:STDOUT: %.loc184_38.2: type = converted %.loc184_38.1, constants.%.12 [symbolic = constants.%.12] +// CHECK:STDOUT: %.loc184_38.2: type = converted %.loc184_38.1, constants.%.13 [symbolic = constants.%.13] // CHECK:STDOUT: %x.loc184_8.1: (Self*, {.x: Self, .y: i32}) = param x // CHECK:STDOUT: %x.loc184_8.2: (Self*, {.x: Self, .y: i32}) = bind_name x, %x.loc184_8.1 // CHECK:STDOUT: %Self.ref.loc184_45: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc184_51: i32 = int_literal 4 [template = constants.%.13] +// CHECK:STDOUT: %.loc184_51: i32 = int_literal 4 [template = constants.%.14] // CHECK:STDOUT: %.loc184_45.1: type = facet_type_access %Self.ref.loc184_45 [symbolic = constants.%Self.3] // CHECK:STDOUT: %.loc184_45.2: type = converted %Self.ref.loc184_45, %.loc184_45.1 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc184_52: type = array_type %.loc184_51, Self [symbolic = constants.%.14] +// CHECK:STDOUT: %.loc184_52: type = array_type %.loc184_51, Self [symbolic = constants.%.15] // CHECK:STDOUT: %return.var: ref [Self; 4] = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc184_53: in SelfNested> = assoc_entity element0, %F [template = constants.%.16] +// CHECK:STDOUT: %.loc184_53: = assoc_entity element0, %F.decl [template = constants.%.17] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc184_53 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: NoF as I { @@ -370,7 +403,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: FNotFunction as I { -// CHECK:STDOUT: %F.decl: type = class_decl @F.16 [template = constants.%F] {} +// CHECK:STDOUT: %F.decl: type = class_decl @F.16 [template = constants.%F.2] {} // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -379,8 +412,8 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.3: FAlias as I { -// CHECK:STDOUT: %PossiblyF.ref: = name_ref PossiblyF, file.%PossiblyF [template = file.%PossiblyF] -// CHECK:STDOUT: %F: = bind_alias F, file.%PossiblyF [template = file.%PossiblyF] +// CHECK:STDOUT: %PossiblyF.ref: PossiblyF = name_ref PossiblyF, file.%PossiblyF.decl [template = constants.%struct.2] +// CHECK:STDOUT: %F: PossiblyF = bind_alias F, file.%PossiblyF.decl [template = constants.%struct.2] // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -389,19 +422,19 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.4: FExtraParam as I { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { // CHECK:STDOUT: %b.loc58_10.1: bool = param b // CHECK:STDOUT: %b.loc58_10.2: bool = bind_name b, %b.loc58_10.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.5: FExtraImplicitParam as I { -// CHECK:STDOUT: %F: = fn_decl @F.3 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.4] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraImplicitParam [template = constants.%FExtraImplicitParam] // CHECK:STDOUT: %self.loc71_10.1: FExtraImplicitParam = param self // CHECK:STDOUT: %self.loc71_10.2: FExtraImplicitParam = bind_name self, %self.loc71_10.1 @@ -409,23 +442,23 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.6: FExtraReturnType as I { -// CHECK:STDOUT: %F: = fn_decl @F.4 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.4 [template = constants.%struct.5] { // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.7: FMissingParam as J { -// CHECK:STDOUT: %F: = fn_decl @F.6 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.6 [template = constants.%struct.7] { // CHECK:STDOUT: %self.loc100_10.1: bool = param self // CHECK:STDOUT: %self.loc100_10.2: bool = bind_name self, %self.loc100_10.1 // CHECK:STDOUT: %return.var: ref bool = var @@ -433,12 +466,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.8: FMissingImplicitParam as J { -// CHECK:STDOUT: %F: = fn_decl @F.7 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.7 [template = constants.%struct.8] { // CHECK:STDOUT: %b.loc113_10.1: bool = param b // CHECK:STDOUT: %b.loc113_10.2: bool = bind_name b, %b.loc113_10.1 // CHECK:STDOUT: %return.var: ref bool = var @@ -446,12 +479,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.9: FMissingReturnType as J { -// CHECK:STDOUT: %F: = fn_decl @F.8 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.8 [template = constants.%struct.9] { // CHECK:STDOUT: %self.loc126_10.1: bool = param self // CHECK:STDOUT: %self.loc126_10.2: bool = bind_name self, %self.loc126_10.1 // CHECK:STDOUT: %b.loc126_22.1: bool = param b @@ -460,12 +493,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.10: FDifferentParamType as J { -// CHECK:STDOUT: %F: = fn_decl @F.9 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.9 [template = constants.%struct.10] { // CHECK:STDOUT: %self.loc139_10.1: bool = param self // CHECK:STDOUT: %self.loc139_10.2: bool = bind_name self, %self.loc139_10.1 // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentParamType [template = constants.%FDifferentParamType] @@ -476,12 +509,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.11: FDifferentImplicitParamType as J { -// CHECK:STDOUT: %F: = fn_decl @F.10 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.10 [template = constants.%struct.11] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentImplicitParamType [template = constants.%FDifferentImplicitParamType] // CHECK:STDOUT: %self.loc152_10.1: FDifferentImplicitParamType = param self // CHECK:STDOUT: %self.loc152_10.2: FDifferentImplicitParamType = bind_name self, %self.loc152_10.1 @@ -492,12 +525,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.12: FDifferentReturnType as J { -// CHECK:STDOUT: %F: = fn_decl @F.11 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.11 [template = constants.%struct.12] { // CHECK:STDOUT: %self.loc165_10.1: bool = param self // CHECK:STDOUT: %self.loc165_10.2: bool = bind_name self, %self.loc165_10.1 // CHECK:STDOUT: %b.loc165_22.1: bool = param b @@ -508,12 +541,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.13: FDifferentParamName as J { -// CHECK:STDOUT: %F: = fn_decl @F.12 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.12 [template = constants.%struct.13] { // CHECK:STDOUT: %self.loc179_10.1: bool = param self // CHECK:STDOUT: %self.loc179_10.2: bool = bind_name self, %self.loc179_10.1 // CHECK:STDOUT: %not_b.loc179_22.1: bool = param not_b @@ -523,50 +556,50 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.14: SelfNestedBadParam as SelfNested { -// CHECK:STDOUT: %F: = fn_decl @F.14 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.14 [template = constants.%struct.15] { // CHECK:STDOUT: %SelfNestedBadParam.ref.loc196_14: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] -// CHECK:STDOUT: %.loc196_32: type = ptr_type SelfNestedBadParam [template = constants.%.17] -// CHECK:STDOUT: %.loc196_52: type = struct_type {.x: i32, .y: i32} [template = constants.%.18] +// CHECK:STDOUT: %.loc196_32: type = ptr_type SelfNestedBadParam [template = constants.%.18] +// CHECK:STDOUT: %.loc196_52: type = struct_type {.x: i32, .y: i32} [template = constants.%.19] // CHECK:STDOUT: %.loc196_53.1: (type, type) = tuple_literal (%.loc196_32, %.loc196_52) -// CHECK:STDOUT: %.loc196_53.2: type = converted %.loc196_53.1, constants.%.19 [template = constants.%.19] +// CHECK:STDOUT: %.loc196_53.2: type = converted %.loc196_53.1, constants.%.20 [template = constants.%.20] // CHECK:STDOUT: %x.loc196_10.1: (SelfNestedBadParam*, {.x: i32, .y: i32}) = param x // CHECK:STDOUT: %x.loc196_10.2: (SelfNestedBadParam*, {.x: i32, .y: i32}) = bind_name x, %x.loc196_10.1 // CHECK:STDOUT: %SelfNestedBadParam.ref.loc196_60: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] -// CHECK:STDOUT: %.loc196_80: i32 = int_literal 4 [template = constants.%.13] -// CHECK:STDOUT: %.loc196_81: type = array_type %.loc196_80, SelfNestedBadParam [template = constants.%.20] +// CHECK:STDOUT: %.loc196_80: i32 = int_literal 4 [template = constants.%.14] +// CHECK:STDOUT: %.loc196_81: type = array_type %.loc196_80, SelfNestedBadParam [template = constants.%.21] // CHECK:STDOUT: %return.var: ref [SelfNestedBadParam; 4] = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.15: SelfNestedBadReturnType as SelfNested { -// CHECK:STDOUT: %F: = fn_decl @F.15 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.15 [template = constants.%struct.16] { // CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc208_14: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType] -// CHECK:STDOUT: %.loc208_37: type = ptr_type SelfNestedBadReturnType [template = constants.%.23] +// CHECK:STDOUT: %.loc208_37: type = ptr_type SelfNestedBadReturnType [template = constants.%.24] // CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc208_45: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType] -// CHECK:STDOUT: %.loc208_77: type = struct_type {.x: SelfNestedBadReturnType, .y: i32} [template = constants.%.24] +// CHECK:STDOUT: %.loc208_77: type = struct_type {.x: SelfNestedBadReturnType, .y: i32} [template = constants.%.25] // CHECK:STDOUT: %.loc208_78.1: (type, type) = tuple_literal (%.loc208_37, %.loc208_77) -// CHECK:STDOUT: %.loc208_78.2: type = converted %.loc208_78.1, constants.%.25 [template = constants.%.25] +// CHECK:STDOUT: %.loc208_78.2: type = converted %.loc208_78.1, constants.%.26 [template = constants.%.26] // CHECK:STDOUT: %x.loc208_10.1: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) = param x // CHECK:STDOUT: %x.loc208_10.2: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) = bind_name x, %x.loc208_10.1 // CHECK:STDOUT: %SelfNestedBadParam.ref: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] -// CHECK:STDOUT: %.loc208_105: i32 = int_literal 4 [template = constants.%.13] -// CHECK:STDOUT: %.loc208_106: type = array_type %.loc208_105, SelfNestedBadParam [template = constants.%.20] +// CHECK:STDOUT: %.loc208_105: i32 = int_literal 4 [template = constants.%.14] +// CHECK:STDOUT: %.loc208_106: type = array_type %.loc208_105, SelfNestedBadParam [template = constants.%.21] // CHECK:STDOUT: %return.var: ref [SelfNestedBadParam; 4] = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -628,7 +661,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: class @FMissingParam { // CHECK:STDOUT: impl_decl @impl.7 { -// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5] +// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -637,7 +670,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: class @FMissingImplicitParam { // CHECK:STDOUT: impl_decl @impl.8 { -// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5] +// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -646,7 +679,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: class @FMissingReturnType { // CHECK:STDOUT: impl_decl @impl.9 { -// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5] +// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -655,7 +688,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: class @FDifferentParamType { // CHECK:STDOUT: impl_decl @impl.10 { -// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5] +// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -664,7 +697,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: class @FDifferentImplicitParamType { // CHECK:STDOUT: impl_decl @impl.11 { -// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5] +// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -673,7 +706,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: class @FDifferentReturnType { // CHECK:STDOUT: impl_decl @impl.12 { -// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5] +// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -682,7 +715,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: class @FDifferentParamName { // CHECK:STDOUT: impl_decl @impl.13 { -// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.5] +// CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -691,7 +724,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: class @SelfNestedBadParam { // CHECK:STDOUT: impl_decl @impl.14 { -// CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [template = constants.%.8] +// CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [template = constants.%.9] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -700,7 +733,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: class @SelfNestedBadReturnType { // CHECK:STDOUT: impl_decl @impl.15 { -// CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [template = constants.%.8] +// CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [template = constants.%.9] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/impl/impl_as.carbon b/toolchain/check/testdata/impl/impl_as.carbon index 6efb1551a633..d2e12cd38acf 100644 --- a/toolchain/check/testdata/impl/impl_as.carbon +++ b/toolchain/check/testdata/impl/impl_as.carbon @@ -22,14 +22,18 @@ class C { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Simple [template] // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Simple, [template] -// CHECK:STDOUT: %.3: in Simple> = assoc_entity element0, @Simple.%F [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Simple, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Simple.%F.decl [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.4: = interface_witness (@impl.%F) [template] -// CHECK:STDOUT: %.5: type = struct_type {} [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.5: = interface_witness (%struct.2) [template] +// CHECK:STDOUT: %.6: type = struct_type {} [template] // CHECK:STDOUT: %.7: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -45,21 +49,21 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc8: in Simple> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Simple { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.4] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -80,8 +84,8 @@ class C { // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var // CHECK:STDOUT: %.loc15_19.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_19.2: init C = class_init (), %c.var [template = constants.%struct] -// CHECK:STDOUT: %.loc15_20: init C = converted %.loc15_19.1, %.loc15_19.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc15_19.2: init C = class_init (), %c.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc15_20: init C = converted %.loc15_19.1, %.loc15_19.2 [template = constants.%struct.3] // CHECK:STDOUT: assign %c.var, %.loc15_20 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/impl_forall.carbon b/toolchain/check/testdata/impl/impl_forall.carbon index ca3f96452d32..bf29614f9940 100644 --- a/toolchain/check/testdata/impl/impl_forall.carbon +++ b/toolchain/check/testdata/impl/impl_forall.carbon @@ -17,10 +17,15 @@ impl forall [T:! type] T as Simple { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Simple [template] // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Simple, [template] -// CHECK:STDOUT: %.3: in Simple> = assoc_entity element0, @Simple.%F [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Simple, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Simple.%F.decl [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] -// CHECK:STDOUT: %.4: = interface_witness (@impl.%F) [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.5: = interface_witness (%struct.2) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -40,21 +45,21 @@ impl forall [T:! type] T as Simple { // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc8: in Simple> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: T as Simple { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.4] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/alias.carbon b/toolchain/check/testdata/impl/lookup/alias.carbon index 202f614924b1..0c31d6dde09f 100644 --- a/toolchain/check/testdata/impl/lookup/alias.carbon +++ b/toolchain/check/testdata/impl/lookup/alias.carbon @@ -26,12 +26,18 @@ fn G(c: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @HasF [template] // CHECK:STDOUT: %Self: HasF = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @HasF, [template] -// CHECK:STDOUT: %.3: in HasF> = assoc_entity element0, @HasF.%F [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @HasF, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @HasF.%F.decl [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.4: type = struct_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.%F) [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = struct_type {} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.6: = interface_witness (%struct.2) [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.3: G = struct_value () [template] // CHECK:STDOUT: %.7: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -40,7 +46,7 @@ fn G(c: C) { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .HasF = %HasF.decl // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [template = constants.%.1] {} @@ -49,7 +55,7 @@ fn G(c: C) { // CHECK:STDOUT: %C.ref.loc15: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, %HasF.decl [template = constants.%.1] // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { // CHECK:STDOUT: %C.ref.loc19: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %c.loc19_6.1: C = param c // CHECK:STDOUT: @G.%c: C = bind_name c, %c.loc19_6.1 @@ -58,28 +64,28 @@ fn G(c: C) { // CHECK:STDOUT: // CHECK:STDOUT: interface @HasF { // CHECK:STDOUT: %Self: HasF = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc8: in HasF> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as HasF { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.5] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, file.%HasF.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: in HasF> = name_ref F, @HasF.%.loc8 [template = constants.%.3] -// CHECK:STDOUT: %G: in HasF> = bind_alias G, @HasF.%.loc8 [template = constants.%.3] +// CHECK:STDOUT: %F.ref: = name_ref F, @HasF.%.loc8 [template = constants.%.4] +// CHECK:STDOUT: %G: = bind_alias G, @HasF.%.loc8 [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C @@ -96,12 +102,12 @@ fn G(c: C) { // CHECK:STDOUT: fn @G(%c: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %G.ref.loc20: in HasF> = name_ref G, @C.%G [template = constants.%.3] -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] +// CHECK:STDOUT: %G.ref.loc20: = name_ref G, @C.%G [template = constants.%.4] +// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] // CHECK:STDOUT: %F.call.loc20: init () = call %.1() // CHECK:STDOUT: %c.ref: C = name_ref c, %c -// CHECK:STDOUT: %G.ref.loc21: in HasF> = name_ref G, @C.%G [template = constants.%.3] -// CHECK:STDOUT: %.2: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] +// CHECK:STDOUT: %G.ref.loc21: = name_ref G, @C.%G [template = constants.%.4] +// CHECK:STDOUT: %.2: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] // CHECK:STDOUT: %F.call.loc21: init () = call %.2() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon b/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon index 6bcfe474e503..ee9154c2d7d5 100644 --- a/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon @@ -29,11 +29,15 @@ fn F(c: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @I, [template] -// CHECK:STDOUT: %.3: in I> = assoc_entity element0, @I.%F [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @I, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @I.%F.decl [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.4: type = struct_type {} [template] -// CHECK:STDOUT: %.5: type = tuple_type () [template] +// CHECK:STDOUT: %.5: type = struct_type {} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: %.6: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -42,12 +46,12 @@ fn F(c: C) { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .I = %I.decl // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %c.loc15_6.1: C = param c // CHECK:STDOUT: @F.2.%c: C = bind_name c, %c.loc15_6.1 @@ -56,19 +60,19 @@ fn F(c: C) { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc8: in I> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: in I> = name_ref F, @I.%.loc8 [template = constants.%.3] -// CHECK:STDOUT: %F: in I> = bind_alias F, @I.%.loc8 [template = constants.%.3] +// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc8 [template = constants.%.4] +// CHECK:STDOUT: %F: = bind_alias F, @I.%.loc8 [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C @@ -80,9 +84,9 @@ fn F(c: C) { // CHECK:STDOUT: fn @F.2(%c: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %F.ref.loc20: in I> = name_ref F, @C.%F [template = constants.%.3] +// CHECK:STDOUT: %F.ref.loc20: = name_ref F, @C.%F [template = constants.%.4] // CHECK:STDOUT: %c.ref: C = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc24: in I> = name_ref F, @C.%F [template = constants.%.3] +// CHECK:STDOUT: %F.ref.loc24: = name_ref F, @C.%F [template = constants.%.4] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon index 8cc401b71a0c..d83191660f71 100644 --- a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon @@ -29,11 +29,18 @@ impl C as I { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @I, [template] -// CHECK:STDOUT: %.3: in I> = assoc_entity element0, @I.%F [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @I, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @I.%F.decl [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.4: type = struct_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.%F) [template] +// CHECK:STDOUT: %.5: type = struct_type {} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %F.3: type = fn_type @F.3 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %.6: = interface_witness (%struct.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -41,12 +48,12 @@ impl C as I { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .I = %I.decl // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: @F.2.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl { @@ -57,21 +64,21 @@ impl C as I { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc8: in I> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as I { -// CHECK:STDOUT: %F: = fn_decl @F.3 [template] {} -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.5] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.3] {} +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -90,7 +97,7 @@ impl C as I { // CHECK:STDOUT: fn @F.2() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %F.ref: in I> = name_ref F, @I.%.loc8 [template = constants.%.3] +// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc8 [template = constants.%.4] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/import.carbon b/toolchain/check/testdata/impl/lookup/import.carbon index b43c9f5ed398..9de097a0feca 100644 --- a/toolchain/check/testdata/impl/lookup/import.carbon +++ b/toolchain/check/testdata/impl/lookup/import.carbon @@ -31,11 +31,16 @@ fn G(c: Impl.C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @HasF [template] // CHECK:STDOUT: %Self: HasF = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @HasF, [template] -// CHECK:STDOUT: %.3: in HasF> = assoc_entity element0, @HasF.%F [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @HasF, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @HasF.%F.decl [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.4: type = struct_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.%F) [template] +// CHECK:STDOUT: %.5: type = struct_type {} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.6: = interface_witness (%struct.2) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -55,21 +60,21 @@ fn G(c: Impl.C) { // CHECK:STDOUT: // CHECK:STDOUT: interface @HasF { // CHECK:STDOUT: %Self: HasF = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc5: in HasF> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc5: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc5 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as HasF { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.5] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -92,30 +97,36 @@ fn G(c: Impl.C) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @HasF [template] // CHECK:STDOUT: %Self: HasF = bind_symbolic_name Self 0 [symbolic] +// CHECK:STDOUT: %G: type = fn_type @G [template] // CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: G = struct_value () [template] // CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: type = assoc_entity_type @HasF, [template] -// CHECK:STDOUT: %.6: in HasF> = assoc_entity element0, file.%import_ref.8 [template] -// CHECK:STDOUT: %.7: = interface_witness () [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @HasF, F [template] +// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.8 [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %.7: = interface_witness (%struct.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Impl = %Impl // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Impl: = namespace [template] {} // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+11, unloaded +// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+14, unloaded // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [template = constants.%.2] {} -// CHECK:STDOUT: %import_ref.2: in HasF> = import_ref ir1, inst+8, loc_20 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.2: = import_ref ir1, inst+11, loc_20 [template = constants.%.6] // CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+4, unloaded // CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+6, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+17, loc_22 [template = constants.%.7] -// CHECK:STDOUT: %import_ref.6: type = import_ref ir1, inst+10, loc_10 [template = constants.%C] -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+22, loc_22 [template = constants.%.7] +// CHECK:STDOUT: %import_ref.6: type = import_ref ir1, inst+13, loc_10 [template = constants.%C] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { // CHECK:STDOUT: %Impl.ref: = name_ref Impl, %Impl [template = %Impl] // CHECK:STDOUT: %C.ref: type = name_ref C, %import_ref.6 [template = constants.%C] // CHECK:STDOUT: %c.loc4_6.1: C = param c @@ -144,11 +155,13 @@ fn G(c: Impl.C) { // CHECK:STDOUT: %c.ref: C = name_ref c, %c // CHECK:STDOUT: %Impl.ref: = name_ref Impl, file.%Impl [template = file.%Impl] // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, file.%import_ref.7 [template = constants.%.2] -// CHECK:STDOUT: %F.ref: in HasF> = name_ref F, file.%import_ref.2 [template = constants.%.6] -// CHECK:STDOUT: %.1: = interface_witness_access file.%import_ref.5, element0 [template = ] +// CHECK:STDOUT: %F.ref: = name_ref F, file.%import_ref.2 [template = constants.%.6] +// CHECK:STDOUT: %.1: F = interface_witness_access file.%import_ref.5, element0 [template = constants.%struct.3] // CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(); +// CHECK:STDOUT: fn @F.1(); +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F.2(); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/instance_method.carbon b/toolchain/check/testdata/impl/lookup/instance_method.carbon index df07b3f1bd1f..6e978015204e 100644 --- a/toolchain/check/testdata/impl/lookup/instance_method.carbon +++ b/toolchain/check/testdata/impl/lookup/instance_method.carbon @@ -26,11 +26,17 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @I, [template] -// CHECK:STDOUT: %.3: in I> = assoc_entity element0, @I.%F [template] -// CHECK:STDOUT: %.4: = interface_witness (@impl.%F) [template] -// CHECK:STDOUT: %.5: type = struct_type {} [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @I, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @I.%F.decl [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.5: = interface_witness (%struct.2) [template] +// CHECK:STDOUT: %.6: type = struct_type {} [template] +// CHECK:STDOUT: %F.3: type = fn_type @F.3 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: %.7: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -39,13 +45,13 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl.loc7 // CHECK:STDOUT: .I = %I.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl.loc7: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} // CHECK:STDOUT: %C.decl.loc13: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %F: = fn_decl @F.3 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.3] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl.loc7 [template = constants.%C] // CHECK:STDOUT: %c.loc19_6.1: C = param c // CHECK:STDOUT: @F.3.%c: C = bind_name c, %c.loc19_6.1 @@ -55,7 +61,7 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: I = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc10_14.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] // CHECK:STDOUT: %.loc10_14.2: type = converted %Self.ref, %.loc10_14.1 [symbolic = constants.%Self] @@ -63,25 +69,25 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: %self.loc10_8.2: Self = bind_name self, %self.loc10_8.1 // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_28: in I> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %.loc10_28: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc10_28 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as I { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C] // CHECK:STDOUT: %self.loc15_10.1: C = param self // CHECK:STDOUT: %self.loc15_10.2: C = bind_name self, %self.loc15_10.1 // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.4] +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -102,12 +108,12 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: fn @F.3(%c: C) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: C = name_ref c, %c -// CHECK:STDOUT: %F.ref: in I> = name_ref F, @I.%.loc10_28 [template = constants.%.3] -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] +// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc10_28 [template = constants.%.4] +// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] // CHECK:STDOUT: %.loc20_11: = bound_method %c.ref, %.1 -// CHECK:STDOUT: %.loc20_13: init i32 = call %.loc20_11(%c.ref) -// CHECK:STDOUT: %.loc20_15.1: i32 = value_of_initializer %.loc20_13 -// CHECK:STDOUT: %.loc20_15.2: i32 = converted %.loc20_13, %.loc20_15.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc20_11(%c.ref) +// CHECK:STDOUT: %.loc20_15.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc20_15.2: i32 = converted %F.call, %.loc20_15.1 // CHECK:STDOUT: return %.loc20_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon b/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon index 40a07cb1cd74..af40d02ad1d3 100644 --- a/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon +++ b/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon @@ -31,11 +31,16 @@ fn G(c: Impl.C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @HasF [template] // CHECK:STDOUT: %Self: HasF = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @HasF, [template] -// CHECK:STDOUT: %.3: in HasF> = assoc_entity element0, @HasF.%F [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @HasF, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @HasF.%F.decl [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.4: type = struct_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.%F) [template] +// CHECK:STDOUT: %.5: type = struct_type {} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.6: = interface_witness (%struct.2) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -53,21 +58,21 @@ fn G(c: Impl.C) { // CHECK:STDOUT: // CHECK:STDOUT: interface @HasF { // CHECK:STDOUT: %Self: HasF = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc5: in HasF> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc5: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc5 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as HasF { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.5] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -90,28 +95,34 @@ fn G(c: Impl.C) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @HasF [template] // CHECK:STDOUT: %Self: HasF = bind_symbolic_name Self 0 [symbolic] +// CHECK:STDOUT: %G: type = fn_type @G [template] // CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: G = struct_value () [template] // CHECK:STDOUT: %.4: type = ptr_type {} [template] -// CHECK:STDOUT: %.5: type = assoc_entity_type @HasF, [template] -// CHECK:STDOUT: %.6: in HasF> = assoc_entity element0, file.%import_ref.8 [template] -// CHECK:STDOUT: %.7: = interface_witness () [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @HasF, F [template] +// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.8 [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %.7: = interface_witness (%struct.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Impl = %Impl -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Impl: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+10, unloaded +// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+13, unloaded // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [template = constants.%.2] {} -// CHECK:STDOUT: %import_ref.2: in HasF> = import_ref ir1, inst+7, loc_20 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.2: = import_ref ir1, inst+10, loc_20 [template = constants.%.6] // CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+3, unloaded // CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+5, unloaded -// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+16, loc_22 [template = constants.%.7] -// CHECK:STDOUT: %import_ref.6: type = import_ref ir1, inst+9, loc_10 [template = constants.%C] -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %import_ref.5: = import_ref ir1, inst+21, loc_22 [template = constants.%.7] +// CHECK:STDOUT: %import_ref.6: type = import_ref ir1, inst+12, loc_10 [template = constants.%C] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { // CHECK:STDOUT: %Impl.ref: = name_ref Impl, %Impl [template = %Impl] // CHECK:STDOUT: %C.ref: type = name_ref C, %import_ref.6 [template = constants.%C] // CHECK:STDOUT: %c.loc4_6.1: C = param c @@ -140,11 +151,13 @@ fn G(c: Impl.C) { // CHECK:STDOUT: %c.ref: C = name_ref c, %c // CHECK:STDOUT: %Impl.ref: = name_ref Impl, file.%Impl [template = file.%Impl] // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, file.%import_ref.7 [template = constants.%.2] -// CHECK:STDOUT: %F.ref: in HasF> = name_ref F, file.%import_ref.2 [template = constants.%.6] -// CHECK:STDOUT: %.1: = interface_witness_access file.%import_ref.5, element0 [template = ] +// CHECK:STDOUT: %F.ref: = name_ref F, file.%import_ref.2 [template = constants.%.6] +// CHECK:STDOUT: %.1: F = interface_witness_access file.%import_ref.5, element0 [template = constants.%struct.3] // CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(); +// CHECK:STDOUT: fn @F.1(); +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F.2(); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/basic.carbon b/toolchain/check/testdata/impl/no_prelude/basic.carbon index fe8f5b168110..e0d1b2e8c27f 100644 --- a/toolchain/check/testdata/impl/no_prelude/basic.carbon +++ b/toolchain/check/testdata/impl/no_prelude/basic.carbon @@ -19,11 +19,16 @@ impl C as Simple { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Simple [template] // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Simple, [template] -// CHECK:STDOUT: %.3: in Simple> = assoc_entity element0, @Simple.%F [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Simple, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Simple.%F.decl [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.4: type = struct_type {} [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.%F) [template] +// CHECK:STDOUT: %.5: type = struct_type {} [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.6: = interface_witness (%struct.2) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -41,21 +46,21 @@ impl C as Simple { // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc8: in Simple> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Simple { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.5] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/import_self.carbon b/toolchain/check/testdata/impl/no_prelude/import_self.carbon index 54e03ecac116..e2ff066bf017 100644 --- a/toolchain/check/testdata/impl/no_prelude/import_self.carbon +++ b/toolchain/check/testdata/impl/no_prelude/import_self.carbon @@ -31,8 +31,11 @@ fn F(x: (), y: ()) -> () { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Add [template] // CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Add, [template] -// CHECK:STDOUT: %.3: in Add> = assoc_entity element0, @Add.%Op [template] +// CHECK:STDOUT: %Op: type = fn_type @Op [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Add, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Add.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -44,7 +47,7 @@ fn F(x: (), y: ()) -> () { // CHECK:STDOUT: // CHECK:STDOUT: interface @Add { // CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %Op: = fn_decl @Op [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op [template = constants.%struct] { // CHECK:STDOUT: %Self.ref.loc5_15: Add = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self] @@ -60,12 +63,12 @@ fn F(x: (), y: ()) -> () { // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in Add> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op[@Add.%self.loc5_9.2: Self](@Add.%other.loc5_21.2: Self) -> Self; @@ -76,28 +79,34 @@ fn F(x: (), y: ()) -> () { // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %.2: type = interface_type @Add [template] // CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.%Op) [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.3: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] -// CHECK:STDOUT: %.4: type = assoc_entity_type @Add, [template] -// CHECK:STDOUT: %.5: in Add> = assoc_entity element0, file.%import_ref.5 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = assoc_entity_type @Add, Op [template] +// CHECK:STDOUT: %.5: = assoc_entity element0, file.%import_ref.5 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Add = %import_ref.1 -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, loc_13 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in Add> = import_ref ir1, inst+21, loc_58 [template = constants.%.5] +// CHECK:STDOUT: %import_ref.2: = import_ref ir1, inst+24, loc_58 [template = constants.%.5] // CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir1, inst+19, loc_14 [template = imports.%Op] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir1, inst+19, loc_14 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %.loc6_7.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %Add.decl: type = interface_decl @Add [template = constants.%.2] {} // CHECK:STDOUT: %Add.ref: type = name_ref Add, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %.loc10_10.1: () = tuple_literal () // CHECK:STDOUT: %.loc10_10.2: type = converted %.loc10_10.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.loc10_6.1: () = param x @@ -121,7 +130,7 @@ fn F(x: (), y: ()) -> () { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: () as Add { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc7_15: type = name_ref Self, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %self.loc7_9.1: () = param self // CHECK:STDOUT: %self.loc7_9.2: () = bind_name self, %self.loc7_9.1 @@ -131,10 +140,10 @@ fn F(x: (), y: ()) -> () { // CHECK:STDOUT: %Self.ref.loc7_37: type = name_ref Self, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %return.var: ref () = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -152,15 +161,15 @@ fn F(x: (), y: ()) -> () { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.ref: () = name_ref x, %x // CHECK:STDOUT: %Add.ref: type = name_ref Add, file.%import_ref.1 [template = constants.%.2] -// CHECK:STDOUT: %Op.ref: in Add> = name_ref Op, file.%import_ref.2 [template = constants.%.5] -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Op] +// CHECK:STDOUT: %Op.ref: = name_ref Op, file.%import_ref.2 [template = constants.%.5] +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] // CHECK:STDOUT: %.loc11_11: = bound_method %x.ref, %.1 // CHECK:STDOUT: %y.ref: () = name_ref y, %y -// CHECK:STDOUT: %.loc11_20.1: init () = call %.loc11_11(%x.ref, %y.ref) -// CHECK:STDOUT: %.loc11_20.2: ref () = temporary_storage -// CHECK:STDOUT: %.loc11_20.3: ref () = temporary %.loc11_20.2, %.loc11_20.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc11_11(%x.ref, %y.ref) +// CHECK:STDOUT: %.loc11_20.1: ref () = temporary_storage +// CHECK:STDOUT: %.loc11_20.2: ref () = temporary %.loc11_20.1, %Op.call // CHECK:STDOUT: %tuple: () = tuple_value () [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_23: () = converted %.loc11_20.1, %tuple [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_23: () = converted %Op.call, %tuple [template = constants.%tuple] // CHECK:STDOUT: return %.loc11_23 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/self_in_class.carbon b/toolchain/check/testdata/impl/no_prelude/self_in_class.carbon index e35b126b62e3..f49d9b643372 100644 --- a/toolchain/check/testdata/impl/no_prelude/self_in_class.carbon +++ b/toolchain/check/testdata/impl/no_prelude/self_in_class.carbon @@ -23,15 +23,19 @@ class A { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @DefaultConstructible [template] // CHECK:STDOUT: %Self: DefaultConstructible = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @DefaultConstructible, [template] -// CHECK:STDOUT: %.3: in DefaultConstructible> = assoc_entity element0, @DefaultConstructible.%Make [template] +// CHECK:STDOUT: %Make.1: type = fn_type @Make.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Make = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @DefaultConstructible, Make [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @DefaultConstructible.%Make.decl [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.4: type = struct_type {} [template] +// CHECK:STDOUT: %.5: type = struct_type {} [template] // CHECK:STDOUT: %A: type = class_type @A [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.%Make) [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %Make.2: type = fn_type @Make.2 [template] +// CHECK:STDOUT: %struct.2: Make = struct_value () [template] +// CHECK:STDOUT: %.6: = interface_witness (%struct.2) [template] // CHECK:STDOUT: %.7: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -47,29 +51,29 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: interface @DefaultConstructible { // CHECK:STDOUT: %Self: DefaultConstructible = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %Make: = fn_decl @Make.1 [template] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: DefaultConstructible = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc8_16.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] // CHECK:STDOUT: %.loc8_16.2: type = converted %Self.ref, %.loc8_16.1 [symbolic = constants.%Self] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_20: in DefaultConstructible> = assoc_entity element0, %Make [template = constants.%.3] +// CHECK:STDOUT: %.loc8_20: = assoc_entity element0, %Make.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Make = %.loc8_20 -// CHECK:STDOUT: witness = (%Make) +// CHECK:STDOUT: witness = (%Make.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as DefaultConstructible { -// CHECK:STDOUT: %Make: = fn_decl @Make.2 [template] { +// CHECK:STDOUT: %Make.decl: Make = fn_decl @Make.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Make) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Make.decl) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Make = %Make +// CHECK:STDOUT: .Make = %Make.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -93,8 +97,8 @@ class A { // CHECK:STDOUT: fn @Make.2() -> @impl.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc17_33.1: {} = struct_literal () -// CHECK:STDOUT: %.loc17_33.2: init C = class_init (), @impl.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc17_34: init C = converted %.loc17_33.1, %.loc17_33.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc17_33.2: init C = class_init (), @impl.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc17_34: init C = converted %.loc17_33.1, %.loc17_33.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc17_34 to @impl.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/self_in_signature.carbon b/toolchain/check/testdata/impl/no_prelude/self_in_signature.carbon index d0f15c053e6e..c6e48ef4fd08 100644 --- a/toolchain/check/testdata/impl/no_prelude/self_in_signature.carbon +++ b/toolchain/check/testdata/impl/no_prelude/self_in_signature.carbon @@ -37,33 +37,45 @@ impl D as SelfNested { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @UseSelf [template] // CHECK:STDOUT: %Self.1: UseSelf = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @UseSelf, [template] -// CHECK:STDOUT: %.3: in UseSelf> = assoc_entity element0, @UseSelf.%F [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @UseSelf, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @UseSelf.%F.decl [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.4: type = struct_type {} [template] +// CHECK:STDOUT: %.5: type = struct_type {} [template] // CHECK:STDOUT: %D: type = class_type @D [template] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%F) [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.6: = interface_witness (%struct.2) [template] // CHECK:STDOUT: %.7: type = ptr_type {} [template] -// CHECK:STDOUT: %struct.1: C = struct_value () [template] -// CHECK:STDOUT: %.8: = interface_witness (@impl.2.%F) [template] -// CHECK:STDOUT: %struct.2: D = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %F.3: type = fn_type @F.3 [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] +// CHECK:STDOUT: %.8: = interface_witness (%struct.4) [template] +// CHECK:STDOUT: %struct.5: D = struct_value () [template] // CHECK:STDOUT: %.9: type = interface_type @SelfNested [template] // CHECK:STDOUT: %Self.2: SelfNested = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.10: type = ptr_type Self [symbolic] // CHECK:STDOUT: %.11: type = struct_type {.x: Self, .y: ()} [symbolic] // CHECK:STDOUT: %.12: type = tuple_type (type, type) [template] // CHECK:STDOUT: %.13: type = tuple_type (Self*, {.x: Self, .y: ()}) [symbolic] -// CHECK:STDOUT: %.14: type = assoc_entity_type @SelfNested, [template] -// CHECK:STDOUT: %.15: in SelfNested> = assoc_entity element0, @SelfNested.%F [template] +// CHECK:STDOUT: %F.4: type = fn_type @F.4 [template] +// CHECK:STDOUT: %struct.6: F = struct_value () [template] +// CHECK:STDOUT: %.14: type = assoc_entity_type @SelfNested, F [template] +// CHECK:STDOUT: %.15: = assoc_entity element0, @SelfNested.%F.decl [template] // CHECK:STDOUT: %.16: type = ptr_type C [template] // CHECK:STDOUT: %.17: type = struct_type {.x: C, .y: ()} [template] // CHECK:STDOUT: %.18: type = tuple_type (C*, {.x: C, .y: ()}) [template] -// CHECK:STDOUT: %.19: = interface_witness (@impl.3.%F) [template] +// CHECK:STDOUT: %F.5: type = fn_type @F.5 [template] +// CHECK:STDOUT: %struct.7: F = struct_value () [template] +// CHECK:STDOUT: %.19: = interface_witness (%struct.7) [template] // CHECK:STDOUT: %.20: type = ptr_type D [template] // CHECK:STDOUT: %.21: type = struct_type {.x: D, .y: ()} [template] // CHECK:STDOUT: %.22: type = tuple_type (D*, {.x: D, .y: ()}) [template] -// CHECK:STDOUT: %.23: = interface_witness (@impl.4.%F) [template] +// CHECK:STDOUT: %F.6: type = fn_type @F.6 [template] +// CHECK:STDOUT: %struct.8: F = struct_value () [template] +// CHECK:STDOUT: %.23: = interface_witness (%struct.8) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -97,7 +109,7 @@ impl D as SelfNested { // CHECK:STDOUT: // CHECK:STDOUT: interface @UseSelf { // CHECK:STDOUT: %Self: UseSelf = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc8_14: UseSelf = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc8_14.1: type = facet_type_access %Self.ref.loc8_14 [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc8_14.2: type = converted %Self.ref.loc8_14, %.loc8_14.1 [symbolic = constants.%Self.1] @@ -113,17 +125,17 @@ impl D as SelfNested { // CHECK:STDOUT: %.loc8_32.2: type = converted %Self.ref.loc8_32, %.loc8_32.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_36: in UseSelf> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %.loc8_36: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8_36 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @SelfNested { // CHECK:STDOUT: %Self: SelfNested = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %F: = fn_decl @F.4 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.4 [template = constants.%struct.6] { // CHECK:STDOUT: %Self.ref.loc24_12: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc24_16.1: type = facet_type_access %Self.ref.loc24_12 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc24_16.2: type = converted %Self.ref.loc24_12, %.loc24_16.1 [symbolic = constants.%Self.2] @@ -132,23 +144,23 @@ impl D as SelfNested { // CHECK:STDOUT: %.loc24_24.1: type = facet_type_access %Self.ref.loc24_24 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc24_24.2: type = converted %Self.ref.loc24_24, %.loc24_24.1 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc24_35.1: () = tuple_literal () -// CHECK:STDOUT: %.loc24_35.2: type = converted %.loc24_35.1, constants.%.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc24_35.2: type = converted %.loc24_35.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %.loc24_36: type = struct_type {.x: Self, .y: ()} [symbolic = constants.%.11] // CHECK:STDOUT: %.loc24_37.1: (type, type) = tuple_literal (%.loc24_16.3, %.loc24_36) // CHECK:STDOUT: %.loc24_37.2: type = converted %.loc24_37.1, constants.%.13 [symbolic = constants.%.13] // CHECK:STDOUT: %x.loc24_8.1: (Self*, {.x: Self, .y: ()}) = param x // CHECK:STDOUT: %x.loc24_8.2: (Self*, {.x: Self, .y: ()}) = bind_name x, %x.loc24_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc24_39: in SelfNested> = assoc_entity element0, %F [template = constants.%.15] +// CHECK:STDOUT: %.loc24_39: = assoc_entity element0, %F.decl [template = constants.%.15] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc24_39 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as UseSelf { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref.loc16_14: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc16_8.1: C = param self // CHECK:STDOUT: %self.loc16_8.2: C = bind_name self, %self.loc16_8.1 @@ -158,15 +170,15 @@ impl D as SelfNested { // CHECK:STDOUT: %C.ref.loc16_26: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: D as UseSelf { -// CHECK:STDOUT: %F: = fn_decl @F.3 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.4] { // CHECK:STDOUT: %Self.ref.loc20_14: type = name_ref Self, constants.%D [template = constants.%D] // CHECK:STDOUT: %self.loc20_8.1: D = param self // CHECK:STDOUT: %self.loc20_8.2: D = bind_name self, %self.loc20_8.1 @@ -176,50 +188,50 @@ impl D as SelfNested { // CHECK:STDOUT: %Self.ref.loc20_32: type = name_ref Self, constants.%D [template = constants.%D] // CHECK:STDOUT: %return.var: ref D = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.8] +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.3: C as SelfNested { -// CHECK:STDOUT: %F: = fn_decl @F.5 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.5 [template = constants.%struct.7] { // CHECK:STDOUT: %C.ref.loc28_12: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc28_13: type = ptr_type C [template = constants.%.16] // CHECK:STDOUT: %C.ref.loc28_21: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc28_29.1: () = tuple_literal () -// CHECK:STDOUT: %.loc28_29.2: type = converted %.loc28_29.1, constants.%.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc28_29.2: type = converted %.loc28_29.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %.loc28_30: type = struct_type {.x: C, .y: ()} [template = constants.%.17] // CHECK:STDOUT: %.loc28_31.1: (type, type) = tuple_literal (%.loc28_13, %.loc28_30) // CHECK:STDOUT: %.loc28_31.2: type = converted %.loc28_31.1, constants.%.18 [template = constants.%.18] // CHECK:STDOUT: %x.loc28_8.1: (C*, {.x: C, .y: ()}) = param x // CHECK:STDOUT: %x.loc28_8.2: (C*, {.x: C, .y: ()}) = bind_name x, %x.loc28_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.19] +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.19] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.4: D as SelfNested { -// CHECK:STDOUT: %F: = fn_decl @F.6 [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F.6 [template = constants.%struct.8] { // CHECK:STDOUT: %Self.ref.loc32_12: type = name_ref Self, constants.%D [template = constants.%D] // CHECK:STDOUT: %.loc32_16: type = ptr_type D [template = constants.%.20] // CHECK:STDOUT: %Self.ref.loc32_24: type = name_ref Self, constants.%D [template = constants.%D] // CHECK:STDOUT: %.loc32_35.1: () = tuple_literal () -// CHECK:STDOUT: %.loc32_35.2: type = converted %.loc32_35.1, constants.%.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc32_35.2: type = converted %.loc32_35.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %.loc32_36: type = struct_type {.x: D, .y: ()} [template = constants.%.21] // CHECK:STDOUT: %.loc32_37.1: (type, type) = tuple_literal (%.loc32_16, %.loc32_36) // CHECK:STDOUT: %.loc32_37.2: type = converted %.loc32_37.1, constants.%.22 [template = constants.%.22] // CHECK:STDOUT: %x.loc32_8.1: (D*, {.x: D, .y: ()}) = param x // CHECK:STDOUT: %x.loc32_8.2: (D*, {.x: D, .y: ()}) = bind_name x, %x.loc32_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.23] +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.23] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -238,16 +250,16 @@ impl D as SelfNested { // CHECK:STDOUT: fn @F.2[@impl.1.%self.loc16_8.2: C](@impl.1.%x.loc16_17.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc16_38.1: {} = struct_literal () -// CHECK:STDOUT: %.loc16_38.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.1] -// CHECK:STDOUT: %.loc16_39: init C = converted %.loc16_38.1, %.loc16_38.2 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc16_38.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc16_39: init C = converted %.loc16_38.1, %.loc16_38.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc16_39 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.3[@impl.2.%self.loc20_8.2: D](@impl.2.%x.loc20_20.2: D) -> @impl.2.%return.var: D { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc20_47.1: {} = struct_literal () -// CHECK:STDOUT: %.loc20_47.2: init D = class_init (), @impl.2.%return.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc20_48: init D = converted %.loc20_47.1, %.loc20_47.2 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc20_47.2: init D = class_init (), @impl.2.%return.var [template = constants.%struct.5] +// CHECK:STDOUT: %.loc20_48: init D = converted %.loc20_47.1, %.loc20_47.2 [template = constants.%struct.5] // CHECK:STDOUT: return %.loc20_48 to @impl.2.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/expr_category.carbon b/toolchain/check/testdata/index/expr_category.carbon index 419bb6f9bbaa..ded25d0b63ab 100644 --- a/toolchain/check/testdata/index/expr_category.carbon +++ b/toolchain/check/testdata/index/expr_category.carbon @@ -29,36 +29,43 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 3 [template] // CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] -// CHECK:STDOUT: %.3: type = ptr_type [i32; 3] [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.6: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] -// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.4, %.5, %.1) [template] -// CHECK:STDOUT: %.8: type = ptr_type i32 [template] -// CHECK:STDOUT: %.9: i32 = int_literal 4 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] +// CHECK:STDOUT: %array: [i32; 3] = tuple_value (%.5, %.6, %.1) [template] +// CHECK:STDOUT: %.9: type = ptr_type i32 [template] +// CHECK:STDOUT: %.10: i32 = int_literal 4 [template] +// CHECK:STDOUT: %ValueBinding: type = fn_type @ValueBinding [template] +// CHECK:STDOUT: %struct.3: ValueBinding = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .ValueBinding = %ValueBinding +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .ValueBinding = %ValueBinding.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // 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: } -// CHECK:STDOUT: %ValueBinding: = fn_decl @ValueBinding [template] { +// CHECK:STDOUT: %ValueBinding.decl: ValueBinding = fn_decl @ValueBinding [template = constants.%struct.3] { // 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 @@ -74,34 +81,34 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32 [template = constants.%.2] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_22: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_25: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_25: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc10_28: i32 = int_literal 3 [template = constants.%.1] // CHECK:STDOUT: %.loc10_29.1: (i32, i32, i32) = tuple_literal (%.loc10_22, %.loc10_25, %.loc10_28) -// CHECK:STDOUT: %.loc10_29.2: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc10_29.2: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc10_29.3: ref i32 = array_index %a.var, %.loc10_29.2 -// CHECK:STDOUT: %.loc10_29.4: init i32 = initialize_from %.loc10_22 to %.loc10_29.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_29.5: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_29.4: init i32 = initialize_from %.loc10_22 to %.loc10_29.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_29.5: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc10_29.6: ref i32 = array_index %a.var, %.loc10_29.5 -// CHECK:STDOUT: %.loc10_29.7: init i32 = initialize_from %.loc10_25 to %.loc10_29.6 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_29.8: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_29.7: init i32 = initialize_from %.loc10_25 to %.loc10_29.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc10_29.8: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc10_29.9: ref i32 = array_index %a.var, %.loc10_29.8 // CHECK:STDOUT: %.loc10_29.10: init i32 = initialize_from %.loc10_28 to %.loc10_29.9 [template = constants.%.1] // CHECK:STDOUT: %.loc10_29.11: init [i32; 3] = array_init (%.loc10_29.4, %.loc10_29.7, %.loc10_29.10) to %a.var [template = constants.%array] // CHECK:STDOUT: %.loc10_30: init [i32; 3] = converted %.loc10_29.1, %.loc10_29.11 [template = constants.%array] // CHECK:STDOUT: assign %a.var, %.loc10_30 -// CHECK:STDOUT: %.loc13_14: type = ptr_type i32 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_14: type = ptr_type i32 [template = constants.%.9] // CHECK:STDOUT: %pa.var: ref i32* = var pa // CHECK:STDOUT: %pa: ref i32* = bind_name pa, %pa.var // CHECK:STDOUT: %a.ref.loc13: ref [i32; 3] = name_ref a, %a -// CHECK:STDOUT: %.loc13_21: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc13_21: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc13_22: ref i32 = array_index %a.ref.loc13, %.loc13_21 // CHECK:STDOUT: %.loc13_18: i32* = addr_of %.loc13_22 // CHECK:STDOUT: assign %pa.var, %.loc13_18 // CHECK:STDOUT: %a.ref.loc14: ref [i32; 3] = name_ref a, %a -// CHECK:STDOUT: %.loc14_5: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc14_5: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc14_6: ref i32 = array_index %a.ref.loc14, %.loc14_5 -// CHECK:STDOUT: %.loc14_10: i32 = int_literal 4 [template = constants.%.9] +// CHECK:STDOUT: %.loc14_10: i32 = int_literal 4 [template = constants.%.10] // CHECK:STDOUT: assign %.loc14_6, %.loc14_10 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -112,34 +119,34 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: %.loc18_17: type = array_type %.loc18_16, i32 [template = constants.%.2] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var -// CHECK:STDOUT: %.loc18_22: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc18_25: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc18_22: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc18_25: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc18_28: i32 = int_literal 3 [template = constants.%.1] // CHECK:STDOUT: %.loc18_29.1: (i32, i32, i32) = tuple_literal (%.loc18_22, %.loc18_25, %.loc18_28) -// CHECK:STDOUT: %.loc18_29.2: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc18_29.2: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc18_29.3: ref i32 = array_index %a.var, %.loc18_29.2 -// CHECK:STDOUT: %.loc18_29.4: init i32 = initialize_from %.loc18_22 to %.loc18_29.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc18_29.5: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc18_29.4: init i32 = initialize_from %.loc18_22 to %.loc18_29.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc18_29.5: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc18_29.6: ref i32 = array_index %a.var, %.loc18_29.5 -// CHECK:STDOUT: %.loc18_29.7: init i32 = initialize_from %.loc18_25 to %.loc18_29.6 [template = constants.%.5] -// CHECK:STDOUT: %.loc18_29.8: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc18_29.7: init i32 = initialize_from %.loc18_25 to %.loc18_29.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc18_29.8: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc18_29.9: ref i32 = array_index %a.var, %.loc18_29.8 // CHECK:STDOUT: %.loc18_29.10: init i32 = initialize_from %.loc18_28 to %.loc18_29.9 [template = constants.%.1] // CHECK:STDOUT: %.loc18_29.11: init [i32; 3] = array_init (%.loc18_29.4, %.loc18_29.7, %.loc18_29.10) to %a.var [template = constants.%array] // CHECK:STDOUT: %.loc18_30: init [i32; 3] = converted %.loc18_29.1, %.loc18_29.11 [template = constants.%array] // CHECK:STDOUT: assign %a.var, %.loc18_30 // CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, %a -// CHECK:STDOUT: %.loc22_5: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc22_5: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc22_6: ref i32 = array_index %a.ref, %.loc22_5 // CHECK:STDOUT: %b.ref: [i32; 3] = name_ref b, %b -// CHECK:STDOUT: %.loc23_5: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc23_5: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc23_6.1: ref [i32; 3] = value_as_ref %b.ref // CHECK:STDOUT: %.loc23_6.2: ref i32 = array_index %.loc23_6.1, %.loc23_5 // CHECK:STDOUT: %.loc23_6.3: i32 = bind_value %.loc23_6.2 -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc24_4.1: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %F.call: init [i32; 3] = call %F.ref() to %.loc24_4.1 -// CHECK:STDOUT: %.loc24_7: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc24_7: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc24_4.2: ref [i32; 3] = temporary %.loc24_4.1, %F.call // CHECK:STDOUT: %.loc24_8.1: ref i32 = array_index %.loc24_4.2, %.loc24_7 // CHECK:STDOUT: %.loc24_8.2: i32 = bind_value %.loc24_8.1 diff --git a/toolchain/check/testdata/index/fail_empty_tuple_access.carbon b/toolchain/check/testdata/index/fail_empty_tuple_access.carbon index 929c3fe3d2ae..76b8b3904b65 100644 --- a/toolchain/check/testdata/index/fail_empty_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_empty_tuple_access.carbon @@ -16,19 +16,23 @@ fn Run() { // CHECK:STDOUT: --- fail_empty_tuple_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %struct.2: Run = struct_value () [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -38,7 +42,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: %.loc13_7: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: %.loc13_4.1: ref () = temporary_storage diff --git a/toolchain/check/testdata/index/fail_expr_category.carbon b/toolchain/check/testdata/index/fail_expr_category.carbon index c943190d311f..a1df13589434 100644 --- a/toolchain/check/testdata/index/fail_expr_category.carbon +++ b/toolchain/check/testdata/index/fail_expr_category.carbon @@ -37,25 +37,30 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 3 [template] // CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] -// CHECK:STDOUT: %.3: type = ptr_type [i32; 3] [template] -// CHECK:STDOUT: %.4: type = ptr_type i32 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 4 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %.5: type = ptr_type i32 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.7: i32 = int_literal 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // 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 @@ -67,43 +72,43 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%b: [i32; 3]) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_14: type = ptr_type i32 [template = constants.%.4] +// CHECK:STDOUT: %.loc15_14: type = ptr_type i32 [template = constants.%.5] // CHECK:STDOUT: %pb.var: ref i32* = var pb // CHECK:STDOUT: %pb: ref i32* = bind_name pb, %pb.var // CHECK:STDOUT: %b.ref.loc15: [i32; 3] = name_ref b, %b -// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.6] // CHECK:STDOUT: %.loc15_22.1: ref [i32; 3] = value_as_ref %b.ref.loc15 // CHECK:STDOUT: %.loc15_22.2: ref i32 = array_index %.loc15_22.1, %.loc15_21 // CHECK:STDOUT: %.loc15_22.3: i32 = bind_value %.loc15_22.2 // CHECK:STDOUT: %.loc15_18: i32* = addr_of [template = ] // CHECK:STDOUT: assign %pb.var, %.loc15_18 // CHECK:STDOUT: %b.ref.loc20: [i32; 3] = name_ref b, %b -// CHECK:STDOUT: %.loc20_5: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc20_5: i32 = int_literal 0 [template = constants.%.6] // CHECK:STDOUT: %.loc20_6.1: ref [i32; 3] = value_as_ref %b.ref.loc20 // CHECK:STDOUT: %.loc20_6.2: ref i32 = array_index %.loc20_6.1, %.loc20_5 // CHECK:STDOUT: %.loc20_6.3: i32 = bind_value %.loc20_6.2 -// CHECK:STDOUT: %.loc20_10: i32 = int_literal 4 [template = constants.%.6] +// CHECK:STDOUT: %.loc20_10: i32 = int_literal 4 [template = constants.%.7] // CHECK:STDOUT: assign %.loc20_6.3, %.loc20_10 -// CHECK:STDOUT: %.loc28_14: type = ptr_type i32 [template = constants.%.4] +// CHECK:STDOUT: %.loc28_14: type = ptr_type i32 [template = constants.%.5] // CHECK:STDOUT: %pf.var: ref i32* = var pf // CHECK:STDOUT: %pf: ref i32* = bind_name pf, %pf.var -// CHECK:STDOUT: %F.ref.loc28: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref.loc28: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc28_20.1: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %F.call.loc28: init [i32; 3] = call %F.ref.loc28() to %.loc28_20.1 -// CHECK:STDOUT: %.loc28_23: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc28_23: i32 = int_literal 0 [template = constants.%.6] // CHECK:STDOUT: %.loc28_20.2: ref [i32; 3] = temporary %.loc28_20.1, %F.call.loc28 // CHECK:STDOUT: %.loc28_24.1: ref i32 = array_index %.loc28_20.2, %.loc28_23 // CHECK:STDOUT: %.loc28_24.2: i32 = bind_value %.loc28_24.1 // CHECK:STDOUT: %.loc28_18: i32* = addr_of [template = ] // CHECK:STDOUT: assign %pf.var, %.loc28_18 -// CHECK:STDOUT: %F.ref.loc32: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref.loc32: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc32_4.1: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %F.call.loc32: init [i32; 3] = call %F.ref.loc32() to %.loc32_4.1 -// CHECK:STDOUT: %.loc32_7: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc32_7: i32 = int_literal 0 [template = constants.%.6] // CHECK:STDOUT: %.loc32_4.2: ref [i32; 3] = temporary %.loc32_4.1, %F.call.loc32 // CHECK:STDOUT: %.loc32_8.1: ref i32 = array_index %.loc32_4.2, %.loc32_7 // CHECK:STDOUT: %.loc32_8.2: i32 = bind_value %.loc32_8.1 -// CHECK:STDOUT: %.loc32_12: i32 = int_literal 4 [template = constants.%.6] +// CHECK:STDOUT: %.loc32_12: i32 = int_literal 4 [template = constants.%.7] // CHECK:STDOUT: assign %.loc32_8.2, %.loc32_12 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_invalid_base.carbon b/toolchain/check/testdata/index/fail_invalid_base.carbon index 659ef4e54c0f..779d95feae1e 100644 --- a/toolchain/check/testdata/index/fail_invalid_base.carbon +++ b/toolchain/check/testdata/index/fail_invalid_base.carbon @@ -33,11 +33,14 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.2, %.3) [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.6: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %struct.2: {.a: i32, .b: i32} = struct_value (%.3, %.4) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -45,7 +48,7 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .N = %N // CHECK:STDOUT: .a = %a -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .b = %b // CHECK:STDOUT: .c = %c // CHECK:STDOUT: .d = %d @@ -54,7 +57,7 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: %N: = 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.decl: F = fn_decl @F [template = constants.%struct.1] {} // 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 @@ -70,17 +73,17 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: %N.ref: = name_ref N, file.%N [template = file.%N] // CHECK:STDOUT: %.loc12: i32 = int_literal 0 [template = constants.%.1] // CHECK:STDOUT: assign file.%a.var, -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] -// CHECK:STDOUT: %.loc19: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc19: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: assign file.%b.var, -// CHECK:STDOUT: %.loc25_20: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc25_28: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc25_20: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc25_28: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: %.loc25_29.1: {.a: i32, .b: i32} = struct_literal (%.loc25_20, %.loc25_28) // CHECK:STDOUT: %.loc25_31: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.loc25_20, %.loc25_28) [template = constants.%struct] -// CHECK:STDOUT: %.loc25_29.2: {.a: i32, .b: i32} = converted %.loc25_29.1, %struct [template = constants.%struct] +// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.loc25_20, %.loc25_28) [template = constants.%struct.2] +// CHECK:STDOUT: %.loc25_29.2: {.a: i32, .b: i32} = converted %.loc25_29.1, %struct [template = constants.%struct.2] // CHECK:STDOUT: assign file.%c.var, -// CHECK:STDOUT: %.loc30_31: type = struct_type {.a: i32, .b: i32} [template = constants.%.4] +// CHECK:STDOUT: %.loc30_31: type = struct_type {.a: i32, .b: i32} [template = constants.%.5] // CHECK:STDOUT: %.loc30_33: i32 = int_literal 0 [template = constants.%.1] // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/index/fail_name_not_found.carbon b/toolchain/check/testdata/index/fail_name_not_found.carbon index 04b18eab1fb2..08414c0d2e54 100644 --- a/toolchain/check/testdata/index/fail_name_not_found.carbon +++ b/toolchain/check/testdata/index/fail_name_not_found.carbon @@ -14,16 +14,19 @@ fn Main() { // CHECK:STDOUT: --- fail_name_not_found.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { @@ -31,7 +34,7 @@ fn Main() { // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %a.ref: = name_ref a, [template = ] -// CHECK:STDOUT: %.loc11: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc11: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign %b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_non_tuple_access.carbon b/toolchain/check/testdata/index/fail_non_tuple_access.carbon index 627188eac010..8855ebc306bc 100644 --- a/toolchain/check/testdata/index/fail_non_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_non_tuple_access.carbon @@ -14,23 +14,26 @@ fn Main() { // CHECK:STDOUT: --- fail_non_tuple_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_3: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_5: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_3: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_5: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/tuple_return_value_access.carbon b/toolchain/check/testdata/index/tuple_return_value_access.carbon index be7fb756183c..3b9dc112168c 100644 --- a/toolchain/check/testdata/index/tuple_return_value_access.carbon +++ b/toolchain/check/testdata/index/tuple_return_value_access.carbon @@ -15,30 +15,35 @@ fn Run() -> i32 { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type (type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] -// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.3) [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.4: i32 = int_literal 0 [template] +// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.4) [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %struct.2: Run = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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: @F.%return: ref (i32,) = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Run: = fn_decl @Run [template] { +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] { // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> (i32,) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0 [template = constants.%.4] // CHECK:STDOUT: %.loc7_30: (i32,) = tuple_literal (%.loc7_28) // CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc7_28) [template = constants.%tuple] // CHECK:STDOUT: %.loc7_31: (i32,) = converted %.loc7_30, %tuple [template = constants.%tuple] @@ -47,9 +52,9 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init (i32,) = call %F.ref() -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 0 [template = constants.%.4] // CHECK:STDOUT: %.loc10_11.1: ref (i32,) = temporary_storage // CHECK:STDOUT: %.loc10_11.2: ref (i32,) = temporary %.loc10_11.1, %F.call // CHECK:STDOUT: %.loc10_15.1: ref i32 = tuple_index %.loc10_11.2, %.loc10_14 diff --git a/toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon b/toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon index 91246173576f..289c9897ef98 100644 --- a/toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon +++ b/toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon @@ -22,9 +22,15 @@ interface Interface { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Interface [template] // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Interface, [template] -// CHECK:STDOUT: %.3: in Interface> = assoc_entity element0, @Interface.%F [template] -// CHECK:STDOUT: %.4: in Interface> = assoc_entity element1, @Interface.%G [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Interface, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Interface.%F.decl [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @Interface, G [template] +// CHECK:STDOUT: %.6: = assoc_entity element1, @Interface.%G.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -38,22 +44,22 @@ interface Interface { // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F [template] {} -// CHECK:STDOUT: %.loc12: in Interface> = assoc_entity element0, %F [template = constants.%.3] -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc17_16.1: i32 = param a // CHECK:STDOUT: %a.loc17_16.2: i32 = bind_name a, %a.loc17_16.1 // CHECK:STDOUT: %b.loc17_24.1: i32 = param b // CHECK:STDOUT: %b.loc17_24.2: i32 = bind_name b, %b.loc17_24.1 // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc17: in Interface> = assoc_entity element1, %G [template = constants.%.4] +// CHECK:STDOUT: %.loc17: = assoc_entity element1, %G.decl [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc12 // CHECK:STDOUT: .G = %.loc17 -// CHECK:STDOUT: witness = (%F, %G) +// CHECK:STDOUT: witness = (%F.decl, %G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon b/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon index 21ca302e005d..36d56d8b2976 100644 --- a/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon +++ b/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon @@ -40,9 +40,19 @@ fn Interface.G(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Interface [template] // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Interface, [template] -// CHECK:STDOUT: %.3: in Interface> = assoc_entity element0, @Interface.%F [template] -// CHECK:STDOUT: %.4: in Interface> = assoc_entity element1, @Interface.%G [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Interface, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Interface.%F.decl [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @Interface, G [template] +// CHECK:STDOUT: %.6: = assoc_entity element1, @Interface.%G.decl [template] +// CHECK:STDOUT: %.7: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.3: = struct_value () [template] +// CHECK:STDOUT: %.8: type = fn_type @.2 [template] +// CHECK:STDOUT: %struct.4: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -52,8 +62,8 @@ fn Interface.G(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [template = constants.%.1] {} -// CHECK:STDOUT: %.loc28: = fn_decl @.1 [template] {} -// CHECK:STDOUT: %.loc36: = fn_decl @.2 [template] { +// CHECK:STDOUT: %.decl.loc28: = fn_decl @.1 [template = constants.%struct.3] {} +// CHECK:STDOUT: %.decl.loc36: = fn_decl @.2 [template = constants.%struct.4] { // CHECK:STDOUT: %a.loc36_16.1: i32 = param a // CHECK:STDOUT: @.2.%a: i32 = bind_name a, %a.loc36_16.1 // CHECK:STDOUT: %b.loc36_24.1: i32 = param b @@ -64,22 +74,22 @@ fn Interface.G(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F [template] {} -// CHECK:STDOUT: %.loc12: in Interface> = assoc_entity element0, %F [template = constants.%.3] -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc18_16.1: i32 = param a // CHECK:STDOUT: %a.loc18_16.2: i32 = bind_name a, %a.loc18_16.1 // CHECK:STDOUT: %b.loc18_24.1: i32 = param b // CHECK:STDOUT: %b.loc18_24.2: i32 = bind_name b, %b.loc18_24.1 // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc18: in Interface> = assoc_entity element1, %G [template = constants.%.4] +// CHECK:STDOUT: %.loc18: = assoc_entity element1, %G.decl [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc12 // CHECK:STDOUT: .G = %.loc18 -// CHECK:STDOUT: witness = (%F, %G) +// CHECK:STDOUT: witness = (%F.decl, %G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); diff --git a/toolchain/check/testdata/interface/no_prelude/as_type.carbon b/toolchain/check/testdata/interface/no_prelude/as_type.carbon index 5b82ef2af18e..84967e47eb5c 100644 --- a/toolchain/check/testdata/interface/no_prelude/as_type.carbon +++ b/toolchain/check/testdata/interface/no_prelude/as_type.carbon @@ -13,16 +13,18 @@ fn F(e: Empty) {} // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Empty [template] // CHECK:STDOUT: %Self: Empty = bind_symbolic_name Self 0 [symbolic] +// CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Empty = %Empty.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Empty.decl: type = interface_decl @Empty [template = constants.%.1] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // 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 diff --git a/toolchain/check/testdata/interface/no_prelude/as_type_of_type.carbon b/toolchain/check/testdata/interface/no_prelude/as_type_of_type.carbon index 9e08a880d81d..38c7b65c9690 100644 --- a/toolchain/check/testdata/interface/no_prelude/as_type_of_type.carbon +++ b/toolchain/check/testdata/interface/no_prelude/as_type_of_type.carbon @@ -16,16 +16,18 @@ fn F(T:! Empty) { // CHECK:STDOUT: %.1: type = interface_type @Empty [template] // CHECK:STDOUT: %Self: Empty = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %T: Empty = bind_symbolic_name T 0 [symbolic] +// CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Empty = %Empty.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Empty.decl: type = interface_decl @Empty [template = constants.%.1] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // 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 0, %T.loc9_6.1 [symbolic = constants.%T] diff --git a/toolchain/check/testdata/interface/no_prelude/basic.carbon b/toolchain/check/testdata/interface/no_prelude/basic.carbon index 9ff68a9677d6..3199f10caa70 100644 --- a/toolchain/check/testdata/interface/no_prelude/basic.carbon +++ b/toolchain/check/testdata/interface/no_prelude/basic.carbon @@ -20,8 +20,11 @@ interface ForwardDeclared { // CHECK:STDOUT: %Self.1: Empty = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.2: type = interface_type @ForwardDeclared [template] // CHECK:STDOUT: %Self.2: ForwardDeclared = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: type = assoc_entity_type @ForwardDeclared, [template] -// CHECK:STDOUT: %.4: in ForwardDeclared> = assoc_entity element0, @ForwardDeclared.%F [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = assoc_entity_type @ForwardDeclared, F [template] +// CHECK:STDOUT: %.5: = assoc_entity element0, @ForwardDeclared.%F.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -44,13 +47,13 @@ interface ForwardDeclared { // CHECK:STDOUT: // CHECK:STDOUT: interface @ForwardDeclared { // CHECK:STDOUT: %Self: ForwardDeclared = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %F: = fn_decl @F [template] {} -// CHECK:STDOUT: %.loc13: in ForwardDeclared> = assoc_entity element0, %F [template = constants.%.4] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %.loc13: = assoc_entity element0, %F.decl [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc13 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); diff --git a/toolchain/check/testdata/interface/no_prelude/default_fn.carbon b/toolchain/check/testdata/interface/no_prelude/default_fn.carbon index 1de61cea051f..d194b77f43ba 100644 --- a/toolchain/check/testdata/interface/no_prelude/default_fn.carbon +++ b/toolchain/check/testdata/interface/no_prelude/default_fn.carbon @@ -25,13 +25,17 @@ class C { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @I, [template] -// CHECK:STDOUT: %.3: in I> = assoc_entity element0, @I.%F [template] -// CHECK:STDOUT: %.4: = interface_witness (@impl.%F) [template] -// CHECK:STDOUT: %.5: type = struct_type {} [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @I, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @I.%F.decl [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.5: = interface_witness (%struct.2) [template] +// CHECK:STDOUT: %.6: type = struct_type {} [template] // CHECK:STDOUT: %.7: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -43,21 +47,21 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc10: in I> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc10: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc10 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as I { -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} -// CHECK:STDOUT: %.1: = interface_witness (%F) [template = constants.%.4] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -79,13 +83,13 @@ class C { // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var // CHECK:STDOUT: %.loc12_19.1: {} = struct_literal () -// CHECK:STDOUT: %.loc12_19.2: init C = class_init (), %c.var [template = constants.%struct] -// CHECK:STDOUT: %.loc12_20: init C = converted %.loc12_19.1, %.loc12_19.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc12_19.2: init C = class_init (), %c.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc12_20: init C = converted %.loc12_19.1, %.loc12_19.2 [template = constants.%struct.3] // CHECK:STDOUT: assign %c.var, %.loc12_20 // CHECK:STDOUT: %c.ref: ref C = name_ref c, %c // CHECK:STDOUT: %I.ref: type = name_ref I, @C.%I.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: in I> = name_ref F, @I.%.loc10 [template = constants.%.3] -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%F] +// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc10 [template = constants.%.4] +// CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/no_prelude/fail_add_member_outside_definition.carbon b/toolchain/check/testdata/interface/no_prelude/fail_add_member_outside_definition.carbon index cf84226f7934..8dae73b5c10e 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_add_member_outside_definition.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_add_member_outside_definition.carbon @@ -32,10 +32,17 @@ interface Outer { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Interface [template] // CHECK:STDOUT: %Self.1: Interface = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = interface_type @Outer [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = interface_type @Outer [template] // CHECK:STDOUT: %Self.2: Outer = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: type = interface_type @Inner [template] +// CHECK:STDOUT: %.4: type = interface_type @Inner [template] // CHECK:STDOUT: %Self.3: Inner = bind_symbolic_name Self 1 [symbolic] +// CHECK:STDOUT: %.5: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.2: = struct_value () [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -44,8 +51,8 @@ interface Outer { // CHECK:STDOUT: .Outer = %Outer.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [template = constants.%.1] {} -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %Outer.decl: type = interface_decl @Outer [template = constants.%.2] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %Outer.decl: type = interface_decl @Outer [template = constants.%.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { @@ -53,14 +60,14 @@ interface Outer { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = file.%F +// CHECK:STDOUT: .F = file.%F.decl // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Outer { // CHECK:STDOUT: %Self: Outer = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Inner.decl: type = interface_decl @Inner [template = constants.%.3] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} +// CHECK:STDOUT: %Inner.decl: type = interface_decl @Inner [template = constants.%.4] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -70,11 +77,11 @@ interface Outer { // CHECK:STDOUT: // CHECK:STDOUT: interface @Inner { // CHECK:STDOUT: %Self: Inner = bind_symbolic_name Self 1 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc22: = fn_decl @.1 [template] {} +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = @Outer.%F +// CHECK:STDOUT: .F = @Outer.%F.decl // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon b/toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon index bfee2ae1c808..de65a26ad809 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon @@ -43,28 +43,33 @@ interface Class { } // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Interface [template] // CHECK:STDOUT: %Self.1: Interface = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = interface_type @.1 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %Function: type = fn_type @Function [template] +// CHECK:STDOUT: %struct.2: Function = struct_value () [template] +// CHECK:STDOUT: %.3: type = interface_type @.1 [template] // CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %.3: type = interface_type @.2 [template] +// CHECK:STDOUT: %.4: type = interface_type @.2 [template] // CHECK:STDOUT: %Self.2: = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Interface = %Interface.decl.loc7 -// CHECK:STDOUT: .Function = %Function +// CHECK:STDOUT: .Function = %Function.decl // CHECK:STDOUT: .Class = %Class.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Interface.decl.loc7: type = interface_decl @Interface [template = constants.%.1] {} // CHECK:STDOUT: %Interface.decl.loc16: type = interface_decl @Interface [template = constants.%.1] {} -// CHECK:STDOUT: %Function: = fn_decl @Function [template] {} -// CHECK:STDOUT: %.decl.loc29: type = interface_decl @.1 [template = constants.%.2] {} +// CHECK:STDOUT: %Function.decl: Function = fn_decl @Function [template = constants.%struct.2] {} +// CHECK:STDOUT: %.decl.loc29: type = interface_decl @.1 [template = constants.%.3] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %.decl.loc39: type = interface_decl @.2 [template = constants.%.3] {} +// CHECK:STDOUT: %.decl.loc39: type = interface_decl @.2 [template = constants.%.4] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = diff --git a/toolchain/check/testdata/interface/no_prelude/fail_lookup_undefined.carbon b/toolchain/check/testdata/interface/no_prelude/fail_lookup_undefined.carbon index 9ed72d2d040f..e9a0068ed31e 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_lookup_undefined.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_lookup_undefined.carbon @@ -49,40 +49,49 @@ interface BeingDefined { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Undefined [template] -// CHECK:STDOUT: %.2: type = interface_type @BeingDefined [template] +// CHECK:STDOUT: %.2: type = fn_type @.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: = struct_value () [template] +// CHECK:STDOUT: %Test: type = fn_type @Test [template] +// CHECK:STDOUT: %struct.2: Test = struct_value () [template] +// CHECK:STDOUT: %.4: type = interface_type @BeingDefined [template] // CHECK:STDOUT: %Self: BeingDefined = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: type = assoc_entity_type @BeingDefined, [template] -// CHECK:STDOUT: %.4: in BeingDefined> = assoc_entity element0, @BeingDefined.%H [template] +// CHECK:STDOUT: %H: type = fn_type @H [template] +// CHECK:STDOUT: %struct.3: H = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @BeingDefined, H [template] +// CHECK:STDOUT: %.6: = assoc_entity element0, @BeingDefined.%H.decl [template] +// CHECK:STDOUT: %.7: type = fn_type @.2 [template] +// CHECK:STDOUT: %struct.4: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Undefined = %Undefined.decl -// CHECK:STDOUT: .Test = %Test +// CHECK:STDOUT: .Test = %Test.decl // CHECK:STDOUT: .BeingDefined = %BeingDefined.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Undefined.decl: type = interface_decl @Undefined [template = constants.%.1] {} -// CHECK:STDOUT: %.loc16: = fn_decl @.1 [template] {} -// CHECK:STDOUT: %Test: = fn_decl @Test [template] {} -// CHECK:STDOUT: %BeingDefined.decl: type = interface_decl @BeingDefined [template = constants.%.2] {} +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %Test.decl: Test = fn_decl @Test [template = constants.%struct.2] {} +// CHECK:STDOUT: %BeingDefined.decl: type = interface_decl @BeingDefined [template = constants.%.4] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Undefined; // CHECK:STDOUT: // CHECK:STDOUT: interface @BeingDefined { // CHECK:STDOUT: %Self: BeingDefined = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %H: = fn_decl @H [template] { -// CHECK:STDOUT: %BeingDefined.ref: type = name_ref BeingDefined, file.%BeingDefined.decl [template = constants.%.2] +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] { +// CHECK:STDOUT: %BeingDefined.ref: type = name_ref BeingDefined, file.%BeingDefined.decl [template = constants.%.4] // CHECK:STDOUT: %T.ref: = name_ref T, [template = ] // CHECK:STDOUT: %return.var: ref = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc41: in BeingDefined> = assoc_entity element0, %H [template = constants.%.4] -// CHECK:STDOUT: %.loc45: = fn_decl @.2 [template] {} +// CHECK:STDOUT: %.loc41: = assoc_entity element0, %H.decl [template = constants.%.6] +// CHECK:STDOUT: %.decl: = fn_decl @.2 [template = constants.%struct.4] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .H = %.loc41 -// CHECK:STDOUT: witness = (%H) +// CHECK:STDOUT: witness = (%H.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @.1(); diff --git a/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon b/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon index 6377e2c4b990..7f70cf941bd3 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon @@ -11,7 +11,7 @@ interface Interface { } fn F() { - // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:3: ERROR: Value of type ` in Interface>` is not callable. + // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+4]]:3: ERROR: Value of type `` is not callable. // CHECK:STDERR: Interface.F(); // CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: @@ -28,33 +28,38 @@ fn F() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Interface [template] // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Interface, [template] -// CHECK:STDOUT: %.3: in Interface> = assoc_entity element0, @Interface.%F [template] -// CHECK:STDOUT: %.4: type = assoc_entity_type @Interface, type [template] -// CHECK:STDOUT: %.5: = assoc_entity element1, @Interface.%T [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Interface, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Interface.%F.decl [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @Interface, type [template] +// CHECK:STDOUT: %.6: = assoc_entity element1, @Interface.%T [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Interface = %Interface.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [template = constants.%.1] {} -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc8: in Interface> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] -// CHECK:STDOUT: %.loc10: = assoc_entity element1, %T [template = constants.%.5] +// CHECK:STDOUT: %.loc10: = assoc_entity element1, %T [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8 // CHECK:STDOUT: .T = %.loc10 -// CHECK:STDOUT: witness = (%F, %T) +// CHECK:STDOUT: witness = (%F.decl, %T) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1(); @@ -62,9 +67,9 @@ fn F() { // CHECK:STDOUT: fn @F.2() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Interface.ref.loc18: type = name_ref Interface, file.%Interface.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: in Interface> = name_ref F, @Interface.%.loc8 [template = constants.%.3] +// CHECK:STDOUT: %F.ref: = name_ref F, @Interface.%.loc8 [template = constants.%.4] // CHECK:STDOUT: %Interface.ref.loc23: type = name_ref Interface, file.%Interface.decl [template = constants.%.1] -// CHECK:STDOUT: %T.ref: = name_ref T, @Interface.%.loc10 [template = constants.%.5] +// CHECK:STDOUT: %T.ref: = name_ref T, @Interface.%.loc10 [template = constants.%.6] // CHECK:STDOUT: %v.var: ref = var v // CHECK:STDOUT: %v: ref = bind_name v, %v.var // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon b/toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon index 481301669f5e..94abbf632a71 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon @@ -20,8 +20,13 @@ interface Interface { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Interface [template] // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Interface, [template] -// CHECK:STDOUT: %.3: in Interface> = assoc_entity element0, @Interface.%F [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Interface, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Interface.%F.decl [template] +// CHECK:STDOUT: %.5: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.2: = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -33,14 +38,14 @@ interface Interface { // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// 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: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); diff --git a/toolchain/check/testdata/interface/no_prelude/fail_todo_facet_lookup.carbon b/toolchain/check/testdata/interface/no_prelude/fail_todo_facet_lookup.carbon index 0e0a37341a54..66f0970140be 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_todo_facet_lookup.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_todo_facet_lookup.carbon @@ -7,7 +7,7 @@ interface Interface { fn F(); } fn CallStatic(T:! Interface) { - // CHECK:STDERR: fail_todo_facet_lookup.carbon:[[@LINE+4]]:3: ERROR: Value of type ` in Interface>` is not callable. + // CHECK:STDERR: fail_todo_facet_lookup.carbon:[[@LINE+4]]:3: ERROR: Value of type `` is not callable. // CHECK:STDERR: T.F(); // CHECK:STDERR: ^~~~ // CHECK:STDERR: @@ -26,25 +26,31 @@ fn CallFacet(T:! Interface, x: T) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Interface [template] // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Interface, [template] -// CHECK:STDOUT: %.3: in Interface> = assoc_entity element0, @Interface.%F [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Interface, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Interface.%F.decl [template] // CHECK:STDOUT: %T: Interface = bind_symbolic_name T 0 [symbolic] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %CallStatic: type = fn_type @CallStatic [template] +// CHECK:STDOUT: %struct.2: CallStatic = struct_value () [template] +// CHECK:STDOUT: %CallFacet: type = fn_type @CallFacet [template] +// CHECK:STDOUT: %struct.3: CallFacet = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Interface = %Interface.decl -// CHECK:STDOUT: .CallStatic = %CallStatic -// CHECK:STDOUT: .CallFacet = %CallFacet +// CHECK:STDOUT: .CallStatic = %CallStatic.decl +// CHECK:STDOUT: .CallFacet = %CallFacet.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [template = constants.%.1] {} -// CHECK:STDOUT: %CallStatic: = fn_decl @CallStatic [template] { +// CHECK:STDOUT: %CallStatic.decl: CallStatic = fn_decl @CallStatic [template = constants.%struct.2] { // CHECK:STDOUT: %Interface.ref.loc9: 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 0, %T.loc9_15.1 [symbolic = constants.%T] // CHECK:STDOUT: } -// CHECK:STDOUT: %CallFacet: = fn_decl @CallFacet [template] { +// CHECK:STDOUT: %CallFacet.decl: CallFacet = fn_decl @CallFacet [template = constants.%struct.3] { // CHECK:STDOUT: %Interface.ref.loc17: type = name_ref Interface, %Interface.decl [template = constants.%.1] // CHECK:STDOUT: %T.loc17_14.1: Interface = param T // CHECK:STDOUT: @CallFacet.%T: Interface = bind_symbolic_name T 0, %T.loc17_14.1 [symbolic = constants.%T] @@ -58,13 +64,13 @@ fn CallFacet(T:! Interface, x: T) { // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F [template] {} -// CHECK:STDOUT: %.loc7: in Interface> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc7: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc7 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); @@ -72,7 +78,7 @@ fn CallFacet(T:! Interface, x: T) { // CHECK:STDOUT: fn @CallStatic(%T: Interface) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref: Interface = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %F.ref: in Interface> = name_ref F, @Interface.%.loc7 [template = constants.%.3] +// CHECK:STDOUT: %F.ref: = name_ref F, @Interface.%.loc7 [template = constants.%.4] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/fail_todo_modifiers.carbon b/toolchain/check/testdata/interface/no_prelude/fail_todo_modifiers.carbon index 4d1078b2b675..11e08028f69b 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_todo_modifiers.carbon @@ -28,10 +28,16 @@ private interface Private { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Modifiers [template] // CHECK:STDOUT: %Self.1: Modifiers = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Modifiers, [template] -// CHECK:STDOUT: %.3: in Modifiers> = assoc_entity element0, @Modifiers.%Final [template] -// CHECK:STDOUT: %.4: in Modifiers> = assoc_entity element1, @Modifiers.%Default [template] -// CHECK:STDOUT: %.5: type = interface_type @Private [template] +// CHECK:STDOUT: %Final: type = fn_type @Final [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Final = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Modifiers, Final [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Modifiers.%Final.decl [template] +// CHECK:STDOUT: %Default: type = fn_type @Default [template] +// CHECK:STDOUT: %struct.2: Default = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @Modifiers, Default [template] +// CHECK:STDOUT: %.6: = assoc_entity element1, @Modifiers.%Default.decl [template] +// CHECK:STDOUT: %.7: type = interface_type @Private [template] // CHECK:STDOUT: %Self.2: Private = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -41,21 +47,21 @@ private interface Private { // CHECK:STDOUT: .Private = %Private.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Modifiers.decl: type = interface_decl @Modifiers [template = constants.%.1] {} -// CHECK:STDOUT: %Private.decl: type = interface_decl @Private [template = constants.%.5] {} +// CHECK:STDOUT: %Private.decl: type = interface_decl @Private [template = constants.%.7] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Modifiers { // CHECK:STDOUT: %Self: Modifiers = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Final: = fn_decl @Final [template] {} -// CHECK:STDOUT: %.loc12: in Modifiers> = assoc_entity element0, %Final [template = constants.%.3] -// CHECK:STDOUT: %Default: = fn_decl @Default [template] {} -// CHECK:STDOUT: %.loc17: in Modifiers> = assoc_entity element1, %Default [template = constants.%.4] +// CHECK:STDOUT: %Final.decl: Final = fn_decl @Final [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %Final.decl [template = constants.%.4] +// CHECK:STDOUT: %Default.decl: Default = fn_decl @Default [template = constants.%struct.2] {} +// CHECK:STDOUT: %.loc17: = assoc_entity element1, %Default.decl [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Final = %.loc12 // CHECK:STDOUT: .Default = %.loc17 -// CHECK:STDOUT: witness = (%Final, %Default) +// CHECK:STDOUT: witness = (%Final.decl, %Default.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Private { diff --git a/toolchain/check/testdata/interface/no_prelude/generic_binding_after_assoc_const.carbon b/toolchain/check/testdata/interface/no_prelude/generic_binding_after_assoc_const.carbon index ce75bdbcbfc6..d427af642620 100644 --- a/toolchain/check/testdata/interface/no_prelude/generic_binding_after_assoc_const.carbon +++ b/toolchain/check/testdata/interface/no_prelude/generic_binding_after_assoc_const.carbon @@ -18,11 +18,17 @@ interface I { // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %T: type = bind_symbolic_name T 1 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @I, [template] -// CHECK:STDOUT: %.3: in I> = assoc_entity element0, @I.%F [template] -// CHECK:STDOUT: %.4: type = assoc_entity_type @I, type [template] -// CHECK:STDOUT: %.5: = assoc_entity element1, @I.%U [template] -// CHECK:STDOUT: %.6: in I> = assoc_entity element2, @I.%G [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @I, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @I.%F.decl [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @I, type [template] +// CHECK:STDOUT: %.6: = assoc_entity element1, @I.%U [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @I, G [template] +// CHECK:STDOUT: %.8: = assoc_entity element2, @I.%G.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -34,25 +40,25 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %T.loc8_8.1: type = param T // CHECK:STDOUT: %T.loc8_8.2: type = bind_symbolic_name T 1, %T.loc8_8.1 [symbolic = constants.%T] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: in I> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: %U: type = assoc_const_decl U [template] -// CHECK:STDOUT: %.loc9: = assoc_entity element1, %U [template = constants.%.5] -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %.loc9: = assoc_entity element1, %U [template = constants.%.6] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %T.loc12_8.1: type = param T // CHECK:STDOUT: %T.loc12_8.2: type = bind_symbolic_name T 1, %T.loc12_8.1 [symbolic = constants.%T] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12: in I> = assoc_entity element2, %G [template = constants.%.6] +// CHECK:STDOUT: %.loc12: = assoc_entity element2, %G.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8 // CHECK:STDOUT: .U = %.loc9 // CHECK:STDOUT: .G = %.loc12 -// CHECK:STDOUT: witness = (%F, %U, %G) +// CHECK:STDOUT: witness = (%F.decl, %U, %G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(@I.%T.loc8_8.2: type); diff --git a/toolchain/check/testdata/interface/no_prelude/import.carbon b/toolchain/check/testdata/interface/no_prelude/import.carbon index 86b72dfb4880..7472c99f74f1 100644 --- a/toolchain/check/testdata/interface/no_prelude/import.carbon +++ b/toolchain/check/testdata/interface/no_prelude/import.carbon @@ -53,16 +53,20 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: %Self.2: Basic = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.3: type = assoc_entity_type @Basic, type [template] // CHECK:STDOUT: %.4: = assoc_entity element0, @Basic.%T [template] -// CHECK:STDOUT: %.5: type = assoc_entity_type @Basic, [template] -// CHECK:STDOUT: %.6: in Basic> = assoc_entity element1, @Basic.%F [template] -// CHECK:STDOUT: %.7: type = interface_type @ForwardDeclared [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %.5: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.6: type = assoc_entity_type @Basic, F [template] +// CHECK:STDOUT: %.7: = assoc_entity element1, @Basic.%F.decl [template] +// CHECK:STDOUT: %.8: type = interface_type @ForwardDeclared [template] // CHECK:STDOUT: %Self.3: ForwardDeclared = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.8: type = assoc_entity_type @ForwardDeclared, type [template] -// CHECK:STDOUT: %.9: = assoc_entity element0, @ForwardDeclared.%T [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @ForwardDeclared, [template] -// CHECK:STDOUT: %.11: in ForwardDeclared> = assoc_entity element1, @ForwardDeclared.%F [template] -// CHECK:STDOUT: %.12: type = struct_type {.f: ForwardDeclared} [template] -// CHECK:STDOUT: %.13: type = tuple_type () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type @ForwardDeclared, type [template] +// CHECK:STDOUT: %.10: = assoc_entity element0, @ForwardDeclared.%T [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.11: type = assoc_entity_type @ForwardDeclared, F [template] +// CHECK:STDOUT: %.12: = assoc_entity element1, @ForwardDeclared.%F.decl [template] +// CHECK:STDOUT: %.13: type = struct_type {.f: ForwardDeclared} [template] // CHECK:STDOUT: %.14: type = struct_type {.f: ()} [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -75,9 +79,9 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: } // CHECK:STDOUT: %Empty.decl: type = interface_decl @Empty [template = constants.%.1] {} // CHECK:STDOUT: %Basic.decl: type = interface_decl @Basic [template = constants.%.2] {} -// CHECK:STDOUT: %ForwardDeclared.decl: type = interface_decl @ForwardDeclared [template = constants.%.7] {} -// CHECK:STDOUT: %ForwardDeclared.ref: type = name_ref ForwardDeclared, %ForwardDeclared.decl [template = constants.%.7] -// CHECK:STDOUT: %.loc20: type = struct_type {.f: ForwardDeclared} [template = constants.%.12] +// CHECK:STDOUT: %ForwardDeclared.decl: type = interface_decl @ForwardDeclared [template = constants.%.8] {} +// CHECK:STDOUT: %ForwardDeclared.ref: type = name_ref ForwardDeclared, %ForwardDeclared.decl [template = constants.%.8] +// CHECK:STDOUT: %.loc20: type = struct_type {.f: ForwardDeclared} [template = constants.%.13] // CHECK:STDOUT: %f_ref.var: ref {.f: ForwardDeclared} = var f_ref // CHECK:STDOUT: %f_ref: ref {.f: ForwardDeclared} = bind_name f_ref, %f_ref.var // CHECK:STDOUT: } @@ -94,28 +98,28 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: %Self: Basic = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] // CHECK:STDOUT: %.loc8: = assoc_entity element0, %T [template = constants.%.4] -// CHECK:STDOUT: %F: = fn_decl @F.1 [template] {} -// CHECK:STDOUT: %.loc9: in Basic> = assoc_entity element1, %F [template = constants.%.6] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc9: = assoc_entity element1, %F.decl [template = constants.%.7] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .T = %.loc8 // CHECK:STDOUT: .F = %.loc9 -// CHECK:STDOUT: witness = (%T, %F) +// CHECK:STDOUT: witness = (%T, %F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @ForwardDeclared { // CHECK:STDOUT: %Self: ForwardDeclared = bind_symbolic_name Self 0 [symbolic = constants.%Self.3] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] -// CHECK:STDOUT: %.loc16: = assoc_entity element0, %T [template = constants.%.9] -// CHECK:STDOUT: %F: = fn_decl @F.2 [template] {} -// CHECK:STDOUT: %.loc17: in ForwardDeclared> = assoc_entity element1, %F [template = constants.%.11] +// CHECK:STDOUT: %.loc16: = assoc_entity element0, %T [template = constants.%.10] +// CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %.loc17: = assoc_entity element1, %F.decl [template = constants.%.12] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .T = %.loc16 // CHECK:STDOUT: .F = %.loc17 -// CHECK:STDOUT: witness = (%T, %F) +// CHECK:STDOUT: witness = (%T, %F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1(); @@ -127,19 +131,29 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Empty [template] // CHECK:STDOUT: %Self.1: Empty = bind_symbolic_name Self 0 [symbolic] +// CHECK:STDOUT: %UseEmpty: type = fn_type @UseEmpty [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: UseEmpty = struct_value () [template] // CHECK:STDOUT: %.3: type = interface_type @Basic [template] // CHECK:STDOUT: %Self.2: Basic = bind_symbolic_name Self 0 [symbolic] +// CHECK:STDOUT: %UseBasic: type = fn_type @UseBasic [template] +// CHECK:STDOUT: %struct.2: UseBasic = struct_value () [template] // CHECK:STDOUT: %.4: type = interface_type @ForwardDeclared [template] // CHECK:STDOUT: %Self.3: ForwardDeclared = bind_symbolic_name Self 0 [symbolic] +// CHECK:STDOUT: %UseForwardDeclared: type = fn_type @UseForwardDeclared [template] +// CHECK:STDOUT: %struct.3: UseForwardDeclared = struct_value () [template] // CHECK:STDOUT: %.5: type = assoc_entity_type @Basic, type [template] // CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.16 [template] -// CHECK:STDOUT: %.7: type = assoc_entity_type @Basic, [template] -// CHECK:STDOUT: %.8: in Basic> = assoc_entity element1, file.%import_ref.17 [template] +// CHECK:STDOUT: %F.1: type = fn_type @F.1 [template] +// CHECK:STDOUT: %struct.4: F = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @Basic, F [template] +// CHECK:STDOUT: %.8: = assoc_entity element1, file.%import_ref.17 [template] // CHECK:STDOUT: %.9: type = assoc_entity_type @ForwardDeclared, type [template] // CHECK:STDOUT: %.10: = assoc_entity element0, file.%import_ref.18 [template] -// CHECK:STDOUT: %.11: type = assoc_entity_type @ForwardDeclared, [template] -// CHECK:STDOUT: %.12: in ForwardDeclared> = assoc_entity element1, file.%import_ref.19 [template] +// CHECK:STDOUT: %F.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %struct.5: F = struct_value () [template] +// CHECK:STDOUT: %.11: type = assoc_entity_type @ForwardDeclared, F [template] +// CHECK:STDOUT: %.12: = assoc_entity element1, file.%import_ref.19 [template] // CHECK:STDOUT: %.13: type = ptr_type ForwardDeclared [template] // CHECK:STDOUT: %.14: type = struct_type {.f: ForwardDeclared} [template] // CHECK:STDOUT: %.15: type = struct_type {.f: ()} [template] @@ -151,9 +165,9 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: .Basic = %import_ref.2 // CHECK:STDOUT: .ForwardDeclared = %import_ref.3 // CHECK:STDOUT: .f_ref = %import_ref.4 -// CHECK:STDOUT: .UseEmpty = %UseEmpty -// CHECK:STDOUT: .UseBasic = %UseBasic -// CHECK:STDOUT: .UseForwardDeclared = %UseForwardDeclared +// CHECK:STDOUT: .UseEmpty = %UseEmpty.decl +// CHECK:STDOUT: .UseBasic = %UseBasic.decl +// CHECK:STDOUT: .UseForwardDeclared = %UseForwardDeclared.decl // CHECK:STDOUT: .UseBasicT = %UseBasicT // CHECK:STDOUT: .UseBasicF = %UseBasicF // CHECK:STDOUT: .UseForwardDeclaredT = %UseForwardDeclaredT @@ -162,32 +176,32 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, loc_13 [template = constants.%.1] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+5, loc_22 [template = constants.%.3] -// CHECK:STDOUT: %import_ref.3: type = import_ref ir1, inst+17, loc_31 [template = constants.%.4] -// CHECK:STDOUT: %import_ref.4: ref {.f: ForwardDeclared} = import_ref ir1, inst+38, loc_70 +// CHECK:STDOUT: %import_ref.3: type = import_ref ir1, inst+20, loc_31 [template = constants.%.4] +// CHECK:STDOUT: %import_ref.4: ref {.f: ForwardDeclared} = import_ref ir1, inst+42, loc_70 // CHECK:STDOUT: %import_ref.5 = import_ref ir1, inst+3, unloaded -// CHECK:STDOUT: %UseEmpty: = fn_decl @UseEmpty [template] { +// CHECK:STDOUT: %UseEmpty.decl: UseEmpty = fn_decl @UseEmpty [template = constants.%struct.1] { // CHECK:STDOUT: %Empty.decl: type = 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: } // CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+7, unloaded -// CHECK:STDOUT: %import_ref.7: in Basic> = import_ref ir1, inst+15, loc_48 [template = constants.%.8] +// CHECK:STDOUT: %import_ref.7: = import_ref ir1, inst+18, loc_48 [template = constants.%.8] // CHECK:STDOUT: %import_ref.8: = import_ref ir1, inst+11, loc_41 [template = constants.%.6] // CHECK:STDOUT: %import_ref.9 = import_ref ir1, inst+9, unloaded // CHECK:STDOUT: %import_ref.10 = import_ref ir1, inst+13, unloaded -// CHECK:STDOUT: %UseBasic: = fn_decl @UseBasic [template] { +// CHECK:STDOUT: %UseBasic.decl: UseBasic = fn_decl @UseBasic [template = constants.%struct.2] { // CHECK:STDOUT: %Basic.decl: type = interface_decl @Basic [template = constants.%.3] {} // CHECK:STDOUT: %Basic.ref.loc7: type = name_ref Basic, %import_ref.2 [template = constants.%.3] // CHECK:STDOUT: %e.loc7_13.1: Basic = param e // CHECK:STDOUT: @UseBasic.%e: Basic = bind_name e, %e.loc7_13.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11 = import_ref ir1, inst+19, unloaded -// CHECK:STDOUT: %import_ref.12: in ForwardDeclared> = import_ref ir1, inst+27, loc_62 [template = constants.%.12] -// CHECK:STDOUT: %import_ref.13: = import_ref ir1, inst+23, loc_55 [template = constants.%.10] -// CHECK:STDOUT: %import_ref.14 = import_ref ir1, inst+21, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref ir1, inst+25, unloaded -// CHECK:STDOUT: %UseForwardDeclared: = fn_decl @UseForwardDeclared [template] { +// CHECK:STDOUT: %import_ref.11 = import_ref ir1, inst+22, unloaded +// CHECK:STDOUT: %import_ref.12: = import_ref ir1, inst+32, loc_62 [template = constants.%.12] +// CHECK:STDOUT: %import_ref.13: = import_ref ir1, inst+26, loc_55 [template = constants.%.10] +// CHECK:STDOUT: %import_ref.14 = import_ref ir1, inst+24, unloaded +// CHECK:STDOUT: %import_ref.15 = import_ref ir1, inst+28, unloaded +// CHECK:STDOUT: %UseForwardDeclared.decl: UseForwardDeclared = fn_decl @UseForwardDeclared [template = constants.%struct.3] { // CHECK:STDOUT: %ForwardDeclared.decl: type = interface_decl @ForwardDeclared [template = constants.%.4] {} // CHECK:STDOUT: %ForwardDeclared.ref.loc8: type = name_ref ForwardDeclared, %import_ref.3 [template = constants.%.4] // CHECK:STDOUT: %f.loc8_23.1: ForwardDeclared = param f @@ -199,16 +213,16 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: %UseBasicT: = bind_alias UseBasicT, %import_ref.8 [template = constants.%.6] // CHECK:STDOUT: %Basic.ref.loc11: type = name_ref Basic, %import_ref.2 [template = constants.%.3] // CHECK:STDOUT: %import_ref.17 = import_ref ir1, inst+13, unloaded -// CHECK:STDOUT: %F.ref.loc11: in Basic> = name_ref F, %import_ref.7 [template = constants.%.8] -// CHECK:STDOUT: %UseBasicF: in Basic> = bind_alias UseBasicF, %import_ref.7 [template = constants.%.8] +// CHECK:STDOUT: %F.ref.loc11: = name_ref F, %import_ref.7 [template = constants.%.8] +// CHECK:STDOUT: %UseBasicF: = bind_alias UseBasicF, %import_ref.7 [template = constants.%.8] // CHECK:STDOUT: %ForwardDeclared.ref.loc13: type = name_ref ForwardDeclared, %import_ref.3 [template = constants.%.4] -// CHECK:STDOUT: %import_ref.18 = import_ref ir1, inst+21, unloaded +// CHECK:STDOUT: %import_ref.18 = import_ref ir1, inst+24, unloaded // CHECK:STDOUT: %T.ref.loc13: = name_ref T, %import_ref.13 [template = constants.%.10] // CHECK:STDOUT: %UseForwardDeclaredT: = bind_alias UseForwardDeclaredT, %import_ref.13 [template = constants.%.10] // CHECK:STDOUT: %ForwardDeclared.ref.loc14: type = name_ref ForwardDeclared, %import_ref.3 [template = constants.%.4] -// CHECK:STDOUT: %import_ref.19 = import_ref ir1, inst+25, unloaded -// CHECK:STDOUT: %F.ref.loc14: in ForwardDeclared> = name_ref F, %import_ref.12 [template = constants.%.12] -// CHECK:STDOUT: %UseForwardDeclaredF: in ForwardDeclared> = bind_alias UseForwardDeclaredF, %import_ref.12 [template = constants.%.12] +// CHECK:STDOUT: %import_ref.19 = import_ref ir1, inst+28, unloaded +// CHECK:STDOUT: %F.ref.loc14: = name_ref F, %import_ref.12 [template = constants.%.12] +// CHECK:STDOUT: %UseForwardDeclaredF: = bind_alias UseForwardDeclaredF, %import_ref.12 [template = constants.%.12] // CHECK:STDOUT: %ForwardDeclared.ref.loc16: type = name_ref ForwardDeclared, %import_ref.3 [template = constants.%.4] // CHECK:STDOUT: %.loc16: type = ptr_type ForwardDeclared [template = constants.%.13] // CHECK:STDOUT: %f.var: ref ForwardDeclared* = var f @@ -252,6 +266,10 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @F.1(); +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F.2(); +// CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %f_ref.ref: ref {.f: ForwardDeclared} = name_ref f_ref, file.%import_ref.4 diff --git a/toolchain/check/testdata/interface/no_prelude/self.carbon b/toolchain/check/testdata/interface/no_prelude/self.carbon index c9508983717e..a67ae9904dce 100644 --- a/toolchain/check/testdata/interface/no_prelude/self.carbon +++ b/toolchain/check/testdata/interface/no_prelude/self.carbon @@ -13,8 +13,11 @@ interface UseSelf { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @UseSelf [template] // CHECK:STDOUT: %Self: UseSelf = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @UseSelf, [template] -// CHECK:STDOUT: %.3: in UseSelf> = assoc_entity element0, @UseSelf.%F [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @UseSelf, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @UseSelf.%F.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -26,7 +29,7 @@ interface UseSelf { // CHECK:STDOUT: // CHECK:STDOUT: interface @UseSelf { // CHECK:STDOUT: %Self: UseSelf = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %Self.ref.loc8_14: UseSelf = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc8_14.1: type = facet_type_access %Self.ref.loc8_14 [symbolic = constants.%Self] // CHECK:STDOUT: %.loc8_14.2: type = converted %Self.ref.loc8_14, %.loc8_14.1 [symbolic = constants.%Self] @@ -37,12 +40,12 @@ interface UseSelf { // CHECK:STDOUT: %.loc8_25.2: type = converted %Self.ref.loc8_25, %.loc8_25.1 [symbolic = constants.%Self] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_29: in UseSelf> = assoc_entity element0, %F [template = constants.%.3] +// CHECK:STDOUT: %.loc8_29: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .F = %.loc8_29 -// CHECK:STDOUT: witness = (%F) +// CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F[@UseSelf.%self.loc8_8.2: Self]() -> Self; diff --git a/toolchain/check/testdata/interface/todo_define_not_default.carbon b/toolchain/check/testdata/interface/todo_define_not_default.carbon index 7fb31dd00562..5743f6e129f4 100644 --- a/toolchain/check/testdata/interface/todo_define_not_default.carbon +++ b/toolchain/check/testdata/interface/todo_define_not_default.carbon @@ -20,16 +20,22 @@ interface I { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @I [template] // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @I, [template] -// CHECK:STDOUT: %.3: in I> = assoc_entity element0, @I.%F [template] -// CHECK:STDOUT: %.4: in I> = assoc_entity element1, @I.%G [template] -// CHECK:STDOUT: %.5: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.6: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.7: type = assoc_entity_type @I, type [template] -// CHECK:STDOUT: %.8: = assoc_entity element2, @I.%T [template] -// CHECK:STDOUT: %.9: i32 = int_literal 42 [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @I, i32 [template] -// CHECK:STDOUT: %.11: = assoc_entity element3, @I.%N [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @I, F [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @I.%F.decl [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @I, G [template] +// CHECK:STDOUT: %.6: = assoc_entity element1, @I.%G.decl [template] +// CHECK:STDOUT: %.7: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.8: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type @I, type [template] +// CHECK:STDOUT: %.10: = assoc_entity element2, @I.%T [template] +// CHECK:STDOUT: %.11: i32 = int_literal 42 [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @I, i32 [template] +// CHECK:STDOUT: %.13: = assoc_entity element3, @I.%N [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -43,23 +49,23 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %F: = fn_decl @F [template] {} -// CHECK:STDOUT: %.loc9: in I> = assoc_entity element0, %F [template = constants.%.3] -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} +// CHECK:STDOUT: %.loc9: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %a.loc10_8.1: i32 = param a // CHECK:STDOUT: %a.loc10_8.2: i32 = bind_name a, %a.loc10_8.1 // CHECK:STDOUT: %b.loc10_16.1: i32 = param b // CHECK:STDOUT: %b.loc10_16.2: i32 = bind_name b, %b.loc10_16.1 // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: in I> = assoc_entity element1, %G [template = constants.%.4] +// CHECK:STDOUT: %.loc10: = assoc_entity element1, %G.decl [template = constants.%.6] // CHECK:STDOUT: %.loc14_27: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc14_28.1: type = converted %.loc14_27, constants.%.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_28.1: type = converted %.loc14_27, constants.%.8 [template = constants.%.8] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] -// CHECK:STDOUT: %.loc14_28.2: = assoc_entity element2, %T [template = constants.%.8] -// CHECK:STDOUT: %.loc15_17: i32 = int_literal 42 [template = constants.%.9] +// CHECK:STDOUT: %.loc14_28.2: = assoc_entity element2, %T [template = constants.%.10] +// CHECK:STDOUT: %.loc15_17: i32 = int_literal 42 [template = constants.%.11] // CHECK:STDOUT: %N: i32 = assoc_const_decl N [template] -// CHECK:STDOUT: %.loc15_19: = assoc_entity element3, %N [template = constants.%.11] +// CHECK:STDOUT: %.loc15_19: = assoc_entity element3, %N [template = constants.%.13] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -67,7 +73,7 @@ interface I { // CHECK:STDOUT: .G = %.loc10 // CHECK:STDOUT: .T = %.loc14_28.2 // CHECK:STDOUT: .N = %.loc15_19 -// CHECK:STDOUT: witness = (%F, %G, %T, %N) +// CHECK:STDOUT: witness = (%F.decl, %G.decl, %T, %N) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon index 692d252ebb83..53d80488520b 100644 --- a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon +++ b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon @@ -9,40 +9,43 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: --- duplicate_name_same_line.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal true [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_14: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc7_14: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc7_14 br !if.then.loc7_18 else br !if.else.loc7_18 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc7_18: // CHECK:STDOUT: %n.var.loc7_26: ref i32 = var n // CHECK:STDOUT: %n.loc7_26: ref i32 = bind_name n, %n.var.loc7_26 -// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: assign %n.var.loc7_26, %.loc7_35 // CHECK:STDOUT: br !if.else.loc7_18 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc7_18: -// CHECK:STDOUT: %.loc7_44: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc7_44: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc7_44 br !if.then.loc7_48 else br !if.else.loc7_48 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc7_48: // CHECK:STDOUT: %n.var.loc7_56: ref i32 = var n // CHECK:STDOUT: %n.loc7_56: ref i32 = bind_name n, %n.var.loc7_56 -// CHECK:STDOUT: %.loc7_65: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_65: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: assign %n.var.loc7_56, %.loc7_65 // CHECK:STDOUT: br !if.else.loc7_48 // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/convert.carbon b/toolchain/check/testdata/let/convert.carbon index cbfd565d38fd..4c6cbca65e93 100644 --- a/toolchain/check/testdata/let/convert.carbon +++ b/toolchain/check/testdata/let/convert.carbon @@ -14,22 +14,25 @@ fn F() -> i32 { // CHECK:STDOUT: --- convert.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 3 [template] -// CHECK:STDOUT: %tuple: (i32, i32, i32) = tuple_value (%.4, %.5, %.6) [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = tuple_type (type, type, type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.7: i32 = int_literal 3 [template] +// CHECK:STDOUT: %tuple: (i32, i32, i32) = tuple_value (%.5, %.6, %.7) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -37,24 +40,24 @@ fn F() -> i32 { // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc8_24.1: (type, type, type) = tuple_literal (i32, i32, i32) -// CHECK:STDOUT: %.loc8_24.2: type = converted %.loc8_24.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_24.2: type = converted %.loc8_24.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %v.var: ref (i32, i32, i32) = var v // CHECK:STDOUT: %v: ref (i32, i32, i32) = bind_name v, %v.var -// CHECK:STDOUT: %.loc8_29: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_32: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_35: i32 = int_literal 3 [template = constants.%.6] +// CHECK:STDOUT: %.loc8_29: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc8_32: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc8_35: i32 = int_literal 3 [template = constants.%.7] // CHECK:STDOUT: %.loc8_36.1: (i32, i32, i32) = tuple_literal (%.loc8_29, %.loc8_32, %.loc8_35) // CHECK:STDOUT: %.loc8_36.2: ref i32 = tuple_access %v.var, element0 -// CHECK:STDOUT: %.loc8_36.3: init i32 = initialize_from %.loc8_29 to %.loc8_36.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_36.3: init i32 = initialize_from %.loc8_29 to %.loc8_36.2 [template = constants.%.5] // CHECK:STDOUT: %.loc8_36.4: ref i32 = tuple_access %v.var, element1 -// CHECK:STDOUT: %.loc8_36.5: init i32 = initialize_from %.loc8_32 to %.loc8_36.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc8_36.5: init i32 = initialize_from %.loc8_32 to %.loc8_36.4 [template = constants.%.6] // CHECK:STDOUT: %.loc8_36.6: ref i32 = tuple_access %v.var, element2 -// CHECK:STDOUT: %.loc8_36.7: init i32 = initialize_from %.loc8_35 to %.loc8_36.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc8_36.7: init i32 = initialize_from %.loc8_35 to %.loc8_36.6 [template = constants.%.7] // CHECK:STDOUT: %.loc8_36.8: init (i32, i32, i32) = tuple_init (%.loc8_36.3, %.loc8_36.5, %.loc8_36.7) to %v.var [template = constants.%tuple] // CHECK:STDOUT: %.loc8_37: init (i32, i32, i32) = converted %.loc8_36.1, %.loc8_36.8 [template = constants.%tuple] // CHECK:STDOUT: assign %v.var, %.loc8_37 // CHECK:STDOUT: %.loc10_24.1: (type, type, type) = tuple_literal (i32, i32, i32) -// CHECK:STDOUT: %.loc10_24.2: type = converted %.loc10_24.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_24.2: type = converted %.loc10_24.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %v.ref: ref (i32, i32, i32) = name_ref v, %v // CHECK:STDOUT: %.loc10_28.1: ref i32 = tuple_access %v.ref, element0 // CHECK:STDOUT: %.loc10_28.2: i32 = bind_value %.loc10_28.1 @@ -66,7 +69,7 @@ fn F() -> i32 { // CHECK:STDOUT: %.loc10_29: (i32, i32, i32) = converted %v.ref, %tuple // CHECK:STDOUT: %w: (i32, i32, i32) = bind_name w, %.loc10_29 // CHECK:STDOUT: %w.ref: (i32, i32, i32) = name_ref w, %w -// CHECK:STDOUT: %.loc11_12: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_12: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc11_13: i32 = tuple_index %w.ref, %.loc11_12 // CHECK:STDOUT: return %.loc11_13 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/fail_duplicate_decl.carbon b/toolchain/check/testdata/let/fail_duplicate_decl.carbon index 8d4b9093aa9d..f6e219f9bcc6 100644 --- a/toolchain/check/testdata/let/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/let/fail_duplicate_decl.carbon @@ -18,24 +18,27 @@ fn F() { // CHECK:STDOUT: --- fail_duplicate_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8 -// CHECK:STDOUT: %.loc15: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc15: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %a.loc15: i32 = bind_name a, %.loc15 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/fail_generic.carbon b/toolchain/check/testdata/let/fail_generic.carbon index 0a7969a85464..a9011173571e 100644 --- a/toolchain/check/testdata/let/fail_generic.carbon +++ b/toolchain/check/testdata/let/fail_generic.carbon @@ -21,17 +21,20 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: --- fail_generic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] -// CHECK:STDOUT: %.1: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.2: i32 = int_literal 5 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %a.loc8_6.1: i32 = param a // CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc8_6.1 // CHECK:STDOUT: @F.%return: ref i32 = var @@ -42,7 +45,7 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T: type = bind_symbolic_name T 0, i32 [symbolic = constants.%T] // CHECK:STDOUT: %T.ref: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc14: i32 = int_literal 5 [template = constants.%.1] +// CHECK:STDOUT: %.loc14: i32 = int_literal 5 [template = constants.%.2] // CHECK:STDOUT: %x: T = bind_name x, // CHECK:STDOUT: %x.ref: T = name_ref x, %x // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/let/fail_missing_value.carbon b/toolchain/check/testdata/let/fail_missing_value.carbon index 7412fb94065c..969d537696ae 100644 --- a/toolchain/check/testdata/let/fail_missing_value.carbon +++ b/toolchain/check/testdata/let/fail_missing_value.carbon @@ -19,14 +19,20 @@ fn F() { // CHECK:STDOUT: --- fail_missing_value.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %n: i32 = bind_name n, -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/let/fail_use_in_init.carbon b/toolchain/check/testdata/let/fail_use_in_init.carbon index e4418e017f47..39312d04f48b 100644 --- a/toolchain/check/testdata/let/fail_use_in_init.carbon +++ b/toolchain/check/testdata/let/fail_use_in_init.carbon @@ -13,13 +13,19 @@ fn F() { // CHECK:STDOUT: --- fail_use_in_init.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // 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 ce0126c8e63d..e462c2d3e1be 100644 --- a/toolchain/check/testdata/let/generic.carbon +++ b/toolchain/check/testdata/let/generic.carbon @@ -13,24 +13,27 @@ fn F() { // CHECK:STDOUT: --- generic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic] -// CHECK:STDOUT: %.1: type = ptr_type T [symbolic] +// CHECK:STDOUT: %.2: type = ptr_type T [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T: type = bind_symbolic_name T 0, i32 [symbolic = constants.%T] // CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc9: type = ptr_type T [symbolic = constants.%.1] +// CHECK:STDOUT: %.loc9: type = ptr_type T [symbolic = constants.%.2] // CHECK:STDOUT: %p.var: ref T* = var p // CHECK:STDOUT: %p: ref T* = bind_name p, %p.var // CHECK:STDOUT: %T.ref.loc10: type = name_ref T, %T [symbolic = constants.%T] diff --git a/toolchain/check/testdata/let/global.carbon b/toolchain/check/testdata/let/global.carbon index 484d88ddfec9..8f9c0af13e79 100644 --- a/toolchain/check/testdata/let/global.carbon +++ b/toolchain/check/testdata/let/global.carbon @@ -12,17 +12,20 @@ fn F() -> i32 { return n; } // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [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.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/local.carbon b/toolchain/check/testdata/let/local.carbon index c3787578901e..9b85a61a3a34 100644 --- a/toolchain/check/testdata/let/local.carbon +++ b/toolchain/check/testdata/let/local.carbon @@ -11,13 +11,19 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: --- local.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %a.loc7_6.1: i32 = param a // CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc7_6.1 // CHECK:STDOUT: @F.%return: ref i32 = var diff --git a/toolchain/check/testdata/let/shadowed_decl.carbon b/toolchain/check/testdata/let/shadowed_decl.carbon index 50e5cfb9e262..8a755b372af8 100644 --- a/toolchain/check/testdata/let/shadowed_decl.carbon +++ b/toolchain/check/testdata/let/shadowed_decl.carbon @@ -13,16 +13,19 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: --- shadowed_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %a.loc7_6.1: i32 = param a // CHECK:STDOUT: @F.%a.loc7: i32 = bind_name a, %a.loc7_6.1 // CHECK:STDOUT: @F.%return: ref i32 = var @@ -31,7 +34,7 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a.loc7: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8 // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a.loc8 // CHECK:STDOUT: return %a.ref diff --git a/toolchain/check/testdata/namespace/add_to_import.carbon b/toolchain/check/testdata/namespace/add_to_import.carbon index ef60daa66d55..dcee2c13da98 100644 --- a/toolchain/check/testdata/namespace/add_to_import.carbon +++ b/toolchain/check/testdata/namespace/add_to_import.carbon @@ -32,7 +32,10 @@ var a: i32 = NS.A(); // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -43,10 +46,10 @@ var a: i32 = NS.A(); // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref: = import_ref ir0, inst+2, loaded // CHECK:STDOUT: %NS: = namespace %import_ref, [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] { // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %a.var: ref i32 = var a @@ -55,14 +58,14 @@ var a: i32 = NS.A(); // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc4: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: return %.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/namespace/alias.carbon b/toolchain/check/testdata/namespace/alias.carbon index 325eb1f6357f..262b0e274c55 100644 --- a/toolchain/check/testdata/namespace/alias.carbon +++ b/toolchain/check/testdata/namespace/alias.carbon @@ -19,7 +19,14 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: --- alias.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %struct.3: D = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -27,40 +34,40 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .NS = %NS // CHECK:STDOUT: .ns = %ns -// CHECK:STDOUT: .B = %B +// CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: .C = %C -// CHECK:STDOUT: .D = %D +// CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %NS: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %NS.ref.loc9: = name_ref NS, %NS [template = %NS] // CHECK:STDOUT: %ns: = bind_alias ns, %NS [template = %NS] -// CHECK:STDOUT: %A: = fn_decl @A [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B: = fn_decl @B [template] { +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %NS.ref.loc15: = name_ref NS, %NS [template = %NS] -// 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: %A.ref: A = name_ref A, %A.decl [template = constants.%struct.1] +// CHECK:STDOUT: %C: A = bind_alias C, %A.decl [template = constants.%struct.1] +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.3] { // CHECK:STDOUT: @D.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc11: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: return %.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ns.ref: = name_ref ns, file.%ns [template = file.%NS] -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() // CHECK:STDOUT: %.loc13_30.1: i32 = value_of_initializer %A.call // CHECK:STDOUT: %.loc13_30.2: i32 = converted %A.call, %.loc13_30.1 @@ -69,7 +76,7 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: // CHECK:STDOUT: fn @D() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref: = name_ref C, file.%C [template = file.%A] +// CHECK:STDOUT: %C.ref: A = name_ref C, file.%C [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init i32 = call %C.ref() // CHECK:STDOUT: %.loc17_27.1: i32 = value_of_initializer %A.call // CHECK:STDOUT: %.loc17_27.2: i32 = converted %A.call, %.loc17_27.1 diff --git a/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon b/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon index 0534f6edf433..4aa1b4d081b0 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon @@ -54,6 +54,14 @@ fn NS(); // CHECK:STDOUT: // CHECK:STDOUT: --- fail_conflict.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = fn_type @.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: = struct_value () [template] +// CHECK:STDOUT: %.3: type = fn_type @.2 [template] +// CHECK:STDOUT: %struct.2: = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .NS = %NS @@ -63,9 +71,9 @@ fn NS(); // CHECK:STDOUT: %NS: = namespace %import_ref, [template] {} // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc8: = namespace [template] {} -// CHECK:STDOUT: %.loc17: = fn_decl @.1 [template] {} +// CHECK:STDOUT: %.decl.loc17: = fn_decl @.1 [template = constants.%struct.1] {} // CHECK:STDOUT: %.loc21: = namespace [template] {} -// CHECK:STDOUT: %.loc29: = fn_decl @.2 [template] {} +// CHECK:STDOUT: %.decl.loc29: = fn_decl @.2 [template = constants.%struct.2] {} // 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 49a2b7307fcf..41b3ff95d522 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon @@ -42,6 +42,14 @@ fn NS.Foo(); // CHECK:STDOUT: // CHECK:STDOUT: --- fail_conflict.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = fn_type @.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: = struct_value () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct.2: Foo = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .NS = %NS @@ -49,11 +57,11 @@ fn NS.Foo(); // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref: = import_ref ir1, inst+2, loaded // CHECK:STDOUT: %NS: = namespace %import_ref, [template] { -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc15: = fn_decl @.1 [template] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] {} +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] {} // 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 2083d93d3f31..1aa7a41b10a8 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon @@ -38,28 +38,42 @@ fn NS.Foo(); // CHECK:STDOUT: --- fn.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %NS: type = fn_type @NS [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: NS = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .NS = %NS +// CHECK:STDOUT: .NS = %NS.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %NS: = fn_decl @NS [template] {} +// CHECK:STDOUT: %NS.decl: NS = fn_decl @NS [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @NS(); // CHECK:STDOUT: // CHECK:STDOUT: --- fail_conflict.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %NS: type = fn_type @NS [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: NS = struct_value () [template] +// CHECK:STDOUT: %.2: type = fn_type @.1 [template] +// CHECK:STDOUT: %struct.2: = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .NS = %import_ref // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+2, loaded [template = imports.%NS] +// CHECK:STDOUT: %import_ref: NS = import_ref ir1, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc16: = namespace [template] {} -// CHECK:STDOUT: %.loc24: = fn_decl @.1 [template] {} +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] {} // 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 054fadaecd6c..758d36802609 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 @@ -40,6 +40,12 @@ fn NS.Bar() {} // CHECK:STDOUT: --- namespace.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core @@ -47,9 +53,9 @@ fn NS.Bar() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %NS: = namespace [template] { -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] {} +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { @@ -59,13 +65,19 @@ fn NS.Bar() {} // CHECK:STDOUT: // CHECK:STDOUT: --- fn.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %NS: type = fn_type @NS [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: NS = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .NS = %NS +// CHECK:STDOUT: .NS = %NS.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %NS: = fn_decl @NS [template] {} +// CHECK:STDOUT: %NS.decl: NS = fn_decl @NS [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @NS() { @@ -75,6 +87,12 @@ fn NS.Bar() {} // CHECK:STDOUT: // CHECK:STDOUT: --- fail_conflict.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Bar: type = fn_type @Bar [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Bar = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .NS = %NS @@ -83,12 +101,12 @@ fn NS.Bar() {} // CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.1, [template] { // CHECK:STDOUT: .Foo = %import_ref.2 -// CHECK:STDOUT: .Bar = %Bar +// CHECK:STDOUT: .Bar = %Bar.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+3, unloaded // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+2, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Bar: = fn_decl @Bar [template] {} +// CHECK:STDOUT: %Bar.decl: Bar = fn_decl @Bar [template = constants.%struct] {} // 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 f24a92cef144..1af1c3433332 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 @@ -40,13 +40,19 @@ fn NS.Bar() {} // CHECK:STDOUT: --- fn.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %NS: type = fn_type @NS [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: NS = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .NS = %NS +// CHECK:STDOUT: .NS = %NS.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %NS: = fn_decl @NS [template] {} +// CHECK:STDOUT: %NS.decl: NS = fn_decl @NS [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @NS() { @@ -56,6 +62,12 @@ fn NS.Bar() {} // CHECK:STDOUT: // CHECK:STDOUT: --- namespace.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core @@ -63,9 +75,9 @@ fn NS.Bar() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %NS: = namespace [template] { -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] {} +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { @@ -75,6 +87,12 @@ fn NS.Bar() {} // CHECK:STDOUT: // CHECK:STDOUT: --- fail_conflict.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Bar: type = fn_type @Bar [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Bar = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .NS = %NS @@ -84,11 +102,11 @@ fn NS.Bar() {} // CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+2, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.2, [template] { // CHECK:STDOUT: .Foo = %import_ref.3 -// CHECK:STDOUT: .Bar = %Bar +// CHECK:STDOUT: .Bar = %Bar.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Bar: = fn_decl @Bar [template] {} +// CHECK:STDOUT: %Bar.decl: Bar = fn_decl @Bar [template = constants.%struct] {} // 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 aa788580154b..a57ec8265e62 100644 --- a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon +++ b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon @@ -20,7 +20,10 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: --- fail_decl_in_alias.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.1: type = fn_type @.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: = struct_value () [template] +// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -33,14 +36,14 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: %NS: = namespace [template] {} // CHECK:STDOUT: %NS.ref: = name_ref NS, %NS [template = %NS] // CHECK:STDOUT: %ns: = bind_alias ns, %NS [template = %NS] -// CHECK:STDOUT: %.loc18: = fn_decl @.1 [template] { +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct] { // CHECK:STDOUT: @.1.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @.1() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc18: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: return %.loc18 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_duplicate.carbon b/toolchain/check/testdata/namespace/fail_duplicate.carbon index 07d9e36de3a7..28c0f14245ee 100644 --- a/toolchain/check/testdata/namespace/fail_duplicate.carbon +++ b/toolchain/check/testdata/namespace/fail_duplicate.carbon @@ -20,6 +20,12 @@ fn Foo.Baz() { // CHECK:STDOUT: --- fail_duplicate.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Baz: type = fn_type @Baz [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Baz = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core @@ -27,10 +33,10 @@ fn Foo.Baz() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Foo: = namespace [template] { -// CHECK:STDOUT: .Baz = %Baz.loc9 +// CHECK:STDOUT: .Baz = %Baz.decl.loc9 // CHECK:STDOUT: } -// CHECK:STDOUT: %Baz.loc9: = fn_decl @Baz [template] {} -// CHECK:STDOUT: %Baz.loc18: = fn_decl @Baz [template] {} +// CHECK:STDOUT: %Baz.decl.loc9: Baz = fn_decl @Baz [template = constants.%struct] {} +// CHECK:STDOUT: %Baz.decl.loc18: Baz = fn_decl @Baz [template = constants.%struct] {} // 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 de472de48088..35920c8a2218 100644 --- a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon +++ b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon @@ -12,12 +12,18 @@ fn Foo.Baz() { // CHECK:STDOUT: --- fail_unresolved_scope.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = fn_type @.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10: = fn_decl @.1 [template] {} +// CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct] {} // 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 26be6f9a53a1..afe58fd42e2a 100644 --- a/toolchain/check/testdata/namespace/function.carbon +++ b/toolchain/check/testdata/namespace/function.carbon @@ -20,23 +20,29 @@ fn Bar() { // CHECK:STDOUT: --- function.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Baz.1: type = fn_type @Baz.1 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Baz = struct_value () [template] +// CHECK:STDOUT: %Baz.2: type = fn_type @Baz.2 [template] +// CHECK:STDOUT: %struct.2: Baz = struct_value () [template] +// CHECK:STDOUT: %Bar: type = fn_type @Bar [template] +// CHECK:STDOUT: %struct.3: Bar = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Foo = %Foo -// CHECK:STDOUT: .Baz = %Baz.loc10 -// CHECK:STDOUT: .Bar = %Bar +// CHECK:STDOUT: .Baz = %Baz.decl.loc10 +// CHECK:STDOUT: .Bar = %Bar.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Foo: = namespace [template] { -// CHECK:STDOUT: .Baz = %Baz.loc13 +// CHECK:STDOUT: .Baz = %Baz.decl.loc13 // CHECK:STDOUT: } -// 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.decl.loc10: Baz = fn_decl @Baz.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %Baz.decl.loc13: Baz = fn_decl @Baz.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %Bar.decl: Bar = fn_decl @Bar [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Baz.1() { @@ -52,7 +58,7 @@ fn Bar() { // CHECK:STDOUT: fn @Bar() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %Baz.ref: = name_ref Baz, file.%Baz.loc13 [template = file.%Baz.loc13] +// CHECK:STDOUT: %Baz.ref: Baz = name_ref Baz, file.%Baz.decl.loc13 [template = constants.%struct.2] // CHECK:STDOUT: %Baz.call: init () = call %Baz.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/imported.carbon b/toolchain/check/testdata/namespace/imported.carbon index e252f51d2b68..3ad753420664 100644 --- a/toolchain/check/testdata/namespace/imported.carbon +++ b/toolchain/check/testdata/namespace/imported.carbon @@ -26,6 +26,14 @@ var package_b: () = package.NS.ChildNS.B(); // CHECK:STDOUT: --- implicit.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core @@ -34,13 +42,13 @@ var package_b: () = package.NS.ChildNS.B(); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %NS: = namespace [template] { // CHECK:STDOUT: .ChildNS = %ChildNS -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %ChildNS: = namespace [template] { -// CHECK:STDOUT: .B = %B +// CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] {} -// CHECK:STDOUT: %B: = fn_decl @B [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] {} +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); @@ -51,6 +59,10 @@ var package_b: () = package.NS.ChildNS.B(); // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -71,8 +83,8 @@ var package_b: () = package.NS.ChildNS.B(); // CHECK:STDOUT: %ChildNS: = namespace %import_ref.2, [template] { // CHECK:STDOUT: .B = %import_ref.4 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.3: = import_ref ir0, inst+4, loc_13 [template = imports.%A] -// CHECK:STDOUT: %import_ref.4: = import_ref ir0, inst+5, loc_27 [template = imports.%B] +// CHECK:STDOUT: %import_ref.3: A = import_ref ir0, inst+4, loc_13 [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.4: B = import_ref ir0, inst+8, loc_27 [template = constants.%struct.2] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc4_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc4_9.2: type = converted %.loc4_9.1, constants.%.1 [template = constants.%.1] @@ -99,23 +111,23 @@ var package_b: () = package.NS.ChildNS.B(); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %NS.ref.loc4: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %A.ref.loc4: = name_ref A, file.%import_ref.3 [template = imports.%A] +// CHECK:STDOUT: %A.ref.loc4: A = name_ref A, file.%import_ref.3 [template = constants.%struct.1] // CHECK:STDOUT: %A.call.loc4: init () = call %A.ref.loc4() // CHECK:STDOUT: assign file.%a.var, %A.call.loc4 // CHECK:STDOUT: %NS.ref.loc5: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %ChildNS.ref.loc5: = name_ref ChildNS, file.%ChildNS [template = file.%ChildNS] -// CHECK:STDOUT: %B.ref.loc5: = name_ref B, file.%import_ref.4 [template = imports.%B] +// CHECK:STDOUT: %B.ref.loc5: B = name_ref B, file.%import_ref.4 [template = constants.%struct.2] // CHECK:STDOUT: %B.call.loc5: init () = call %B.ref.loc5() // CHECK:STDOUT: assign file.%b.var, %B.call.loc5 // CHECK:STDOUT: %package.ref.loc7: = name_ref package, package [template = package] // CHECK:STDOUT: %NS.ref.loc7: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %A.ref.loc7: = name_ref A, file.%import_ref.3 [template = imports.%A] +// CHECK:STDOUT: %A.ref.loc7: A = name_ref A, file.%import_ref.3 [template = constants.%struct.1] // CHECK:STDOUT: %A.call.loc7: init () = call %A.ref.loc7() // CHECK:STDOUT: assign file.%package_a.var, %A.call.loc7 // CHECK:STDOUT: %package.ref.loc8: = name_ref package, package [template = package] // CHECK:STDOUT: %NS.ref.loc8: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %ChildNS.ref.loc8: = name_ref ChildNS, file.%ChildNS [template = file.%ChildNS] -// CHECK:STDOUT: %B.ref.loc8: = name_ref B, file.%import_ref.4 [template = imports.%B] +// CHECK:STDOUT: %B.ref.loc8: B = name_ref B, file.%import_ref.4 [template = constants.%struct.2] // CHECK:STDOUT: %B.call.loc8: init () = call %B.ref.loc8() // CHECK:STDOUT: assign file.%package_b.var, %B.call.loc8 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/namespace/imported_indirect.carbon b/toolchain/check/testdata/namespace/imported_indirect.carbon index 14541c9822ec..432e03fbd93c 100644 --- a/toolchain/check/testdata/namespace/imported_indirect.carbon +++ b/toolchain/check/testdata/namespace/imported_indirect.carbon @@ -85,6 +85,12 @@ var e: () = A.B.C.D(); // CHECK:STDOUT: // CHECK:STDOUT: --- d.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: D = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .A = %A @@ -100,10 +106,10 @@ var e: () = A.B.C.D(); // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+6, loaded // CHECK:STDOUT: %C: = namespace %import_ref.3, [template] { -// CHECK:STDOUT: .D = %D +// CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %D: = fn_decl @D [template] {} +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @D() { @@ -115,6 +121,8 @@ var e: () = A.B.C.D(); // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %struct: D = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -135,7 +143,7 @@ var e: () = A.B.C.D(); // CHECK:STDOUT: %C: = namespace %import_ref.3, [template] { // CHECK:STDOUT: .D = %import_ref.4 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.4: = import_ref ir1, inst+8, loc_23 [template = imports.%D] +// CHECK:STDOUT: %import_ref.4: D = import_ref ir1, inst+8, loc_23 [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc5_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc5_9.2: type = converted %.loc5_9.1, constants.%.1 [template = constants.%.1] @@ -150,7 +158,7 @@ var e: () = A.B.C.D(); // CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] // CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] // CHECK:STDOUT: %C.ref: = name_ref C, file.%C [template = file.%C] -// CHECK:STDOUT: %D.ref: = name_ref D, file.%import_ref.4 [template = imports.%D] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%import_ref.4 [template = constants.%struct] // CHECK:STDOUT: %D.call: init () = call %D.ref() // CHECK:STDOUT: assign file.%e.var, %D.call // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/namespace/merging.carbon b/toolchain/check/testdata/namespace/merging.carbon index 67d23e559f60..4ba0b2051a7e 100644 --- a/toolchain/check/testdata/namespace/merging.carbon +++ b/toolchain/check/testdata/namespace/merging.carbon @@ -44,6 +44,12 @@ fn Run() { // CHECK:STDOUT: --- a.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core @@ -51,9 +57,9 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %NS: = namespace [template] { -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -63,6 +69,14 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: --- b.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %B1: type = fn_type @B1 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: B1 = struct_value () [template] +// CHECK:STDOUT: %B2: type = fn_type @B2 [template] +// CHECK:STDOUT: %struct.2: B2 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core @@ -70,12 +84,12 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %NS: = namespace [template] { -// CHECK:STDOUT: .B1 = %B1 -// CHECK:STDOUT: .B2 = %B2 +// CHECK:STDOUT: .B1 = %B1.decl +// CHECK:STDOUT: .B2 = %B2.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %B1: = fn_decl @B1 [template] {} +// CHECK:STDOUT: %B1.decl: B1 = fn_decl @B1 [template = constants.%struct.1] {} // CHECK:STDOUT: %.loc8: = namespace [template] {} -// CHECK:STDOUT: %B2: = fn_decl @B2 [template] {} +// CHECK:STDOUT: %B2.decl: B2 = fn_decl @B2 [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B1() { @@ -91,29 +105,39 @@ fn Run() { // CHECK:STDOUT: --- c.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %C: type = fn_type @C [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: C = struct_value () [template] +// CHECK:STDOUT: %Run: type = fn_type @Run [template] +// CHECK:STDOUT: %struct.2: Run = struct_value () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct.3: A = struct_value () [template] +// CHECK:STDOUT: %B1: type = fn_type @B1 [template] +// CHECK:STDOUT: %struct.4: B1 = struct_value () [template] +// CHECK:STDOUT: %B2: type = fn_type @B2 [template] +// CHECK:STDOUT: %struct.5: B2 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .NS = %NS // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loaded // CHECK:STDOUT: %NS: = namespace %import_ref.1, [template] { // CHECK:STDOUT: .A = %import_ref.2 // CHECK:STDOUT: .B1 = %import_ref.3 // CHECK:STDOUT: .B2 = %import_ref.4 -// CHECK:STDOUT: .C = %C +// CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.2: = import_ref ir1, inst+3, loc_33 [template = imports.%A] -// CHECK:STDOUT: %import_ref.3: = import_ref ir2, inst+3, loc_39 [template = imports.%B1] -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+6, loc_45 [template = imports.%B2] +// CHECK:STDOUT: %import_ref.2: A = import_ref ir1, inst+3, loc_33 [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.3: B1 = import_ref ir2, inst+3, loc_39 [template = constants.%struct.4] +// CHECK:STDOUT: %import_ref.4: B2 = import_ref ir2, inst+9, loc_45 [template = constants.%struct.5] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc7: = namespace [template] {} -// CHECK:STDOUT: %C: = fn_decl @C [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.1] {} +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @C() { @@ -124,16 +148,16 @@ fn Run() { // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %NS.ref.loc12: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %A.ref: = name_ref A, file.%import_ref.2 [template = imports.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%import_ref.2 [template = constants.%struct.3] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: %NS.ref.loc13: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %B1.ref: = name_ref B1, file.%import_ref.3 [template = imports.%B1] +// CHECK:STDOUT: %B1.ref: B1 = name_ref B1, file.%import_ref.3 [template = constants.%struct.4] // CHECK:STDOUT: %B1.call: init () = call %B1.ref() // CHECK:STDOUT: %NS.ref.loc14: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %B2.ref: = name_ref B2, file.%import_ref.4 [template = imports.%B2] +// CHECK:STDOUT: %B2.ref: B2 = name_ref B2, file.%import_ref.4 [template = constants.%struct.5] // CHECK:STDOUT: %B2.call: init () = call %B2.ref() // CHECK:STDOUT: %NS.ref.loc15: = name_ref NS, file.%NS [template = file.%NS] -// CHECK:STDOUT: %C.ref: = name_ref C, file.%C [template = file.%C] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.1] // CHECK:STDOUT: %C.call: init () = call %C.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/nested.carbon b/toolchain/check/testdata/namespace/nested.carbon index 27c41dc66d25..29b2afcb84b6 100644 --- a/toolchain/check/testdata/namespace/nested.carbon +++ b/toolchain/check/testdata/namespace/nested.carbon @@ -17,7 +17,11 @@ fn Foo.Bar.Baz() { // CHECK:STDOUT: --- nested.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Wiz: type = fn_type @Wiz [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Wiz = struct_value () [template] +// CHECK:STDOUT: %Baz: type = fn_type @Baz [template] +// CHECK:STDOUT: %struct.2: Baz = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -30,11 +34,11 @@ fn Foo.Bar.Baz() { // CHECK:STDOUT: .Bar = %Bar // CHECK:STDOUT: } // CHECK:STDOUT: %Bar: = namespace [template] { -// CHECK:STDOUT: .Wiz = %Wiz -// CHECK:STDOUT: .Baz = %Baz +// CHECK:STDOUT: .Wiz = %Wiz.decl +// CHECK:STDOUT: .Baz = %Baz.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Wiz: = fn_decl @Wiz [template] {} -// CHECK:STDOUT: %Baz: = fn_decl @Baz [template] {} +// CHECK:STDOUT: %Wiz.decl: Wiz = fn_decl @Wiz [template = constants.%struct.1] {} +// CHECK:STDOUT: %Baz.decl: Baz = fn_decl @Baz [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Wiz() { @@ -46,7 +50,7 @@ fn Foo.Bar.Baz() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] // CHECK:STDOUT: %Bar.ref: = name_ref Bar, file.%Bar [template = file.%Bar] -// CHECK:STDOUT: %Wiz.ref: = name_ref Wiz, file.%Wiz [template = file.%Wiz] +// CHECK:STDOUT: %Wiz.ref: Wiz = name_ref Wiz, file.%Wiz.decl [template = constants.%struct.1] // CHECK:STDOUT: %Wiz.call: init () = call %Wiz.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/shadow.carbon b/toolchain/check/testdata/namespace/shadow.carbon index 80eebdd69dfc..dfc932f510d1 100644 --- a/toolchain/check/testdata/namespace/shadow.carbon +++ b/toolchain/check/testdata/namespace/shadow.carbon @@ -26,7 +26,13 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: --- shadow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %A.1: type = fn_type @A.1 [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %A.2: type = fn_type @A.2 [template] +// CHECK:STDOUT: %struct.2: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.3: B = struct_value () [template] // CHECK:STDOUT: %.2: bool = bool_literal true [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: } @@ -34,20 +40,20 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A.loc7 +// CHECK:STDOUT: .A = %A.decl.loc7 // CHECK:STDOUT: .N = %N // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.loc7: = fn_decl @A.1 [template] {} +// CHECK:STDOUT: %A.decl.loc7: A = fn_decl @A.1 [template = constants.%struct.1] {} // CHECK:STDOUT: %N: = namespace [template] { -// CHECK:STDOUT: .A = %A.loc10 +// CHECK:STDOUT: .A = %A.decl.loc10 // CHECK:STDOUT: .M = %M // CHECK:STDOUT: } -// CHECK:STDOUT: %A.loc10: = fn_decl @A.2 [template] {} +// CHECK:STDOUT: %A.decl.loc10: A = fn_decl @A.2 [template = constants.%struct.2] {} // CHECK:STDOUT: %M: = namespace [template] { -// CHECK:STDOUT: .B = %B +// CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %B: = fn_decl @B [template] { +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -58,7 +64,7 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc16: = name_ref A, file.%A.loc10 [template = file.%A.loc10] +// CHECK:STDOUT: %A.ref.loc16: A = name_ref A, file.%A.decl.loc10 [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init () = call %A.ref.loc16() // CHECK:STDOUT: %.loc17: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc17 br !if.then else br !if.else diff --git a/toolchain/check/testdata/namespace/unqualified_lookup.carbon b/toolchain/check/testdata/namespace/unqualified_lookup.carbon index c2efe96ae370..943d7f8e33bc 100644 --- a/toolchain/check/testdata/namespace/unqualified_lookup.carbon +++ b/toolchain/check/testdata/namespace/unqualified_lookup.carbon @@ -29,32 +29,44 @@ fn OuterN.InnerN.CallABC() { // CHECK:STDOUT: --- unqualified_lookup.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %CallA: type = fn_type @CallA [template] +// CHECK:STDOUT: %struct.4: CallA = struct_value () [template] +// CHECK:STDOUT: %CallAB: type = fn_type @CallAB [template] +// CHECK:STDOUT: %struct.5: CallAB = struct_value () [template] +// CHECK:STDOUT: %CallABC: type = fn_type @CallABC [template] +// CHECK:STDOUT: %struct.6: CallABC = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .OuterN = %OuterN -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .CallA = %CallA +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .CallA = %CallA.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %OuterN: = namespace [template] { // CHECK:STDOUT: .InnerN = %InnerN -// CHECK:STDOUT: .B = %B -// CHECK:STDOUT: .CallAB = %CallAB +// CHECK:STDOUT: .B = %B.decl +// CHECK:STDOUT: .CallAB = %CallAB.decl // CHECK:STDOUT: } // CHECK:STDOUT: %InnerN: = namespace [template] { -// CHECK:STDOUT: .C = %C -// CHECK:STDOUT: .CallABC = %CallABC +// CHECK:STDOUT: .C = %C.decl +// CHECK:STDOUT: .CallABC = %CallABC.decl // CHECK:STDOUT: } -// 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.decl: A = fn_decl @A [template = constants.%struct.1] {} +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] {} +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] {} +// CHECK:STDOUT: %CallA.decl: CallA = fn_decl @CallA [template = constants.%struct.4] {} +// CHECK:STDOUT: %CallAB.decl: CallAB = fn_decl @CallAB [template = constants.%struct.5] {} +// CHECK:STDOUT: %CallABC.decl: CallABC = fn_decl @CallABC [template = constants.%struct.6] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); @@ -65,27 +77,27 @@ fn OuterN.InnerN.CallABC() { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallA() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallAB() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] // CHECK:STDOUT: %B.call: init () = call %B.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallABC() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init () = call %A.ref() -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] // CHECK:STDOUT: %B.call: init () = call %B.ref() -// CHECK:STDOUT: %C.ref: = name_ref C, file.%C [template = file.%C] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.3] // CHECK:STDOUT: %C.call: init () = call %C.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/and.carbon b/toolchain/check/testdata/operators/builtin/and.carbon index 66035dd934c4..c326411591bb 100644 --- a/toolchain/check/testdata/operators/builtin/and.carbon +++ b/toolchain/check/testdata/operators/builtin/and.carbon @@ -25,33 +25,43 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: --- and.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: bool = bool_literal false [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal true [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %And: type = fn_type @And [template] +// CHECK:STDOUT: %struct.3: And = struct_value () [template] +// CHECK:STDOUT: %.3: bool = bool_literal false [template] +// CHECK:STDOUT: %Constant: type = fn_type @Constant [template] +// CHECK:STDOUT: %struct.4: Constant = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] +// CHECK:STDOUT: %PartialConstant: type = fn_type @PartialConstant [template] +// CHECK:STDOUT: %struct.5: PartialConstant = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .And = %And -// CHECK:STDOUT: .Constant = %Constant -// CHECK:STDOUT: .PartialConstant = %PartialConstant +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .And = %And.decl +// CHECK:STDOUT: .Constant = %Constant.decl +// CHECK:STDOUT: .PartialConstant = %PartialConstant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: @G.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %And: = fn_decl @And [template] { +// CHECK:STDOUT: %And.decl: And = fn_decl @And [template = constants.%struct.3] { // CHECK:STDOUT: @And.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Constant: = fn_decl @Constant [template] {} -// CHECK:STDOUT: %PartialConstant: = fn_decl @PartialConstant [template] { +// CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.4] {} +// CHECK:STDOUT: %PartialConstant.decl: PartialConstant = fn_decl @PartialConstant [template = constants.%struct.5] { // CHECK:STDOUT: %x.loc21_20.1: bool = param x // CHECK:STDOUT: @PartialConstant.%x: bool = bind_name x, %x.loc21_20.1 // CHECK:STDOUT: } @@ -59,27 +69,27 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc7: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @And() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init bool = call %F.ref() // CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %F.call // CHECK:STDOUT: %.loc11_14.2: bool = converted %F.call, %.loc11_14.1 -// CHECK:STDOUT: %.loc11_14.3: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc11_14.3: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: if %.loc11_14.2 br !and.rhs else br !and.result(%.loc11_14.3) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %G.call: init bool = call %G.ref() // CHECK:STDOUT: %.loc11_14.4: bool = value_of_initializer %G.call // CHECK:STDOUT: %.loc11_14.5: bool = converted %G.call, %.loc11_14.4 @@ -92,16 +102,16 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Constant() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13: bool = bool_literal true [template = constants.%.1] -// CHECK:STDOUT: %.loc15_18.1: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc15_13: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc15_18.1: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: if %.loc15_13 br !and.rhs.loc15 else br !and.result.loc15(%.loc15_18.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs.loc15: -// CHECK:STDOUT: %.loc15_22: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc15_22: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: br !and.result.loc15(%.loc15_22) // CHECK:STDOUT: // CHECK:STDOUT: !and.result.loc15: -// CHECK:STDOUT: %.loc15_18.2: bool = block_arg !and.result.loc15 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_18.2: bool = block_arg !and.result.loc15 [template = constants.%.2] // CHECK:STDOUT: if %.loc15_18.2 br !if.expr.then.loc15 else br !if.expr.else.loc15 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc15: @@ -109,25 +119,25 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc15: // CHECK:STDOUT: %.loc15_43: () = tuple_literal () -// CHECK:STDOUT: %.loc15_37: type = converted %.loc15_43, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_37: type = converted %.loc15_43, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_37) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc15: // CHECK:STDOUT: %.loc15_10: type = block_arg !if.expr.result.loc15 [template = bool] // CHECK:STDOUT: %a.var: ref bool = var a // CHECK:STDOUT: %a: ref bool = bind_name a, %a.var -// CHECK:STDOUT: %.loc15_47: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc15_47: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: assign %a.var, %.loc15_47 -// CHECK:STDOUT: %.loc16_13: bool = bool_literal true [template = constants.%.1] -// CHECK:STDOUT: %.loc16_18.1: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc16_13: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc16_18.1: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: if %.loc16_13 br !and.rhs.loc16 else br !and.result.loc16(%.loc16_18.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs.loc16: -// CHECK:STDOUT: %.loc16_22: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc16_22: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: br !and.result.loc16(%.loc16_22) // CHECK:STDOUT: // CHECK:STDOUT: !and.result.loc16: -// CHECK:STDOUT: %.loc16_18.2: bool = block_arg !and.result.loc16 [template = constants.%.2] +// CHECK:STDOUT: %.loc16_18.2: bool = block_arg !and.result.loc16 [template = constants.%.3] // CHECK:STDOUT: if %.loc16_18.2 br !if.expr.then.loc16 else br !if.expr.else.loc16 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc16: @@ -135,27 +145,27 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc16: // CHECK:STDOUT: %.loc16_44: () = tuple_literal () -// CHECK:STDOUT: %.loc16_38: type = converted %.loc16_44, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc16_38: type = converted %.loc16_44, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_38) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc16: -// CHECK:STDOUT: %.loc16_10: type = block_arg !if.expr.result.loc16 [template = constants.%.3] +// CHECK:STDOUT: %.loc16_10: type = block_arg !if.expr.result.loc16 [template = constants.%.1] // CHECK:STDOUT: %b.var: ref () = var b // CHECK:STDOUT: %b: ref () = bind_name b, %b.var // CHECK:STDOUT: %.loc16_49.1: () = tuple_literal () // CHECK:STDOUT: %.loc16_49.2: init () = tuple_init () to %b.var [template = constants.%tuple] // CHECK:STDOUT: %.loc16_50: init () = converted %.loc16_49.1, %.loc16_49.2 [template = constants.%tuple] // CHECK:STDOUT: assign %b.var, %.loc16_50 -// CHECK:STDOUT: %.loc17_13: bool = bool_literal false [template = constants.%.2] -// CHECK:STDOUT: %.loc17_19.1: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc17_13: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc17_19.1: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: if %.loc17_13 br !and.rhs.loc17 else br !and.result.loc17(%.loc17_19.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs.loc17: -// CHECK:STDOUT: %.loc17_23: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc17_23: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: br !and.result.loc17(%.loc17_23) // CHECK:STDOUT: // CHECK:STDOUT: !and.result.loc17: -// CHECK:STDOUT: %.loc17_19.2: bool = block_arg !and.result.loc17 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_19.2: bool = block_arg !and.result.loc17 [template = constants.%.3] // CHECK:STDOUT: if %.loc17_19.2 br !if.expr.then.loc17 else br !if.expr.else.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc17: @@ -163,27 +173,27 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc17: // CHECK:STDOUT: %.loc17_44: () = tuple_literal () -// CHECK:STDOUT: %.loc17_38: type = converted %.loc17_44, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc17_38: type = converted %.loc17_44, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc17(%.loc17_38) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc17: -// CHECK:STDOUT: %.loc17_10: type = block_arg !if.expr.result.loc17 [template = constants.%.3] +// CHECK:STDOUT: %.loc17_10: type = block_arg !if.expr.result.loc17 [template = constants.%.1] // CHECK:STDOUT: %c.var: ref () = var c // CHECK:STDOUT: %c: ref () = bind_name c, %c.var // CHECK:STDOUT: %.loc17_49.1: () = tuple_literal () // CHECK:STDOUT: %.loc17_49.2: init () = tuple_init () to %c.var [template = constants.%tuple] // CHECK:STDOUT: %.loc17_50: init () = converted %.loc17_49.1, %.loc17_49.2 [template = constants.%tuple] // CHECK:STDOUT: assign %c.var, %.loc17_50 -// CHECK:STDOUT: %.loc18_13: bool = bool_literal false [template = constants.%.2] -// CHECK:STDOUT: %.loc18_19.1: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc18_13: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc18_19.1: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: if %.loc18_13 br !and.rhs.loc18 else br !and.result.loc18(%.loc18_19.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs.loc18: -// CHECK:STDOUT: %.loc18_23: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc18_23: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: br !and.result.loc18(%.loc18_23) // CHECK:STDOUT: // CHECK:STDOUT: !and.result.loc18: -// CHECK:STDOUT: %.loc18_19.2: bool = block_arg !and.result.loc18 [template = constants.%.2] +// CHECK:STDOUT: %.loc18_19.2: bool = block_arg !and.result.loc18 [template = constants.%.3] // CHECK:STDOUT: if %.loc18_19.2 br !if.expr.then.loc18 else br !if.expr.else.loc18 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc18: @@ -191,11 +201,11 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc18: // CHECK:STDOUT: %.loc18_45: () = tuple_literal () -// CHECK:STDOUT: %.loc18_39: type = converted %.loc18_45, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc18_39: type = converted %.loc18_45, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc18(%.loc18_39) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc18: -// CHECK:STDOUT: %.loc18_10: type = block_arg !if.expr.result.loc18 [template = constants.%.3] +// CHECK:STDOUT: %.loc18_10: type = block_arg !if.expr.result.loc18 [template = constants.%.1] // CHECK:STDOUT: %d.var: ref () = var d // CHECK:STDOUT: %d: ref () = bind_name d, %d.var // CHECK:STDOUT: %.loc18_50.1: () = tuple_literal () @@ -207,8 +217,8 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @PartialConstant(%x: bool) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_13: bool = bool_literal false [template = constants.%.2] -// CHECK:STDOUT: %.loc22_19.1: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc22_13: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc22_19.1: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: if %.loc22_13 br !and.rhs else br !and.result(%.loc22_19.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: @@ -216,7 +226,7 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: br !and.result(%x.ref) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: -// CHECK:STDOUT: %.loc22_19.2: bool = block_arg !and.result [template = constants.%.2] +// CHECK:STDOUT: %.loc22_19.2: bool = block_arg !and.result [template = constants.%.3] // CHECK:STDOUT: if %.loc22_19.2 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: @@ -224,11 +234,11 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: // CHECK:STDOUT: %.loc22_41: () = tuple_literal () -// CHECK:STDOUT: %.loc22_35: type = converted %.loc22_41, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc22_35: type = converted %.loc22_41, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result(%.loc22_35) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc22_10: type = block_arg !if.expr.result [template = constants.%.3] +// CHECK:STDOUT: %.loc22_10: type = block_arg !if.expr.result [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var // CHECK:STDOUT: %.loc22_46.1: () = tuple_literal () diff --git a/toolchain/check/testdata/operators/builtin/assignment.carbon b/toolchain/check/testdata/operators/builtin/assignment.carbon index c3e25fbc82ba..bf17f4dac25f 100644 --- a/toolchain/check/testdata/operators/builtin/assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/assignment.carbon @@ -25,90 +25,93 @@ fn Main() { // CHECK:STDOUT: --- assignment.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 9 [template] -// CHECK:STDOUT: %.3: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.4: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.5: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.6: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 2 [template] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.6, %.7) [template] -// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.9: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.10: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.11: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.12: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.6, %.7) [template] -// CHECK:STDOUT: %.13: type = ptr_type i32 [template] -// CHECK:STDOUT: %.14: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.15: bool = bool_literal true [template] -// CHECK:STDOUT: %.16: i32 = int_literal 10 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 9 [template] +// CHECK:STDOUT: %.4: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.5: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.6: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.7: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.8: i32 = int_literal 2 [template] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.7, %.8) [template] +// CHECK:STDOUT: %.9: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.10: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.11: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.12: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.13: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %struct.2: {.a: i32, .b: i32} = struct_value (%.7, %.8) [template] +// CHECK:STDOUT: %.14: type = ptr_type i32 [template] +// CHECK:STDOUT: %.15: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.16: bool = bool_literal true [template] +// CHECK:STDOUT: %.17: i32 = int_literal 10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.1] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc8: i32 = int_literal 12 [template = constants.%.2] // CHECK:STDOUT: assign %a.var, %.loc8 // CHECK:STDOUT: %a.ref.loc9: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc9: i32 = int_literal 9 [template = constants.%.2] +// CHECK:STDOUT: %.loc9: i32 = int_literal 9 [template = constants.%.3] // CHECK:STDOUT: assign %a.ref.loc9, %.loc9 // CHECK:STDOUT: %.loc11_19.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc11_19.2: type = converted %.loc11_19.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_19.2: type = converted %.loc11_19.1, constants.%.5 [template = constants.%.5] // CHECK:STDOUT: %b.var: ref (i32, i32) = var b // CHECK:STDOUT: %b: ref (i32, i32) = bind_name b, %b.var -// CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc11_27: i32 = int_literal 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_27: i32 = int_literal 2 [template = constants.%.8] // CHECK:STDOUT: %.loc11_28.1: (i32, i32) = tuple_literal (%.loc11_24, %.loc11_27) // CHECK:STDOUT: %.loc11_28.2: ref i32 = tuple_access %b.var, element0 -// CHECK:STDOUT: %.loc11_28.3: init i32 = initialize_from %.loc11_24 to %.loc11_28.2 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_28.3: init i32 = initialize_from %.loc11_24 to %.loc11_28.2 [template = constants.%.7] // CHECK:STDOUT: %.loc11_28.4: ref i32 = tuple_access %b.var, element1 -// CHECK:STDOUT: %.loc11_28.5: init i32 = initialize_from %.loc11_27 to %.loc11_28.4 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_28.5: init i32 = initialize_from %.loc11_27 to %.loc11_28.4 [template = constants.%.8] // CHECK:STDOUT: %.loc11_28.6: init (i32, i32) = tuple_init (%.loc11_28.3, %.loc11_28.5) to %b.var [template = constants.%tuple] // CHECK:STDOUT: %.loc11_29: init (i32, i32) = converted %.loc11_28.1, %.loc11_28.6 [template = constants.%tuple] // CHECK:STDOUT: assign %b.var, %.loc11_29 // CHECK:STDOUT: %b.ref.loc12: ref (i32, i32) = name_ref b, %b -// CHECK:STDOUT: %.loc12_5: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc12_5: i32 = int_literal 0 [template = constants.%.9] // CHECK:STDOUT: %.loc12_6: ref i32 = tuple_index %b.ref.loc12, %.loc12_5 -// CHECK:STDOUT: %.loc12_10: i32 = int_literal 3 [template = constants.%.9] +// CHECK:STDOUT: %.loc12_10: i32 = int_literal 3 [template = constants.%.10] // CHECK:STDOUT: assign %.loc12_6, %.loc12_10 // CHECK:STDOUT: %b.ref.loc13: ref (i32, i32) = name_ref b, %b -// CHECK:STDOUT: %.loc13_5: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_5: i32 = int_literal 1 [template = constants.%.7] // CHECK:STDOUT: %.loc13_6: ref i32 = tuple_index %b.ref.loc13, %.loc13_5 -// CHECK:STDOUT: %.loc13_10: i32 = int_literal 4 [template = constants.%.10] +// CHECK:STDOUT: %.loc13_10: i32 = int_literal 4 [template = constants.%.11] // CHECK:STDOUT: assign %.loc13_6, %.loc13_10 -// CHECK:STDOUT: %.loc15_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.11] +// CHECK:STDOUT: %.loc15_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.12] // CHECK:STDOUT: %c.var: ref {.a: i32, .b: i32} = var c // CHECK:STDOUT: %c: ref {.a: i32, .b: i32} = bind_name c, %c.var -// CHECK:STDOUT: %.loc15_37: i32 = int_literal 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc15_45: i32 = int_literal 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc15_37: i32 = int_literal 1 [template = constants.%.7] +// CHECK:STDOUT: %.loc15_45: i32 = int_literal 2 [template = constants.%.8] // CHECK:STDOUT: %.loc15_46.1: {.a: i32, .b: i32} = struct_literal (%.loc15_37, %.loc15_45) // CHECK:STDOUT: %.loc15_46.2: ref i32 = struct_access %c.var, element0 -// CHECK:STDOUT: %.loc15_46.3: init i32 = initialize_from %.loc15_37 to %.loc15_46.2 [template = constants.%.6] +// CHECK:STDOUT: %.loc15_46.3: init i32 = initialize_from %.loc15_37 to %.loc15_46.2 [template = constants.%.7] // CHECK:STDOUT: %.loc15_46.4: ref i32 = struct_access %c.var, element1 -// CHECK:STDOUT: %.loc15_46.5: init i32 = initialize_from %.loc15_45 to %.loc15_46.4 [template = constants.%.7] -// CHECK:STDOUT: %.loc15_46.6: init {.a: i32, .b: i32} = struct_init (%.loc15_46.3, %.loc15_46.5) to %c.var [template = constants.%struct] -// CHECK:STDOUT: %.loc15_47: init {.a: i32, .b: i32} = converted %.loc15_46.1, %.loc15_46.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc15_46.5: init i32 = initialize_from %.loc15_45 to %.loc15_46.4 [template = constants.%.8] +// CHECK:STDOUT: %.loc15_46.6: init {.a: i32, .b: i32} = struct_init (%.loc15_46.3, %.loc15_46.5) to %c.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc15_47: init {.a: i32, .b: i32} = converted %.loc15_46.1, %.loc15_46.6 [template = constants.%struct.2] // CHECK:STDOUT: assign %c.var, %.loc15_47 // CHECK:STDOUT: %c.ref.loc16: ref {.a: i32, .b: i32} = name_ref c, %c // CHECK:STDOUT: %.loc16_4: ref i32 = struct_access %c.ref.loc16, element0 -// CHECK:STDOUT: %.loc16_9: i32 = int_literal 3 [template = constants.%.9] +// CHECK:STDOUT: %.loc16_9: i32 = int_literal 3 [template = constants.%.10] // CHECK:STDOUT: assign %.loc16_4, %.loc16_9 // CHECK:STDOUT: %c.ref.loc17: ref {.a: i32, .b: i32} = name_ref c, %c // CHECK:STDOUT: %.loc17_4: ref i32 = struct_access %c.ref.loc17, element1 -// CHECK:STDOUT: %.loc17_9: i32 = int_literal 4 [template = constants.%.10] +// CHECK:STDOUT: %.loc17_9: i32 = int_literal 4 [template = constants.%.11] // CHECK:STDOUT: assign %.loc17_4, %.loc17_9 -// CHECK:STDOUT: %.loc19_13: type = ptr_type i32 [template = constants.%.13] +// CHECK:STDOUT: %.loc19_13: type = ptr_type i32 [template = constants.%.14] // CHECK:STDOUT: %p.var: ref i32* = var p // CHECK:STDOUT: %p: ref i32* = bind_name p, %p.var // CHECK:STDOUT: %a.ref.loc19: ref i32 = name_ref a, %a @@ -117,9 +120,9 @@ fn Main() { // CHECK:STDOUT: %p.ref.loc20: ref i32* = name_ref p, %p // CHECK:STDOUT: %.loc20_4: i32* = bind_value %p.ref.loc20 // CHECK:STDOUT: %.loc20_3: ref i32 = deref %.loc20_4 -// CHECK:STDOUT: %.loc20_8: i32 = int_literal 5 [template = constants.%.14] +// CHECK:STDOUT: %.loc20_8: i32 = int_literal 5 [template = constants.%.15] // CHECK:STDOUT: assign %.loc20_3, %.loc20_8 -// CHECK:STDOUT: %.loc22_8: bool = bool_literal true [template = constants.%.15] +// CHECK:STDOUT: %.loc22_8: bool = bool_literal true [template = constants.%.16] // CHECK:STDOUT: if %.loc22_8 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: @@ -135,7 +138,7 @@ fn Main() { // CHECK:STDOUT: !if.expr.result: // CHECK:STDOUT: %.loc22_5: i32* = block_arg !if.expr.result // CHECK:STDOUT: %.loc22_3: ref i32 = deref %.loc22_5 -// CHECK:STDOUT: %.loc22_31: i32 = int_literal 10 [template = constants.%.16] +// CHECK:STDOUT: %.loc22_31: i32 = int_literal 10 [template = constants.%.17] // CHECK:STDOUT: assign %.loc22_3, %.loc22_31 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon b/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon index 7356746074ba..026c2fbdd04d 100644 --- a/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon @@ -40,13 +40,16 @@ var or_: F(true or true); // CHECK:STDOUT: --- fail_and_or_not_in_function.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: bool = bool_literal false [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal true [template] +// CHECK:STDOUT: %.3: bool = bool_literal false [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc38_17: bool = block_arg [template = constants.%.1] -// CHECK:STDOUT: %F.call: init type = call (%.loc38_17) +// CHECK:STDOUT: %.loc38_17: bool = block_arg [template = constants.%.2] +// CHECK:STDOUT: %F.call: init type = call (%.loc38_17) // CHECK:STDOUT: %.loc38_24.1: type = value_of_initializer %F.call // CHECK:STDOUT: %.loc38_24.2: type = converted %F.call, %.loc38_24.1 // CHECK:STDOUT: %or_.var: ref = var or_ diff --git a/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon b/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon index c2c83d8226cf..2d1f7f69f357 100644 --- a/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon @@ -42,18 +42,20 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: --- fail_non_constant_result.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: bool = bool_literal false [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %PartialConstant: type = fn_type @PartialConstant [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: PartialConstant = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal true [template] +// CHECK:STDOUT: %.3: bool = bool_literal false [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .PartialConstant = %PartialConstant +// CHECK:STDOUT: .PartialConstant = %PartialConstant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %PartialConstant: = fn_decl @PartialConstant [template] { +// CHECK:STDOUT: %PartialConstant.decl: PartialConstant = fn_decl @PartialConstant [template = constants.%struct] { // CHECK:STDOUT: %x.loc4_20.1: bool = param x // CHECK:STDOUT: @PartialConstant.%x: bool = bind_name x, %x.loc4_20.1 // CHECK:STDOUT: } @@ -61,8 +63,8 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @PartialConstant(%x: bool) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_13: bool = bool_literal true [template = constants.%.1] -// CHECK:STDOUT: %.loc9_18.1: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc9_13: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc9_18.1: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: if %.loc9_13 br !and.rhs else br !and.result(%.loc9_18.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: @@ -78,16 +80,16 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc9: // CHECK:STDOUT: %.loc9_40: () = tuple_literal () -// CHECK:STDOUT: %.loc9_34: type = converted %.loc9_40, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc9_34: type = converted %.loc9_40, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc9(%.loc9_34) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc9: // CHECK:STDOUT: %.loc9_10: type = block_arg !if.expr.result.loc9 // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var -// CHECK:STDOUT: %.loc14_13: bool = bool_literal false [template = constants.%.2] -// CHECK:STDOUT: %.loc14_19.1: bool = not %.loc14_13 [template = constants.%.1] -// CHECK:STDOUT: %.loc14_19.2: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc14_13: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc14_19.1: bool = not %.loc14_13 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_19.2: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc14_19.1 br !or.rhs else br !or.result(%.loc14_19.2) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs: @@ -103,7 +105,7 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc14: // CHECK:STDOUT: %.loc14_40: () = tuple_literal () -// CHECK:STDOUT: %.loc14_34: type = converted %.loc14_40, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_34: type = converted %.loc14_40, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc14(%.loc14_34) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc14: @@ -116,18 +118,20 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: --- fail_despite_known_result.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal false [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %KnownValueButNonConstantCondition: type = fn_type @KnownValueButNonConstantCondition [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: KnownValueButNonConstantCondition = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal false [template] // CHECK:STDOUT: %.3: bool = bool_literal true [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .KnownValueButNonConstantCondition = %KnownValueButNonConstantCondition +// CHECK:STDOUT: .KnownValueButNonConstantCondition = %KnownValueButNonConstantCondition.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %KnownValueButNonConstantCondition: = fn_decl @KnownValueButNonConstantCondition [template] { +// CHECK:STDOUT: %KnownValueButNonConstantCondition.decl: KnownValueButNonConstantCondition = fn_decl @KnownValueButNonConstantCondition [template = constants.%struct] { // CHECK:STDOUT: %x.loc4_38.1: bool = param x // CHECK:STDOUT: @KnownValueButNonConstantCondition.%x: bool = bind_name x, %x.loc4_38.1 // CHECK:STDOUT: } @@ -136,11 +140,11 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: fn @KnownValueButNonConstantCondition(%x: bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.ref.loc11: bool = name_ref x, %x -// CHECK:STDOUT: %.loc11_15.1: bool = bool_literal false [template = constants.%.1] +// CHECK:STDOUT: %.loc11_15.1: bool = bool_literal false [template = constants.%.2] // CHECK:STDOUT: if %x.ref.loc11 br !and.rhs else br !and.result(%.loc11_15.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %.loc11_19: bool = bool_literal false [template = constants.%.1] +// CHECK:STDOUT: %.loc11_19: bool = bool_literal false [template = constants.%.2] // CHECK:STDOUT: br !and.result(%.loc11_19) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: @@ -152,7 +156,7 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc11: // CHECK:STDOUT: %.loc11_41: () = tuple_literal () -// CHECK:STDOUT: %.loc11_35: type = converted %.loc11_41, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_35: type = converted %.loc11_41, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc11(%.loc11_35) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc11: @@ -177,7 +181,7 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc15: // CHECK:STDOUT: %.loc15_39: () = tuple_literal () -// CHECK:STDOUT: %.loc15_33: type = converted %.loc15_39, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_33: type = converted %.loc15_39, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_33) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc15: diff --git a/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon b/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon index 2f7b08e41db6..874aa7b1c814 100644 --- a/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon @@ -19,26 +19,29 @@ fn Main() { // CHECK:STDOUT: --- fail_assignment_to_error.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 42 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 42 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %undeclared.ref: = name_ref undeclared, [template = ] -// CHECK:STDOUT: %.loc12: i32 = int_literal 42 [template = constants.%.1] +// CHECK:STDOUT: %.loc12: i32 = int_literal 42 [template = constants.%.2] // CHECK:STDOUT: assign %undeclared.ref, // CHECK:STDOUT: %also_undeclared.ref: = name_ref also_undeclared, [template = ] // CHECK:STDOUT: %.loc16_3: ref = deref -// CHECK:STDOUT: %.loc16_22: i32 = int_literal 42 [template = constants.%.1] +// CHECK:STDOUT: %.loc16_22: i32 = int_literal 42 [template = constants.%.2] // CHECK:STDOUT: assign %.loc16_3, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon index 459dbc076203..52477ea5c485 100644 --- a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon @@ -55,58 +55,63 @@ fn Main() { // CHECK:STDOUT: --- fail_assignment_to_non_assignable.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.6: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %tuple.1: (i32, i32) = tuple_value (%.4, %.5) [template] -// CHECK:STDOUT: %tuple.2: (i32, i32) = tuple_value (%.1, %.2) [template] -// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.8: type = ptr_type i32 [template] -// CHECK:STDOUT: %.9: type = struct_type {.x: i32, .y: i32} [template] -// CHECK:STDOUT: %.10: type = ptr_type {.x: i32, .y: i32} [template] -// CHECK:STDOUT: %struct.1: {.x: i32, .y: i32} = struct_value (%.4, %.5) [template] -// CHECK:STDOUT: %struct.2: {.x: i32, .y: i32} = struct_value (%.1, %.2) [template] -// CHECK:STDOUT: %.11: bool = bool_literal true [template] -// CHECK:STDOUT: %.12: i32 = int_literal 10 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.7: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %tuple.1: (i32, i32) = tuple_value (%.5, %.6) [template] +// CHECK:STDOUT: %tuple.2: (i32, i32) = tuple_value (%.2, %.3) [template] +// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.9: type = ptr_type i32 [template] +// CHECK:STDOUT: %.10: type = struct_type {.x: i32, .y: i32} [template] +// CHECK:STDOUT: %.11: type = ptr_type {.x: i32, .y: i32} [template] +// CHECK:STDOUT: %struct.3: {.x: i32, .y: i32} = struct_value (%.5, %.6) [template] +// CHECK:STDOUT: %struct.4: {.x: i32, .y: i32} = struct_value (%.2, %.3) [template] +// CHECK:STDOUT: %.12: bool = bool_literal true [template] +// CHECK:STDOUT: %.13: i32 = int_literal 10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_3: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc14_7: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_3: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_7: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: assign %.loc14_3, %.loc14_7 -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() -// CHECK:STDOUT: %.loc19: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc19: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: assign %F.call, %.loc19 -// CHECK:STDOUT: %.loc24_4: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc24_7: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc24_4: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc24_7: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %.loc24_8.1: (i32, i32) = tuple_literal (%.loc24_4, %.loc24_7) -// CHECK:STDOUT: %.loc24_13: i32 = int_literal 3 [template = constants.%.4] -// CHECK:STDOUT: %.loc24_16: i32 = int_literal 4 [template = constants.%.5] +// CHECK:STDOUT: %.loc24_13: i32 = int_literal 3 [template = constants.%.5] +// CHECK:STDOUT: %.loc24_16: i32 = int_literal 4 [template = constants.%.6] // CHECK:STDOUT: %.loc24_17.1: (i32, i32) = tuple_literal (%.loc24_13, %.loc24_16) // CHECK:STDOUT: %.loc24_17.2: i32 = tuple_access %.loc24_8.1, element0 -// CHECK:STDOUT: %.loc24_17.3: init i32 = initialize_from %.loc24_13 to %.loc24_17.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc24_17.3: init i32 = initialize_from %.loc24_13 to %.loc24_17.2 [template = constants.%.5] // CHECK:STDOUT: %.loc24_17.4: i32 = tuple_access %.loc24_8.1, element1 -// CHECK:STDOUT: %.loc24_17.5: init i32 = initialize_from %.loc24_16 to %.loc24_17.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc24_17.5: init i32 = initialize_from %.loc24_16 to %.loc24_17.4 [template = constants.%.6] // CHECK:STDOUT: %.loc24_17.6: init (i32, i32) = tuple_init (%.loc24_17.3, %.loc24_17.5) to %.loc24_8.1 [template = constants.%tuple.1] // CHECK:STDOUT: %.loc24_10: init (i32, i32) = converted %.loc24_17.1, %.loc24_17.6 [template = constants.%tuple.1] // CHECK:STDOUT: assign %.loc24_8.1, %.loc24_10 @@ -114,18 +119,18 @@ fn Main() { // CHECK:STDOUT: %.loc24_8.2: (i32, i32) = converted %.loc24_8.1, %tuple.loc24 [template = constants.%tuple.2] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc25: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc25: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: assign %n.var, %.loc25 // CHECK:STDOUT: %n.ref.loc30_4: ref i32 = name_ref n, %n // CHECK:STDOUT: %n.ref.loc30_7: ref i32 = name_ref n, %n // CHECK:STDOUT: %.loc30_8.1: (i32, i32) = tuple_literal (%n.ref.loc30_4, %n.ref.loc30_7) -// CHECK:STDOUT: %.loc30_13: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc30_16: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc30_13: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc30_16: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %.loc30_17.1: (i32, i32) = tuple_literal (%.loc30_13, %.loc30_16) // CHECK:STDOUT: %.loc30_17.2: i32 = tuple_access %.loc30_8.1, element0 -// CHECK:STDOUT: %.loc30_17.3: init i32 = initialize_from %.loc30_13 to %.loc30_17.2 [template = constants.%.1] +// CHECK:STDOUT: %.loc30_17.3: init i32 = initialize_from %.loc30_13 to %.loc30_17.2 [template = constants.%.2] // CHECK:STDOUT: %.loc30_17.4: i32 = tuple_access %.loc30_8.1, element1 -// CHECK:STDOUT: %.loc30_17.5: init i32 = initialize_from %.loc30_16 to %.loc30_17.4 [template = constants.%.2] +// CHECK:STDOUT: %.loc30_17.5: init i32 = initialize_from %.loc30_16 to %.loc30_17.4 [template = constants.%.3] // CHECK:STDOUT: %.loc30_17.6: init (i32, i32) = tuple_init (%.loc30_17.3, %.loc30_17.5) to %.loc30_8.1 [template = constants.%tuple.2] // CHECK:STDOUT: %.loc30_10: init (i32, i32) = converted %.loc30_17.1, %.loc30_17.6 [template = constants.%tuple.2] // CHECK:STDOUT: assign %.loc30_8.1, %.loc30_10 @@ -133,41 +138,41 @@ fn Main() { // CHECK:STDOUT: %.loc30_7: i32 = bind_value %n.ref.loc30_7 // CHECK:STDOUT: %tuple.loc30: (i32, i32) = tuple_value (%.loc30_4, %.loc30_7) // CHECK:STDOUT: %.loc30_8.2: (i32, i32) = converted %.loc30_8.1, %tuple.loc30 -// CHECK:STDOUT: %.loc35: type = ptr_type i32 [template = constants.%.8] +// CHECK:STDOUT: %.loc35: type = ptr_type i32 [template = constants.%.9] // CHECK:STDOUT: assign i32, %.loc35 -// CHECK:STDOUT: %.loc40_9: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc40_17: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc40_9: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc40_17: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %.loc40_18.1: {.x: i32, .y: i32} = struct_literal (%.loc40_9, %.loc40_17) -// CHECK:STDOUT: %.loc40_28: i32 = int_literal 3 [template = constants.%.4] -// CHECK:STDOUT: %.loc40_36: i32 = int_literal 4 [template = constants.%.5] +// CHECK:STDOUT: %.loc40_28: i32 = int_literal 3 [template = constants.%.5] +// CHECK:STDOUT: %.loc40_36: i32 = int_literal 4 [template = constants.%.6] // CHECK:STDOUT: %.loc40_37.1: {.x: i32, .y: i32} = struct_literal (%.loc40_28, %.loc40_36) // CHECK:STDOUT: %.loc40_37.2: i32 = struct_access %.loc40_18.1, element0 -// CHECK:STDOUT: %.loc40_37.3: init i32 = initialize_from %.loc40_28 to %.loc40_37.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc40_37.3: init i32 = initialize_from %.loc40_28 to %.loc40_37.2 [template = constants.%.5] // CHECK:STDOUT: %.loc40_37.4: i32 = struct_access %.loc40_18.1, element1 -// CHECK:STDOUT: %.loc40_37.5: init i32 = initialize_from %.loc40_36 to %.loc40_37.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc40_37.6: init {.x: i32, .y: i32} = struct_init (%.loc40_37.3, %.loc40_37.5) to %.loc40_18.1 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc40_20: init {.x: i32, .y: i32} = converted %.loc40_37.1, %.loc40_37.6 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc40_37.5: init i32 = initialize_from %.loc40_36 to %.loc40_37.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc40_37.6: init {.x: i32, .y: i32} = struct_init (%.loc40_37.3, %.loc40_37.5) to %.loc40_18.1 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc40_20: init {.x: i32, .y: i32} = converted %.loc40_37.1, %.loc40_37.6 [template = constants.%struct.3] // CHECK:STDOUT: assign %.loc40_18.1, %.loc40_20 -// CHECK:STDOUT: %struct: {.x: i32, .y: i32} = struct_value (%.loc40_9, %.loc40_17) [template = constants.%struct.2] -// CHECK:STDOUT: %.loc40_18.2: {.x: i32, .y: i32} = converted %.loc40_18.1, %struct [template = constants.%struct.2] -// CHECK:STDOUT: %.loc45_7: bool = bool_literal true [template = constants.%.11] +// CHECK:STDOUT: %struct: {.x: i32, .y: i32} = struct_value (%.loc40_9, %.loc40_17) [template = constants.%struct.4] +// CHECK:STDOUT: %.loc40_18.2: {.x: i32, .y: i32} = converted %.loc40_18.1, %struct [template = constants.%struct.4] +// CHECK:STDOUT: %.loc45_7: bool = bool_literal true [template = constants.%.12] // CHECK:STDOUT: if %.loc45_7 br !if.expr.then.loc45 else br !if.expr.else.loc45 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc45: -// CHECK:STDOUT: %.loc45_17: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc45_17: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: br !if.expr.result.loc45(%.loc45_17) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc45: -// CHECK:STDOUT: %.loc45_24: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc45_24: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: br !if.expr.result.loc45(%.loc45_24) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc45: -// CHECK:STDOUT: %.loc45_4: i32 = block_arg !if.expr.result.loc45 [template = constants.%.1] -// CHECK:STDOUT: %.loc45_29: i32 = int_literal 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc45_4: i32 = block_arg !if.expr.result.loc45 [template = constants.%.2] +// CHECK:STDOUT: %.loc45_29: i32 = int_literal 3 [template = constants.%.5] // CHECK:STDOUT: assign %.loc45_4, %.loc45_29 // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc52_7: bool = bool_literal true [template = constants.%.11] +// CHECK:STDOUT: %.loc52_7: bool = bool_literal true [template = constants.%.12] // CHECK:STDOUT: if %.loc52_7 br !if.expr.then.loc52 else br !if.expr.else.loc52 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc52: @@ -182,7 +187,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc52: // CHECK:STDOUT: %.loc52_4: i32 = block_arg !if.expr.result.loc52 -// CHECK:STDOUT: %.loc52_29: i32 = int_literal 10 [template = constants.%.12] +// CHECK:STDOUT: %.loc52_29: i32 = int_literal 10 [template = constants.%.13] // CHECK:STDOUT: assign %.loc52_4, %.loc52_29 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon index 67a068351689..4b479494e15d 100644 --- a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon @@ -13,7 +13,7 @@ fn Main() { // CHECK:STDERR: ^~~~~ // CHECK:STDERR: a = a.(a); - // CHECK:STDERR: fail_redundant_compound_access.carbon:[[@LINE+3]]:7: ERROR: Member name of type `` in compound member access is not an instance member or an interface member. + // CHECK:STDERR: fail_redundant_compound_access.carbon:[[@LINE+3]]:7: ERROR: Member name of type `F` in compound member access is not an instance member or an interface member. // CHECK:STDERR: a = a.(F)(); // CHECK:STDERR: ^~~~~ a = a.(F)(); @@ -22,26 +22,31 @@ fn Main() { // CHECK:STDOUT: --- fail_redundant_compound_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] +// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc7: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -49,7 +54,7 @@ fn Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc10: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc10: i32 = int_literal 3 [template = constants.%.3] // CHECK:STDOUT: assign %a.var, %.loc10 // CHECK:STDOUT: %a.ref.loc15_3: ref i32 = name_ref a, %a // CHECK:STDOUT: %a.ref.loc15_7: ref i32 = name_ref a, %a @@ -58,7 +63,7 @@ fn Main() { // CHECK:STDOUT: assign %a.ref.loc15_3, %.loc15 // CHECK:STDOUT: %a.ref.loc19_3: ref i32 = name_ref a, %a // CHECK:STDOUT: %a.ref.loc19_7: ref i32 = name_ref a, %a -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() // CHECK:STDOUT: assign %a.ref.loc19_3, %F.call // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon index 0560341b6106..06ff09a68736 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon @@ -14,23 +14,26 @@ fn Main() { // CHECK:STDOUT: --- fail_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 12 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref bool = var x // CHECK:STDOUT: %x: ref bool = bind_name x, %x.var -// CHECK:STDOUT: %.loc11_21: i32 = int_literal 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_21: i32 = int_literal 12 [template = constants.%.2] // CHECK:STDOUT: %.loc11_17: = not [template = ] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon index 6f42868544f4..b61b10a6f6da 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon @@ -15,27 +15,30 @@ fn Main() { // CHECK:STDOUT: --- fail_type_mismatch_assignment.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.2: f64 = float_literal 5.6000000000000005 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.3: f64 = float_literal 5.6000000000000005 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc8: i32 = int_literal 3 [template = constants.%.2] // CHECK:STDOUT: assign %a.var, %.loc8 // CHECK:STDOUT: %a.ref: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc12: f64 = float_literal 5.6000000000000005 [template = constants.%.2] +// CHECK:STDOUT: %.loc12: f64 = float_literal 5.6000000000000005 [template = constants.%.3] // CHECK:STDOUT: assign %a.ref, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon index b2bb5e94a901..e4349d681ecb 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon @@ -28,26 +28,29 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_type_mismatch_once.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.2: f64 = float_literal 3.4000000000000004 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.3: f64 = float_literal 3.4000000000000004 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] { +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc25_10: i32 = int_literal 12 [template = constants.%.1] -// CHECK:STDOUT: %.loc25_15: f64 = float_literal 3.4000000000000004 [template = constants.%.2] -// CHECK:STDOUT: %.loc25_21: i32 = int_literal 12 [template = constants.%.1] +// CHECK:STDOUT: %.loc25_10: i32 = int_literal 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc25_15: f64 = float_literal 3.4000000000000004 [template = constants.%.3] +// CHECK:STDOUT: %.loc25_21: i32 = int_literal 12 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon index 494c010e2212..1bdd5f7d4fb6 100644 --- a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon @@ -18,25 +18,28 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_unimplemented_op.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 12 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 34 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 12 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 34 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] { +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_10: i32 = int_literal 12 [template = constants.%.1] -// CHECK:STDOUT: %.loc15_15: i32 = int_literal 34 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_10: i32 = int_literal 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_15: i32 = int_literal 34 [template = constants.%.3] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/or.carbon b/toolchain/check/testdata/operators/builtin/or.carbon index 5d3652678769..d1168183411a 100644 --- a/toolchain/check/testdata/operators/builtin/or.carbon +++ b/toolchain/check/testdata/operators/builtin/or.carbon @@ -25,33 +25,43 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: --- or.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: bool = bool_literal false [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal true [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %Or: type = fn_type @Or [template] +// CHECK:STDOUT: %struct.3: Or = struct_value () [template] +// CHECK:STDOUT: %Constant: type = fn_type @Constant [template] +// CHECK:STDOUT: %struct.4: Constant = struct_value () [template] +// CHECK:STDOUT: %.3: bool = bool_literal false [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] +// CHECK:STDOUT: %PartialConstant: type = fn_type @PartialConstant [template] +// CHECK:STDOUT: %struct.5: PartialConstant = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .Or = %Or -// CHECK:STDOUT: .Constant = %Constant -// CHECK:STDOUT: .PartialConstant = %PartialConstant +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .Or = %Or.decl +// CHECK:STDOUT: .Constant = %Constant.decl +// CHECK:STDOUT: .PartialConstant = %PartialConstant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: @G.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Or: = fn_decl @Or [template] { +// CHECK:STDOUT: %Or.decl: Or = fn_decl @Or [template = constants.%struct.3] { // CHECK:STDOUT: @Or.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Constant: = fn_decl @Constant [template] {} -// CHECK:STDOUT: %PartialConstant: = fn_decl @PartialConstant [template] { +// CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.4] {} +// CHECK:STDOUT: %PartialConstant.decl: PartialConstant = fn_decl @PartialConstant [template = constants.%struct.5] { // CHECK:STDOUT: %x.loc21_20.1: bool = param x // CHECK:STDOUT: @PartialConstant.%x: bool = bind_name x, %x.loc21_20.1 // CHECK:STDOUT: } @@ -59,28 +69,28 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc7: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Or() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init bool = call %F.ref() // CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %F.call // CHECK:STDOUT: %.loc11_14.2: bool = converted %F.call, %.loc11_14.1 // CHECK:STDOUT: %.loc11_14.3: bool = not %.loc11_14.2 -// CHECK:STDOUT: %.loc11_14.4: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc11_14.4: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc11_14.3 br !or.rhs else br !or.result(%.loc11_14.4) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %G.call: init bool = call %G.ref() // CHECK:STDOUT: %.loc11_14.5: bool = value_of_initializer %G.call // CHECK:STDOUT: %.loc11_14.6: bool = converted %G.call, %.loc11_14.5 @@ -93,17 +103,17 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Constant() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13: bool = bool_literal true [template = constants.%.1] -// CHECK:STDOUT: %.loc15_18.1: bool = not %.loc15_13 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_18.2: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc15_13: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc15_18.1: bool = not %.loc15_13 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_18.2: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc15_18.1 br !or.rhs.loc15 else br !or.result.loc15(%.loc15_18.2) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs.loc15: -// CHECK:STDOUT: %.loc15_21: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc15_21: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: br !or.result.loc15(%.loc15_21) // CHECK:STDOUT: // CHECK:STDOUT: !or.result.loc15: -// CHECK:STDOUT: %.loc15_18.3: bool = block_arg !or.result.loc15 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_18.3: bool = block_arg !or.result.loc15 [template = constants.%.2] // CHECK:STDOUT: if %.loc15_18.3 br !if.expr.then.loc15 else br !if.expr.else.loc15 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc15: @@ -111,26 +121,26 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc15: // CHECK:STDOUT: %.loc15_42: () = tuple_literal () -// CHECK:STDOUT: %.loc15_36: type = converted %.loc15_42, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_36: type = converted %.loc15_42, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_36) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc15: // CHECK:STDOUT: %.loc15_10: type = block_arg !if.expr.result.loc15 [template = bool] // CHECK:STDOUT: %a.var: ref bool = var a // CHECK:STDOUT: %a: ref bool = bind_name a, %a.var -// CHECK:STDOUT: %.loc15_46: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc15_46: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: assign %a.var, %.loc15_46 -// CHECK:STDOUT: %.loc16_13: bool = bool_literal true [template = constants.%.1] -// CHECK:STDOUT: %.loc16_18.1: bool = not %.loc16_13 [template = constants.%.2] -// CHECK:STDOUT: %.loc16_18.2: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc16_13: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc16_18.1: bool = not %.loc16_13 [template = constants.%.3] +// CHECK:STDOUT: %.loc16_18.2: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc16_18.1 br !or.rhs.loc16 else br !or.result.loc16(%.loc16_18.2) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs.loc16: -// CHECK:STDOUT: %.loc16_21: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc16_21: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: br !or.result.loc16(%.loc16_21) // CHECK:STDOUT: // CHECK:STDOUT: !or.result.loc16: -// CHECK:STDOUT: %.loc16_18.3: bool = block_arg !or.result.loc16 [template = constants.%.1] +// CHECK:STDOUT: %.loc16_18.3: bool = block_arg !or.result.loc16 [template = constants.%.2] // CHECK:STDOUT: if %.loc16_18.3 br !if.expr.then.loc16 else br !if.expr.else.loc16 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc16: @@ -138,26 +148,26 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc16: // CHECK:STDOUT: %.loc16_43: () = tuple_literal () -// CHECK:STDOUT: %.loc16_37: type = converted %.loc16_43, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc16_37: type = converted %.loc16_43, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_37) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc16: // CHECK:STDOUT: %.loc16_10: type = block_arg !if.expr.result.loc16 [template = bool] // CHECK:STDOUT: %b.var: ref bool = var b // CHECK:STDOUT: %b: ref bool = bind_name b, %b.var -// CHECK:STDOUT: %.loc16_47: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc16_47: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: assign %b.var, %.loc16_47 -// CHECK:STDOUT: %.loc17_13: bool = bool_literal false [template = constants.%.2] -// CHECK:STDOUT: %.loc17_19.1: bool = not %.loc17_13 [template = constants.%.1] -// CHECK:STDOUT: %.loc17_19.2: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc17_13: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc17_19.1: bool = not %.loc17_13 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_19.2: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc17_19.1 br !or.rhs.loc17 else br !or.result.loc17(%.loc17_19.2) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs.loc17: -// CHECK:STDOUT: %.loc17_22: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc17_22: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: br !or.result.loc17(%.loc17_22) // CHECK:STDOUT: // CHECK:STDOUT: !or.result.loc17: -// CHECK:STDOUT: %.loc17_19.3: bool = block_arg !or.result.loc17 [template = constants.%.1] +// CHECK:STDOUT: %.loc17_19.3: bool = block_arg !or.result.loc17 [template = constants.%.2] // CHECK:STDOUT: if %.loc17_19.3 br !if.expr.then.loc17 else br !if.expr.else.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc17: @@ -165,26 +175,26 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc17: // CHECK:STDOUT: %.loc17_43: () = tuple_literal () -// CHECK:STDOUT: %.loc17_37: type = converted %.loc17_43, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc17_37: type = converted %.loc17_43, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc17(%.loc17_37) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc17: // CHECK:STDOUT: %.loc17_10: type = block_arg !if.expr.result.loc17 [template = bool] // CHECK:STDOUT: %c.var: ref bool = var c // CHECK:STDOUT: %c: ref bool = bind_name c, %c.var -// CHECK:STDOUT: %.loc17_47: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc17_47: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: assign %c.var, %.loc17_47 -// CHECK:STDOUT: %.loc18_13: bool = bool_literal false [template = constants.%.2] -// CHECK:STDOUT: %.loc18_19.1: bool = not %.loc18_13 [template = constants.%.1] -// CHECK:STDOUT: %.loc18_19.2: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc18_13: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc18_19.1: bool = not %.loc18_13 [template = constants.%.2] +// CHECK:STDOUT: %.loc18_19.2: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc18_19.1 br !or.rhs.loc18 else br !or.result.loc18(%.loc18_19.2) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs.loc18: -// CHECK:STDOUT: %.loc18_22: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc18_22: bool = bool_literal false [template = constants.%.3] // CHECK:STDOUT: br !or.result.loc18(%.loc18_22) // CHECK:STDOUT: // CHECK:STDOUT: !or.result.loc18: -// CHECK:STDOUT: %.loc18_19.3: bool = block_arg !or.result.loc18 [template = constants.%.2] +// CHECK:STDOUT: %.loc18_19.3: bool = block_arg !or.result.loc18 [template = constants.%.3] // CHECK:STDOUT: if %.loc18_19.3 br !if.expr.then.loc18 else br !if.expr.else.loc18 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc18: @@ -192,11 +202,11 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc18: // CHECK:STDOUT: %.loc18_44: () = tuple_literal () -// CHECK:STDOUT: %.loc18_38: type = converted %.loc18_44, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc18_38: type = converted %.loc18_44, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc18(%.loc18_38) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc18: -// CHECK:STDOUT: %.loc18_10: type = block_arg !if.expr.result.loc18 [template = constants.%.3] +// CHECK:STDOUT: %.loc18_10: type = block_arg !if.expr.result.loc18 [template = constants.%.1] // CHECK:STDOUT: %d.var: ref () = var d // CHECK:STDOUT: %d: ref () = bind_name d, %d.var // CHECK:STDOUT: %.loc18_49.1: () = tuple_literal () @@ -208,9 +218,9 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @PartialConstant(%x: bool) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_13: bool = bool_literal true [template = constants.%.1] -// CHECK:STDOUT: %.loc22_18.1: bool = not %.loc22_13 [template = constants.%.2] -// CHECK:STDOUT: %.loc22_18.2: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc22_13: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc22_18.1: bool = not %.loc22_13 [template = constants.%.3] +// CHECK:STDOUT: %.loc22_18.2: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc22_18.1 br !or.rhs else br !or.result(%.loc22_18.2) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs: @@ -218,7 +228,7 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: br !or.result(%x.ref) // CHECK:STDOUT: // CHECK:STDOUT: !or.result: -// CHECK:STDOUT: %.loc22_18.3: bool = block_arg !or.result [template = constants.%.1] +// CHECK:STDOUT: %.loc22_18.3: bool = block_arg !or.result [template = constants.%.2] // CHECK:STDOUT: if %.loc22_18.3 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: @@ -226,14 +236,14 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: // CHECK:STDOUT: %.loc22_39: () = tuple_literal () -// CHECK:STDOUT: %.loc22_33: type = converted %.loc22_39, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc22_33: type = converted %.loc22_39, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result(%.loc22_33) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: // CHECK:STDOUT: %.loc22_10: type = block_arg !if.expr.result [template = bool] // CHECK:STDOUT: %a.var: ref bool = var a // CHECK:STDOUT: %a: ref bool = bind_name a, %a.var -// CHECK:STDOUT: %.loc22_43: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc22_43: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: assign %a.var, %.loc22_43 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/unary_op.carbon b/toolchain/check/testdata/operators/builtin/unary_op.carbon index f5d68ade08af..e042a8401a43 100644 --- a/toolchain/check/testdata/operators/builtin/unary_op.carbon +++ b/toolchain/check/testdata/operators/builtin/unary_op.carbon @@ -19,31 +19,35 @@ fn Constant() { // CHECK:STDOUT: --- unary_op.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: bool = bool_literal false [template] -// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %Not: type = fn_type @Not [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Not = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal true [template] +// CHECK:STDOUT: %.3: bool = bool_literal false [template] +// CHECK:STDOUT: %Constant: type = fn_type @Constant [template] +// CHECK:STDOUT: %struct.2: Constant = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Not = %Not -// CHECK:STDOUT: .Constant = %Constant +// CHECK:STDOUT: .Not = %Not.decl +// CHECK:STDOUT: .Constant = %Constant.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Not: = fn_decl @Not [template] { +// CHECK:STDOUT: %Not.decl: Not = fn_decl @Not [template = constants.%struct.1] { // CHECK:STDOUT: %b.loc7_8.1: bool = param b // CHECK:STDOUT: @Not.%b: bool = bind_name b, %b.loc7_8.1 // CHECK:STDOUT: @Not.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11_26: bool = bool_literal true [template = constants.%.1] -// CHECK:STDOUT: %.loc11_22: bool = not %.loc11_26 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_26: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc11_22: bool = not %.loc11_26 [template = constants.%.3] // CHECK:STDOUT: %not_true: bool = bind_name not_true, %.loc11_22 -// CHECK:STDOUT: %.loc12_27: bool = bool_literal false [template = constants.%.2] -// CHECK:STDOUT: %.loc12_23: bool = not %.loc12_27 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_27: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc12_23: bool = not %.loc12_27 [template = constants.%.2] // CHECK:STDOUT: %not_false: bool = bind_name not_false, %.loc12_23 -// CHECK:STDOUT: %Constant: = fn_decl @Constant [template] {} +// CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Not(%b: bool) -> bool { @@ -55,8 +59,8 @@ fn Constant() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Constant() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_17: bool = bool_literal true [template = constants.%.1] -// CHECK:STDOUT: %.loc15_13: bool = not %.loc15_17 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_17: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc15_13: bool = not %.loc15_17 [template = constants.%.3] // CHECK:STDOUT: if %.loc15_13 br !if.expr.then.loc15 else br !if.expr.else.loc15 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc15: @@ -64,19 +68,19 @@ fn Constant() { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc15: // CHECK:STDOUT: %.loc15_38: () = tuple_literal () -// CHECK:STDOUT: %.loc15_32: type = converted %.loc15_38, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_32: type = converted %.loc15_38, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_32) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc15: -// CHECK:STDOUT: %.loc15_10: type = block_arg !if.expr.result.loc15 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_10: type = block_arg !if.expr.result.loc15 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var // CHECK:STDOUT: %.loc15_43.1: () = tuple_literal () // CHECK:STDOUT: %.loc15_43.2: init () = tuple_init () to %a.var [template = constants.%tuple] // CHECK:STDOUT: %.loc15_44: init () = converted %.loc15_43.1, %.loc15_43.2 [template = constants.%tuple] // CHECK:STDOUT: assign %a.var, %.loc15_44 -// CHECK:STDOUT: %.loc16_17: bool = bool_literal false [template = constants.%.2] -// CHECK:STDOUT: %.loc16_13: bool = not %.loc16_17 [template = constants.%.1] +// CHECK:STDOUT: %.loc16_17: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc16_13: bool = not %.loc16_17 [template = constants.%.2] // CHECK:STDOUT: if %.loc16_13 br !if.expr.then.loc16 else br !if.expr.else.loc16 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc16: @@ -84,14 +88,14 @@ fn Constant() { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc16: // CHECK:STDOUT: %.loc16_39: () = tuple_literal () -// CHECK:STDOUT: %.loc16_33: type = converted %.loc16_39, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc16_33: type = converted %.loc16_39, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_33) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc16: // CHECK:STDOUT: %.loc16_10: type = block_arg !if.expr.result.loc16 [template = bool] // CHECK:STDOUT: %b.var: ref bool = var b // CHECK:STDOUT: %b: ref bool = bind_name b, %b.var -// CHECK:STDOUT: %.loc16_43: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc16_43: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: assign %b.var, %.loc16_43 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/add.carbon b/toolchain/check/testdata/operators/overloaded/add.carbon index 022d934b1700..9aeafb2e9fda 100644 --- a/toolchain/check/testdata/operators/overloaded/add.carbon +++ b/toolchain/check/testdata/operators/overloaded/add.carbon @@ -47,13 +47,18 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Add [template] // CHECK:STDOUT: %Self.1: Add = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Add, [template] -// CHECK:STDOUT: %.3: in Add> = assoc_entity element0, @Add.%Op [template] -// CHECK:STDOUT: %.4: type = interface_type @AddAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Add, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Add.%Op.decl [template] +// CHECK:STDOUT: %.5: type = interface_type @AddAssign [template] // CHECK:STDOUT: %Self.2: AddAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.6: type = assoc_entity_type @AddAssign, [template] -// CHECK:STDOUT: %.7: in AddAssign> = assoc_entity element0, @AddAssign.%Op [template] +// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @AddAssign, Op [template] +// CHECK:STDOUT: %.8: = assoc_entity element0, @AddAssign.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,12 +67,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .AddAssign = %AddAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Add.decl: type = interface_decl @Add [template = constants.%.1] {} -// CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.4] {} +// CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Add { // CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc5_15: Add = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self.1] @@ -83,21 +88,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in Add> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @AddAssign { // CHECK:STDOUT: %Self: AddAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_20: AddAssign = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.1: type = facet_type_access %Self.ref.loc8_20 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.2: type = converted %Self.ref.loc8_20, %.loc8_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.6] // CHECK:STDOUT: %self.loc8_14.1: Self* = param self // CHECK:STDOUT: %self.loc8_14.3: Self* = bind_name self, %self.loc8_14.1 // CHECK:STDOUT: %.loc8_9: Self* = addr_pattern %self.loc8_14.3 @@ -107,12 +112,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc8_27.1: Self = param other // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_39: in AddAssign> = assoc_entity element0, %Op [template = constants.%.7] +// CHECK:STDOUT: %.loc8_39: = assoc_entity element0, %Op.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@Add.%self.loc5_9.2: Self](@Add.%other.loc5_21.2: Self) -> Self; @@ -126,51 +131,63 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Add [template] // CHECK:STDOUT: %Self.1: Add = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %.6: type = interface_type @AddAssign [template] // CHECK:STDOUT: %Self.2: AddAssign = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.7: type = ptr_type C [template] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] // CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.9: = interface_witness (@impl.2.%Op) [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @Add, [template] -// CHECK:STDOUT: %.11: in Add> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %.12: type = assoc_entity_type @AddAssign, [template] -// CHECK:STDOUT: %.13: in AddAssign> = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.5: Op = struct_value () [template] +// CHECK:STDOUT: %.9: = interface_witness (%struct.4) [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.6: TestOp = struct_value () [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @Add, Op [template] +// CHECK:STDOUT: %.11: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestAssign: type = fn_type @TestAssign [template] +// CHECK:STDOUT: %struct.7: TestAssign = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @AddAssign, Op [template] +// CHECK:STDOUT: %.13: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp -// CHECK:STDOUT: .TestAssign = %TestAssign +// CHECK:STDOUT: .TestOp = %TestOp.decl +// CHECK:STDOUT: .TestAssign = %TestAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in Add> = import_ref ir2, inst+21, loc_82 [template = constants.%.11] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+24, loc_82 [template = constants.%.11] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+19, loc_19 [template = imports.%Op.1] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+19, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Add.decl: type = interface_decl @Add [template = constants.%.2] {} // CHECK:STDOUT: %Add.ref: type = name_ref Add, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+23, loc_46 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.6: in AddAssign> = import_ref ir2, inst+42, loc_101 [template = constants.%.13] -// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+25, unloaded -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+40, loc_47 [template = imports.%Op.2] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+26, loc_46 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+47, loc_101 [template = constants.%.13] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+28, unloaded +// CHECK:STDOUT: %import_ref.8: Op = import_ref ir2, inst+43, loc_47 [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.6] {} // CHECK:STDOUT: %AddAssign.ref: type = name_ref AddAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc17_14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc17_11.1: C = param a // CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc17_11.1 @@ -182,7 +199,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_82 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { +// CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { // CHECK:STDOUT: %C.ref.loc21_18: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %.loc21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %a.loc21_15.1: C* = param a @@ -191,8 +208,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %b.loc21_22.1: C = param b // CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc21_22.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+23, loc_101 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+40, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+26, loc_101 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+43, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Add { @@ -210,7 +227,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Add { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_9.1: C = param self // CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 @@ -220,15 +237,15 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as AddAssign { -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc14_21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %self.loc14_14.1: C* = param self @@ -238,10 +255,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc14_24.1: C = param other // CHECK:STDOUT: %other.loc14_24.2: C = bind_name other, %other.loc14_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.9] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,8 +270,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc9_9.2: C](@impl.1.%other.loc9_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc10_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -271,11 +288,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] -// CHECK:STDOUT: %.loc18_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc17: ref C = splice_block %return {} -// CHECK:STDOUT: %.loc18_12.2: init C = call %.loc18_12.1(%a.ref, %b.ref) to %.loc17 -// CHECK:STDOUT: return %.loc18_12.2 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc18(%a.ref, %b.ref) to %.loc17 +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { @@ -283,10 +300,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C* = name_ref a, %a // CHECK:STDOUT: %.loc22_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] -// CHECK:STDOUT: %.loc22_6.1: = bound_method %.loc22_3.1, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_6: = bound_method %.loc22_3.1, %.1 // CHECK:STDOUT: %.loc22_3.2: C* = addr_of %.loc22_3.1 -// CHECK:STDOUT: %.loc22_6.2: init () = call %.loc22_6.1(%.loc22_3.2, %b.ref) +// CHECK:STDOUT: %Op.call: init () = call %.loc22_6(%.loc22_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/bit_and.carbon b/toolchain/check/testdata/operators/overloaded/bit_and.carbon index 32e439600d3d..8d7ac83e8057 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_and.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_and.carbon @@ -47,13 +47,18 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @BitAnd [template] // CHECK:STDOUT: %Self.1: BitAnd = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @BitAnd, [template] -// CHECK:STDOUT: %.3: in BitAnd> = assoc_entity element0, @BitAnd.%Op [template] -// CHECK:STDOUT: %.4: type = interface_type @BitAndAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @BitAnd, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @BitAnd.%Op.decl [template] +// CHECK:STDOUT: %.5: type = interface_type @BitAndAssign [template] // CHECK:STDOUT: %Self.2: BitAndAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.6: type = assoc_entity_type @BitAndAssign, [template] -// CHECK:STDOUT: %.7: in BitAndAssign> = assoc_entity element0, @BitAndAssign.%Op [template] +// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @BitAndAssign, Op [template] +// CHECK:STDOUT: %.8: = assoc_entity element0, @BitAndAssign.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,12 +67,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .BitAndAssign = %BitAndAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %BitAnd.decl: type = interface_decl @BitAnd [template = constants.%.1] {} -// CHECK:STDOUT: %BitAndAssign.decl: type = interface_decl @BitAndAssign [template = constants.%.4] {} +// CHECK:STDOUT: %BitAndAssign.decl: type = interface_decl @BitAndAssign [template = constants.%.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitAnd { // CHECK:STDOUT: %Self: BitAnd = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc5_15: BitAnd = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self.1] @@ -83,21 +88,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in BitAnd> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitAndAssign { // CHECK:STDOUT: %Self: BitAndAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_20: BitAndAssign = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.1: type = facet_type_access %Self.ref.loc8_20 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.2: type = converted %Self.ref.loc8_20, %.loc8_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.6] // CHECK:STDOUT: %self.loc8_14.1: Self* = param self // CHECK:STDOUT: %self.loc8_14.3: Self* = bind_name self, %self.loc8_14.1 // CHECK:STDOUT: %.loc8_9: Self* = addr_pattern %self.loc8_14.3 @@ -107,12 +112,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc8_27.1: Self = param other // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_39: in BitAndAssign> = assoc_entity element0, %Op [template = constants.%.7] +// CHECK:STDOUT: %.loc8_39: = assoc_entity element0, %Op.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@BitAnd.%self.loc5_9.2: Self](@BitAnd.%other.loc5_21.2: Self) -> Self; @@ -126,51 +131,63 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @BitAnd [template] // CHECK:STDOUT: %Self.1: BitAnd = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %.6: type = interface_type @BitAndAssign [template] // CHECK:STDOUT: %Self.2: BitAndAssign = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.7: type = ptr_type C [template] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] // CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.9: = interface_witness (@impl.2.%Op) [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @BitAnd, [template] -// CHECK:STDOUT: %.11: in BitAnd> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %.12: type = assoc_entity_type @BitAndAssign, [template] -// CHECK:STDOUT: %.13: in BitAndAssign> = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.5: Op = struct_value () [template] +// CHECK:STDOUT: %.9: = interface_witness (%struct.4) [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.6: TestOp = struct_value () [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @BitAnd, Op [template] +// CHECK:STDOUT: %.11: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestAssign: type = fn_type @TestAssign [template] +// CHECK:STDOUT: %struct.7: TestAssign = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @BitAndAssign, Op [template] +// CHECK:STDOUT: %.13: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp -// CHECK:STDOUT: .TestAssign = %TestAssign +// CHECK:STDOUT: .TestOp = %TestOp.decl +// CHECK:STDOUT: .TestAssign = %TestAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in BitAnd> = import_ref ir2, inst+21, loc_82 [template = constants.%.11] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+24, loc_82 [template = constants.%.11] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+19, loc_19 [template = imports.%Op.1] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+19, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitAnd.decl: type = interface_decl @BitAnd [template = constants.%.2] {} // CHECK:STDOUT: %BitAnd.ref: type = name_ref BitAnd, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+23, loc_46 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.6: in BitAndAssign> = import_ref ir2, inst+42, loc_101 [template = constants.%.13] -// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+25, unloaded -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+40, loc_47 [template = imports.%Op.2] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+26, loc_46 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+47, loc_101 [template = constants.%.13] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+28, unloaded +// CHECK:STDOUT: %import_ref.8: Op = import_ref ir2, inst+43, loc_47 [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitAndAssign.decl: type = interface_decl @BitAndAssign [template = constants.%.6] {} // CHECK:STDOUT: %BitAndAssign.ref: type = name_ref BitAndAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc17_14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc17_11.1: C = param a // CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc17_11.1 @@ -182,7 +199,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_82 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { +// CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { // CHECK:STDOUT: %C.ref.loc21_18: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %.loc21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %a.loc21_15.1: C* = param a @@ -191,8 +208,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %b.loc21_22.1: C = param b // CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc21_22.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+23, loc_101 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+40, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+26, loc_101 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+43, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitAnd { @@ -210,7 +227,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as BitAnd { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_9.1: C = param self // CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 @@ -220,15 +237,15 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as BitAndAssign { -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc14_21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %self.loc14_14.1: C* = param self @@ -238,10 +255,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc14_24.1: C = param other // CHECK:STDOUT: %other.loc14_24.2: C = bind_name other, %other.loc14_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.9] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,8 +270,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc9_9.2: C](@impl.1.%other.loc9_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc10_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -271,11 +288,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] -// CHECK:STDOUT: %.loc18_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc17: ref C = splice_block %return {} -// CHECK:STDOUT: %.loc18_12.2: init C = call %.loc18_12.1(%a.ref, %b.ref) to %.loc17 -// CHECK:STDOUT: return %.loc18_12.2 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc18(%a.ref, %b.ref) to %.loc17 +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { @@ -283,10 +300,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C* = name_ref a, %a // CHECK:STDOUT: %.loc22_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] -// CHECK:STDOUT: %.loc22_6.1: = bound_method %.loc22_3.1, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_6: = bound_method %.loc22_3.1, %.1 // CHECK:STDOUT: %.loc22_3.2: C* = addr_of %.loc22_3.1 -// CHECK:STDOUT: %.loc22_6.2: init () = call %.loc22_6.1(%.loc22_3.2, %b.ref) +// CHECK:STDOUT: %Op.call: init () = call %.loc22_6(%.loc22_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/bit_complement.carbon b/toolchain/check/testdata/operators/overloaded/bit_complement.carbon index a59cf63d20e3..139650479f9d 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_complement.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_complement.carbon @@ -37,8 +37,11 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @BitComplement [template] // CHECK:STDOUT: %Self: BitComplement = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @BitComplement, [template] -// CHECK:STDOUT: %.3: in BitComplement> = assoc_entity element0, @BitComplement.%Op [template] +// CHECK:STDOUT: %Op: type = fn_type @Op [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @BitComplement, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @BitComplement.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -50,7 +53,7 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: interface @BitComplement { // CHECK:STDOUT: %Self: BitComplement = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %Op: = fn_decl @Op [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op [template = constants.%struct] { // CHECK:STDOUT: %Self.ref.loc5_15: BitComplement = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self] @@ -61,12 +64,12 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: %.loc5_26.2: type = converted %Self.ref.loc5_26, %.loc5_26.1 [symbolic = constants.%Self] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_30: in BitComplement> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_30: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_30 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op[@BitComplement.%self.loc5_9.2: Self]() -> Self; @@ -78,33 +81,39 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @BitComplement [template] // CHECK:STDOUT: %Self: BitComplement = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.%Op) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] -// CHECK:STDOUT: %.6: type = assoc_entity_type @BitComplement, [template] -// CHECK:STDOUT: %.7: in BitComplement> = assoc_entity element0, file.%import_ref.6 [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.4: TestOp = struct_value () [template] +// CHECK:STDOUT: %.6: type = assoc_entity_type @BitComplement, Op [template] +// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp +// CHECK:STDOUT: .TestOp = %TestOp.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in BitComplement> = import_ref ir2, inst+16, loc_50 [template = constants.%.7] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+19, loc_50 [template = constants.%.7] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+14, loc_19 [template = imports.%Op] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+14, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitComplement.decl: type = interface_decl @BitComplement [template = constants.%.2] {} // CHECK:STDOUT: %BitComplement.ref: type = name_ref BitComplement, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc14_14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc14_11.1: C = param a // CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc14_11.1 @@ -123,17 +132,17 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as BitComplement { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_9.1: C = param self // CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 // CHECK:STDOUT: %C.ref.loc9_23: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -145,8 +154,8 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: fn @Op.1[@impl.%self.loc9_9.2: C]() -> @impl.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc10_14 to @impl.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -155,10 +164,10 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: fn @TestOp(%a: C) -> %return: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Op] -// CHECK:STDOUT: %.loc15_10.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc15: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc14: ref C = splice_block %return {} -// CHECK:STDOUT: %.loc15_10.2: init C = call %.loc15_10.1(%a.ref) to %.loc14 -// CHECK:STDOUT: return %.loc15_10.2 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc15(%a.ref) to %.loc14 +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/bit_or.carbon b/toolchain/check/testdata/operators/overloaded/bit_or.carbon index 622df50185c6..b9df8b8acb12 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_or.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_or.carbon @@ -47,13 +47,18 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @BitOr [template] // CHECK:STDOUT: %Self.1: BitOr = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @BitOr, [template] -// CHECK:STDOUT: %.3: in BitOr> = assoc_entity element0, @BitOr.%Op [template] -// CHECK:STDOUT: %.4: type = interface_type @BitOrAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @BitOr, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @BitOr.%Op.decl [template] +// CHECK:STDOUT: %.5: type = interface_type @BitOrAssign [template] // CHECK:STDOUT: %Self.2: BitOrAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.6: type = assoc_entity_type @BitOrAssign, [template] -// CHECK:STDOUT: %.7: in BitOrAssign> = assoc_entity element0, @BitOrAssign.%Op [template] +// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @BitOrAssign, Op [template] +// CHECK:STDOUT: %.8: = assoc_entity element0, @BitOrAssign.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,12 +67,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .BitOrAssign = %BitOrAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %BitOr.decl: type = interface_decl @BitOr [template = constants.%.1] {} -// CHECK:STDOUT: %BitOrAssign.decl: type = interface_decl @BitOrAssign [template = constants.%.4] {} +// CHECK:STDOUT: %BitOrAssign.decl: type = interface_decl @BitOrAssign [template = constants.%.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitOr { // CHECK:STDOUT: %Self: BitOr = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc5_15: BitOr = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self.1] @@ -83,21 +88,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in BitOr> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitOrAssign { // CHECK:STDOUT: %Self: BitOrAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_20: BitOrAssign = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.1: type = facet_type_access %Self.ref.loc8_20 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.2: type = converted %Self.ref.loc8_20, %.loc8_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.6] // CHECK:STDOUT: %self.loc8_14.1: Self* = param self // CHECK:STDOUT: %self.loc8_14.3: Self* = bind_name self, %self.loc8_14.1 // CHECK:STDOUT: %.loc8_9: Self* = addr_pattern %self.loc8_14.3 @@ -107,12 +112,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc8_27.1: Self = param other // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_39: in BitOrAssign> = assoc_entity element0, %Op [template = constants.%.7] +// CHECK:STDOUT: %.loc8_39: = assoc_entity element0, %Op.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@BitOr.%self.loc5_9.2: Self](@BitOr.%other.loc5_21.2: Self) -> Self; @@ -126,51 +131,63 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @BitOr [template] // CHECK:STDOUT: %Self.1: BitOr = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %.6: type = interface_type @BitOrAssign [template] // CHECK:STDOUT: %Self.2: BitOrAssign = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.7: type = ptr_type C [template] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] // CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.9: = interface_witness (@impl.2.%Op) [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @BitOr, [template] -// CHECK:STDOUT: %.11: in BitOr> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %.12: type = assoc_entity_type @BitOrAssign, [template] -// CHECK:STDOUT: %.13: in BitOrAssign> = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.5: Op = struct_value () [template] +// CHECK:STDOUT: %.9: = interface_witness (%struct.4) [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.6: TestOp = struct_value () [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @BitOr, Op [template] +// CHECK:STDOUT: %.11: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestAssign: type = fn_type @TestAssign [template] +// CHECK:STDOUT: %struct.7: TestAssign = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @BitOrAssign, Op [template] +// CHECK:STDOUT: %.13: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp -// CHECK:STDOUT: .TestAssign = %TestAssign +// CHECK:STDOUT: .TestOp = %TestOp.decl +// CHECK:STDOUT: .TestAssign = %TestAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in BitOr> = import_ref ir2, inst+21, loc_82 [template = constants.%.11] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+24, loc_82 [template = constants.%.11] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+19, loc_19 [template = imports.%Op.1] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+19, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitOr.decl: type = interface_decl @BitOr [template = constants.%.2] {} // CHECK:STDOUT: %BitOr.ref: type = name_ref BitOr, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+23, loc_46 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.6: in BitOrAssign> = import_ref ir2, inst+42, loc_101 [template = constants.%.13] -// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+25, unloaded -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+40, loc_47 [template = imports.%Op.2] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+26, loc_46 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+47, loc_101 [template = constants.%.13] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+28, unloaded +// CHECK:STDOUT: %import_ref.8: Op = import_ref ir2, inst+43, loc_47 [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitOrAssign.decl: type = interface_decl @BitOrAssign [template = constants.%.6] {} // CHECK:STDOUT: %BitOrAssign.ref: type = name_ref BitOrAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc17_14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc17_11.1: C = param a // CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc17_11.1 @@ -182,7 +199,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_82 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { +// CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { // CHECK:STDOUT: %C.ref.loc21_18: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %.loc21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %a.loc21_15.1: C* = param a @@ -191,8 +208,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %b.loc21_22.1: C = param b // CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc21_22.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+23, loc_101 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+40, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+26, loc_101 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+43, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitOr { @@ -210,7 +227,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as BitOr { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_9.1: C = param self // CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 @@ -220,15 +237,15 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as BitOrAssign { -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc14_21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %self.loc14_14.1: C* = param self @@ -238,10 +255,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc14_24.1: C = param other // CHECK:STDOUT: %other.loc14_24.2: C = bind_name other, %other.loc14_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.9] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,8 +270,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc9_9.2: C](@impl.1.%other.loc9_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc10_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -271,11 +288,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] -// CHECK:STDOUT: %.loc18_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc17: ref C = splice_block %return {} -// CHECK:STDOUT: %.loc18_12.2: init C = call %.loc18_12.1(%a.ref, %b.ref) to %.loc17 -// CHECK:STDOUT: return %.loc18_12.2 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc18(%a.ref, %b.ref) to %.loc17 +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { @@ -283,10 +300,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C* = name_ref a, %a // CHECK:STDOUT: %.loc22_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] -// CHECK:STDOUT: %.loc22_6.1: = bound_method %.loc22_3.1, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_6: = bound_method %.loc22_3.1, %.1 // CHECK:STDOUT: %.loc22_3.2: C* = addr_of %.loc22_3.1 -// CHECK:STDOUT: %.loc22_6.2: init () = call %.loc22_6.1(%.loc22_3.2, %b.ref) +// CHECK:STDOUT: %Op.call: init () = call %.loc22_6(%.loc22_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/bit_xor.carbon b/toolchain/check/testdata/operators/overloaded/bit_xor.carbon index cc97b368fa13..520110234b38 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_xor.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_xor.carbon @@ -47,13 +47,18 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @BitXor [template] // CHECK:STDOUT: %Self.1: BitXor = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @BitXor, [template] -// CHECK:STDOUT: %.3: in BitXor> = assoc_entity element0, @BitXor.%Op [template] -// CHECK:STDOUT: %.4: type = interface_type @BitXorAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @BitXor, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @BitXor.%Op.decl [template] +// CHECK:STDOUT: %.5: type = interface_type @BitXorAssign [template] // CHECK:STDOUT: %Self.2: BitXorAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.6: type = assoc_entity_type @BitXorAssign, [template] -// CHECK:STDOUT: %.7: in BitXorAssign> = assoc_entity element0, @BitXorAssign.%Op [template] +// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @BitXorAssign, Op [template] +// CHECK:STDOUT: %.8: = assoc_entity element0, @BitXorAssign.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,12 +67,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .BitXorAssign = %BitXorAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %BitXor.decl: type = interface_decl @BitXor [template = constants.%.1] {} -// CHECK:STDOUT: %BitXorAssign.decl: type = interface_decl @BitXorAssign [template = constants.%.4] {} +// CHECK:STDOUT: %BitXorAssign.decl: type = interface_decl @BitXorAssign [template = constants.%.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitXor { // CHECK:STDOUT: %Self: BitXor = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc5_15: BitXor = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self.1] @@ -83,21 +88,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in BitXor> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitXorAssign { // CHECK:STDOUT: %Self: BitXorAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_20: BitXorAssign = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.1: type = facet_type_access %Self.ref.loc8_20 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.2: type = converted %Self.ref.loc8_20, %.loc8_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.6] // CHECK:STDOUT: %self.loc8_14.1: Self* = param self // CHECK:STDOUT: %self.loc8_14.3: Self* = bind_name self, %self.loc8_14.1 // CHECK:STDOUT: %.loc8_9: Self* = addr_pattern %self.loc8_14.3 @@ -107,12 +112,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc8_27.1: Self = param other // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_39: in BitXorAssign> = assoc_entity element0, %Op [template = constants.%.7] +// CHECK:STDOUT: %.loc8_39: = assoc_entity element0, %Op.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@BitXor.%self.loc5_9.2: Self](@BitXor.%other.loc5_21.2: Self) -> Self; @@ -126,51 +131,63 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @BitXor [template] // CHECK:STDOUT: %Self.1: BitXor = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %.6: type = interface_type @BitXorAssign [template] // CHECK:STDOUT: %Self.2: BitXorAssign = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.7: type = ptr_type C [template] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] // CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.9: = interface_witness (@impl.2.%Op) [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @BitXor, [template] -// CHECK:STDOUT: %.11: in BitXor> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %.12: type = assoc_entity_type @BitXorAssign, [template] -// CHECK:STDOUT: %.13: in BitXorAssign> = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.5: Op = struct_value () [template] +// CHECK:STDOUT: %.9: = interface_witness (%struct.4) [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.6: TestOp = struct_value () [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @BitXor, Op [template] +// CHECK:STDOUT: %.11: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestAssign: type = fn_type @TestAssign [template] +// CHECK:STDOUT: %struct.7: TestAssign = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @BitXorAssign, Op [template] +// CHECK:STDOUT: %.13: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp -// CHECK:STDOUT: .TestAssign = %TestAssign +// CHECK:STDOUT: .TestOp = %TestOp.decl +// CHECK:STDOUT: .TestAssign = %TestAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in BitXor> = import_ref ir2, inst+21, loc_82 [template = constants.%.11] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+24, loc_82 [template = constants.%.11] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+19, loc_19 [template = imports.%Op.1] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+19, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitXor.decl: type = interface_decl @BitXor [template = constants.%.2] {} // CHECK:STDOUT: %BitXor.ref: type = name_ref BitXor, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+23, loc_46 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.6: in BitXorAssign> = import_ref ir2, inst+42, loc_101 [template = constants.%.13] -// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+25, unloaded -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+40, loc_47 [template = imports.%Op.2] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+26, loc_46 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+47, loc_101 [template = constants.%.13] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+28, unloaded +// CHECK:STDOUT: %import_ref.8: Op = import_ref ir2, inst+43, loc_47 [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitXorAssign.decl: type = interface_decl @BitXorAssign [template = constants.%.6] {} // CHECK:STDOUT: %BitXorAssign.ref: type = name_ref BitXorAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc17_14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc17_11.1: C = param a // CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc17_11.1 @@ -182,7 +199,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_82 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { +// CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { // CHECK:STDOUT: %C.ref.loc21_18: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %.loc21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %a.loc21_15.1: C* = param a @@ -191,8 +208,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %b.loc21_22.1: C = param b // CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc21_22.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+23, loc_101 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+40, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+26, loc_101 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+43, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitXor { @@ -210,7 +227,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as BitXor { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_9.1: C = param self // CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 @@ -220,15 +237,15 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as BitXorAssign { -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc14_21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %self.loc14_14.1: C* = param self @@ -238,10 +255,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc14_24.1: C = param other // CHECK:STDOUT: %other.loc14_24.2: C = bind_name other, %other.loc14_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.9] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,8 +270,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc9_9.2: C](@impl.1.%other.loc9_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc10_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -271,11 +288,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] -// CHECK:STDOUT: %.loc18_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc17: ref C = splice_block %return {} -// CHECK:STDOUT: %.loc18_12.2: init C = call %.loc18_12.1(%a.ref, %b.ref) to %.loc17 -// CHECK:STDOUT: return %.loc18_12.2 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc18(%a.ref, %b.ref) to %.loc17 +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { @@ -283,10 +300,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C* = name_ref a, %a // CHECK:STDOUT: %.loc22_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] -// CHECK:STDOUT: %.loc22_6.1: = bound_method %.loc22_3.1, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_6: = bound_method %.loc22_3.1, %.1 // CHECK:STDOUT: %.loc22_3.2: C* = addr_of %.loc22_3.1 -// CHECK:STDOUT: %.loc22_6.2: init () = call %.loc22_6.1(%.loc22_3.2, %b.ref) +// CHECK:STDOUT: %Op.call: init () = call %.loc22_6(%.loc22_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/dec.carbon b/toolchain/check/testdata/operators/overloaded/dec.carbon index 3c9d00fad558..22e708beaf0e 100644 --- a/toolchain/check/testdata/operators/overloaded/dec.carbon +++ b/toolchain/check/testdata/operators/overloaded/dec.carbon @@ -37,8 +37,11 @@ fn TestOp() { // CHECK:STDOUT: %.1: type = interface_type @Dec [template] // CHECK:STDOUT: %Self: Dec = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.2: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.3: type = assoc_entity_type @Dec, [template] -// CHECK:STDOUT: %.4: in Dec> = assoc_entity element0, @Dec.%Op [template] +// CHECK:STDOUT: %Op: type = fn_type @Op [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Op = struct_value () [template] +// CHECK:STDOUT: %.4: type = assoc_entity_type @Dec, Op [template] +// CHECK:STDOUT: %.5: = assoc_entity element0, @Dec.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -50,7 +53,7 @@ fn TestOp() { // CHECK:STDOUT: // CHECK:STDOUT: interface @Dec { // CHECK:STDOUT: %Self: Dec = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %Op: = fn_decl @Op [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op [template = constants.%struct] { // CHECK:STDOUT: %Self.ref: Dec = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc5_24.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] // CHECK:STDOUT: %.loc5_24.2: type = converted %Self.ref, %.loc5_24.1 [symbolic = constants.%Self] @@ -59,12 +62,12 @@ fn TestOp() { // CHECK:STDOUT: %self.loc5_14.3: Self* = bind_name self, %self.loc5_14.1 // CHECK:STDOUT: %.loc5_9: Self* = addr_pattern %self.loc5_14.3 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_28: in Dec> = assoc_entity element0, %Op [template = constants.%.4] +// CHECK:STDOUT: %.loc5_28: = assoc_entity element0, %Op.decl [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_28 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op[addr @Dec.%self.loc5_14.3: Self*](); @@ -77,34 +80,40 @@ fn TestOp() { // CHECK:STDOUT: %.2: type = interface_type @Dec [template] // CHECK:STDOUT: %Self: Dec = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.3: type = ptr_type C [template] -// CHECK:STDOUT: %.4: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.5: = interface_witness (@impl.%Op) [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.6: = interface_witness (%struct.1) [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.3: TestOp = struct_value () [template] // CHECK:STDOUT: %.7: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] -// CHECK:STDOUT: %.8: type = assoc_entity_type @Dec, [template] -// CHECK:STDOUT: %.9: in Dec> = assoc_entity element0, file.%import_ref.6 [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] +// CHECK:STDOUT: %.8: type = assoc_entity_type @Dec, Op [template] +// CHECK:STDOUT: %.9: = assoc_entity element0, file.%import_ref.6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp +// CHECK:STDOUT: .TestOp = %TestOp.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in Dec> = import_ref ir2, inst+15, loc_47 [template = constants.%.9] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+18, loc_47 [template = constants.%.9] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+13, loc_19 [template = imports.%Op] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+13, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Dec.decl: type = interface_decl @Dec [template = constants.%.2] {} // CHECK:STDOUT: %Dec.ref: type = name_ref Dec, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] {} +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.3] {} // CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+1, loc_47 [template = constants.%.2] // CHECK:STDOUT: %import_ref.6 = import_ref ir2, inst+13, unloaded // CHECK:STDOUT: } @@ -117,17 +126,17 @@ fn TestOp() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Dec { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc9_21: type = ptr_type C [template = constants.%.3] // CHECK:STDOUT: %self.loc9_14.1: C* = param self // CHECK:STDOUT: %self.loc9_14.3: C* = bind_name self, %self.loc9_14.1 // CHECK:STDOUT: %.loc9_9: C* = addr_pattern %self.loc9_14.3 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -146,14 +155,14 @@ fn TestOp() { // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var // CHECK:STDOUT: %.loc13_15.1: {} = struct_literal () -// CHECK:STDOUT: %.loc13_15.2: init C = class_init (), %c.var [template = constants.%struct] -// CHECK:STDOUT: %.loc13_16: init C = converted %.loc13_15.1, %.loc13_15.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc13_15.2: init C = class_init (), %c.var [template = constants.%struct.4] +// CHECK:STDOUT: %.loc13_16: init C = converted %.loc13_15.1, %.loc13_15.2 [template = constants.%struct.4] // CHECK:STDOUT: assign %c.var, %.loc13_16 // CHECK:STDOUT: %c.ref: ref C = name_ref c, %c -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Op] -// CHECK:STDOUT: %.loc14_3.1: = bound_method %c.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc14_3: = bound_method %c.ref, %.1 // CHECK:STDOUT: %.loc14_5: C* = addr_of %c.ref -// CHECK:STDOUT: %.loc14_3.2: init () = call %.loc14_3.1(%.loc14_5) +// CHECK:STDOUT: %Op.call: init () = call %.loc14_3(%.loc14_5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/div.carbon b/toolchain/check/testdata/operators/overloaded/div.carbon index 0a299c5ba543..b96e8034458f 100644 --- a/toolchain/check/testdata/operators/overloaded/div.carbon +++ b/toolchain/check/testdata/operators/overloaded/div.carbon @@ -47,13 +47,18 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Div [template] // CHECK:STDOUT: %Self.1: Div = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Div, [template] -// CHECK:STDOUT: %.3: in Div> = assoc_entity element0, @Div.%Op [template] -// CHECK:STDOUT: %.4: type = interface_type @DivAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Div, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Div.%Op.decl [template] +// CHECK:STDOUT: %.5: type = interface_type @DivAssign [template] // CHECK:STDOUT: %Self.2: DivAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.6: type = assoc_entity_type @DivAssign, [template] -// CHECK:STDOUT: %.7: in DivAssign> = assoc_entity element0, @DivAssign.%Op [template] +// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @DivAssign, Op [template] +// CHECK:STDOUT: %.8: = assoc_entity element0, @DivAssign.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,12 +67,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .DivAssign = %DivAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Div.decl: type = interface_decl @Div [template = constants.%.1] {} -// CHECK:STDOUT: %DivAssign.decl: type = interface_decl @DivAssign [template = constants.%.4] {} +// CHECK:STDOUT: %DivAssign.decl: type = interface_decl @DivAssign [template = constants.%.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Div { // CHECK:STDOUT: %Self: Div = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc5_15: Div = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self.1] @@ -83,21 +88,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in Div> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @DivAssign { // CHECK:STDOUT: %Self: DivAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_20: DivAssign = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.1: type = facet_type_access %Self.ref.loc8_20 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.2: type = converted %Self.ref.loc8_20, %.loc8_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.6] // CHECK:STDOUT: %self.loc8_14.1: Self* = param self // CHECK:STDOUT: %self.loc8_14.3: Self* = bind_name self, %self.loc8_14.1 // CHECK:STDOUT: %.loc8_9: Self* = addr_pattern %self.loc8_14.3 @@ -107,12 +112,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc8_27.1: Self = param other // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_39: in DivAssign> = assoc_entity element0, %Op [template = constants.%.7] +// CHECK:STDOUT: %.loc8_39: = assoc_entity element0, %Op.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@Div.%self.loc5_9.2: Self](@Div.%other.loc5_21.2: Self) -> Self; @@ -126,51 +131,63 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Div [template] // CHECK:STDOUT: %Self.1: Div = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %.6: type = interface_type @DivAssign [template] // CHECK:STDOUT: %Self.2: DivAssign = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.7: type = ptr_type C [template] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] // CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.9: = interface_witness (@impl.2.%Op) [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @Div, [template] -// CHECK:STDOUT: %.11: in Div> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %.12: type = assoc_entity_type @DivAssign, [template] -// CHECK:STDOUT: %.13: in DivAssign> = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.5: Op = struct_value () [template] +// CHECK:STDOUT: %.9: = interface_witness (%struct.4) [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.6: TestOp = struct_value () [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @Div, Op [template] +// CHECK:STDOUT: %.11: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestAssign: type = fn_type @TestAssign [template] +// CHECK:STDOUT: %struct.7: TestAssign = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @DivAssign, Op [template] +// CHECK:STDOUT: %.13: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp -// CHECK:STDOUT: .TestAssign = %TestAssign +// CHECK:STDOUT: .TestOp = %TestOp.decl +// CHECK:STDOUT: .TestAssign = %TestAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in Div> = import_ref ir2, inst+21, loc_82 [template = constants.%.11] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+24, loc_82 [template = constants.%.11] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+19, loc_19 [template = imports.%Op.1] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+19, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Div.decl: type = interface_decl @Div [template = constants.%.2] {} // CHECK:STDOUT: %Div.ref: type = name_ref Div, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+23, loc_46 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.6: in DivAssign> = import_ref ir2, inst+42, loc_101 [template = constants.%.13] -// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+25, unloaded -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+40, loc_47 [template = imports.%Op.2] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+26, loc_46 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+47, loc_101 [template = constants.%.13] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+28, unloaded +// CHECK:STDOUT: %import_ref.8: Op = import_ref ir2, inst+43, loc_47 [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %DivAssign.decl: type = interface_decl @DivAssign [template = constants.%.6] {} // CHECK:STDOUT: %DivAssign.ref: type = name_ref DivAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc17_14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc17_11.1: C = param a // CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc17_11.1 @@ -182,7 +199,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_82 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { +// CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { // CHECK:STDOUT: %C.ref.loc21_18: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %.loc21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %a.loc21_15.1: C* = param a @@ -191,8 +208,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %b.loc21_22.1: C = param b // CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc21_22.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+23, loc_101 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+40, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+26, loc_101 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+43, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Div { @@ -210,7 +227,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Div { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_9.1: C = param self // CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 @@ -220,15 +237,15 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as DivAssign { -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc14_21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %self.loc14_14.1: C* = param self @@ -238,10 +255,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc14_24.1: C = param other // CHECK:STDOUT: %other.loc14_24.2: C = bind_name other, %other.loc14_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.9] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,8 +270,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc9_9.2: C](@impl.1.%other.loc9_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc10_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -271,11 +288,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] -// CHECK:STDOUT: %.loc18_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc17: ref C = splice_block %return {} -// CHECK:STDOUT: %.loc18_12.2: init C = call %.loc18_12.1(%a.ref, %b.ref) to %.loc17 -// CHECK:STDOUT: return %.loc18_12.2 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc18(%a.ref, %b.ref) to %.loc17 +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { @@ -283,10 +300,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C* = name_ref a, %a // CHECK:STDOUT: %.loc22_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] -// CHECK:STDOUT: %.loc22_6.1: = bound_method %.loc22_3.1, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_6: = bound_method %.loc22_3.1, %.1 // CHECK:STDOUT: %.loc22_3.2: C* = addr_of %.loc22_3.1 -// CHECK:STDOUT: %.loc22_6.2: init () = call %.loc22_6.1(%.loc22_3.2, %b.ref) +// CHECK:STDOUT: %Op.call: init () = call %.loc22_6(%.loc22_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/eq.carbon b/toolchain/check/testdata/operators/overloaded/eq.carbon index 08181577a883..f73355638137 100644 --- a/toolchain/check/testdata/operators/overloaded/eq.carbon +++ b/toolchain/check/testdata/operators/overloaded/eq.carbon @@ -97,9 +97,15 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Eq [template] // CHECK:STDOUT: %Self: Eq = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Eq, [template] -// CHECK:STDOUT: %.3: in Eq> = assoc_entity element0, @Eq.%Equal [template] -// CHECK:STDOUT: %.4: in Eq> = assoc_entity element1, @Eq.%NotEqual [template] +// CHECK:STDOUT: %Equal: type = fn_type @Equal [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Equal = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Eq, Equal [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Eq.%Equal.decl [template] +// CHECK:STDOUT: %NotEqual: type = fn_type @NotEqual [template] +// CHECK:STDOUT: %struct.2: NotEqual = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @Eq, NotEqual [template] +// CHECK:STDOUT: %.6: = assoc_entity element1, @Eq.%NotEqual.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -111,7 +117,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: interface @Eq { // CHECK:STDOUT: %Self: Eq = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %Equal: = fn_decl @Equal [template] { +// CHECK:STDOUT: %Equal.decl: Equal = fn_decl @Equal [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc7_18: Eq = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc7_18.1: type = facet_type_access %Self.ref.loc7_18 [symbolic = constants.%Self] // CHECK:STDOUT: %.loc7_18.2: type = converted %Self.ref.loc7_18, %.loc7_18.1 [symbolic = constants.%Self] @@ -124,8 +130,8 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %other.loc7_24.2: Self = bind_name other, %other.loc7_24.1 // CHECK:STDOUT: %return.var.loc7: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc7_44: in Eq> = assoc_entity element0, %Equal [template = constants.%.3] -// CHECK:STDOUT: %NotEqual: = fn_decl @NotEqual [template] { +// CHECK:STDOUT: %.loc7_44: = assoc_entity element0, %Equal.decl [template = constants.%.4] +// CHECK:STDOUT: %NotEqual.decl: NotEqual = fn_decl @NotEqual [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_21: Eq = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc8_21.1: type = facet_type_access %Self.ref.loc8_21 [symbolic = constants.%Self] // CHECK:STDOUT: %.loc8_21.2: type = converted %Self.ref.loc8_21, %.loc8_21.1 [symbolic = constants.%Self] @@ -138,13 +144,13 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: %return.var.loc8: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_47: in Eq> = assoc_entity element1, %NotEqual [template = constants.%.4] +// CHECK:STDOUT: %.loc8_47: = assoc_entity element1, %NotEqual.decl [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Equal = %.loc7_44 // CHECK:STDOUT: .NotEqual = %.loc8_47 -// CHECK:STDOUT: witness = (%Equal, %NotEqual) +// CHECK:STDOUT: witness = (%Equal.decl, %NotEqual.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Equal[@Eq.%self.loc7_12.2: Self](@Eq.%other.loc7_24.2: Self) -> bool; @@ -158,36 +164,49 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Eq [template] // CHECK:STDOUT: %Self: Eq = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.%Equal, @impl.%NotEqual) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Equal.1: type = fn_type @Equal.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Equal = struct_value () [template] +// CHECK:STDOUT: %NotEqual.1: type = fn_type @NotEqual.1 [template] +// CHECK:STDOUT: %struct.2: NotEqual = struct_value () [template] +// CHECK:STDOUT: %Equal.2: type = fn_type @Equal.2 [template] +// CHECK:STDOUT: %struct.3: Equal = struct_value () [template] +// CHECK:STDOUT: %NotEqual.2: type = fn_type @NotEqual.2 [template] +// CHECK:STDOUT: %struct.4: NotEqual = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1, %struct.2) [template] +// CHECK:STDOUT: %TestEqual: type = fn_type @TestEqual [template] +// CHECK:STDOUT: %struct.5: TestEqual = struct_value () [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %.6: type = assoc_entity_type @Eq, [template] -// CHECK:STDOUT: %.7: in Eq> = assoc_entity element0, file.%import_ref.8 [template] -// CHECK:STDOUT: %.8: in Eq> = assoc_entity element1, file.%import_ref.10 [template] +// CHECK:STDOUT: %.6: type = assoc_entity_type @Eq, Equal [template] +// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.8 [template] +// CHECK:STDOUT: %TestNotEqual: type = fn_type @TestNotEqual [template] +// CHECK:STDOUT: %struct.6: TestNotEqual = struct_value () [template] +// CHECK:STDOUT: %.8: type = assoc_entity_type @Eq, NotEqual [template] +// CHECK:STDOUT: %.9: = assoc_entity element1, file.%import_ref.10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestEqual = %TestEqual -// CHECK:STDOUT: .TestNotEqual = %TestNotEqual +// CHECK:STDOUT: .TestEqual = %TestEqual.decl +// CHECK:STDOUT: .TestNotEqual = %TestNotEqual.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] // CHECK:STDOUT: %import_ref.2 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.3: in Eq> = import_ref ir2, inst+18, loc_68 [template = constants.%.7] -// CHECK:STDOUT: %import_ref.4: in Eq> = import_ref ir2, inst+32, loc_88 [template = constants.%.8] -// CHECK:STDOUT: %import_ref.5: = import_ref ir2, inst+16, loc_19 [template = imports.%Equal] -// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+31, loc_19 [template = imports.%NotEqual] +// CHECK:STDOUT: %import_ref.3: = import_ref ir2, inst+21, loc_68 [template = constants.%.7] +// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+38, loc_88 [template = constants.%.9] +// CHECK:STDOUT: %import_ref.5: Equal = import_ref ir2, inst+16, loc_19 [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.6: NotEqual = import_ref ir2, inst+34, loc_19 [template = constants.%struct.4] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Eq.decl: type = interface_decl @Eq [template = constants.%.2] {} // CHECK:STDOUT: %Eq.ref: type = name_ref Eq, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestEqual: = fn_decl @TestEqual [template] { +// CHECK:STDOUT: %TestEqual.decl: TestEqual = fn_decl @TestEqual [template = constants.%struct.5] { // CHECK:STDOUT: %C.ref.loc13_17: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc13_14.1: C = param a // CHECK:STDOUT: @TestEqual.%a: C = bind_name a, %a.loc13_14.1 @@ -198,7 +217,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.7: type = import_ref ir2, inst+1, loc_68 [template = constants.%.2] // CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+16, unloaded -// CHECK:STDOUT: %TestNotEqual: = fn_decl @TestNotEqual [template] { +// CHECK:STDOUT: %TestNotEqual.decl: TestNotEqual = fn_decl @TestNotEqual [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc17_20: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc17_17.1: C = param a // CHECK:STDOUT: @TestNotEqual.%a: C = bind_name a, %a.loc17_17.1 @@ -208,7 +227,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: @TestNotEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_88 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+31, unloaded +// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+34, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Eq { @@ -220,7 +239,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Eq { -// CHECK:STDOUT: %Equal: = fn_decl @Equal.1 [template] { +// CHECK:STDOUT: %Equal.decl: Equal = fn_decl @Equal.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_18: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_12.1: C = param self // CHECK:STDOUT: %self.loc9_12.2: C = bind_name self, %self.loc9_12.1 @@ -229,7 +248,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %other.loc9_21.2: C = bind_name other, %other.loc9_21.1 // CHECK:STDOUT: %return.var.loc9: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %NotEqual: = fn_decl @NotEqual.1 [template] { +// CHECK:STDOUT: %NotEqual.decl: NotEqual = fn_decl @NotEqual.1 [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref.loc10_21: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc10_15.1: C = param self // CHECK:STDOUT: %self.loc10_15.2: C = bind_name self, %self.loc10_15.1 @@ -238,11 +257,11 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %other.loc10_24.2: C = bind_name other, %other.loc10_24.1 // CHECK:STDOUT: %return.var.loc10: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Equal, %NotEqual) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Equal.decl, %NotEqual.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Equal = %Equal -// CHECK:STDOUT: .NotEqual = %NotEqual +// CHECK:STDOUT: .Equal = %Equal.decl +// CHECK:STDOUT: .NotEqual = %NotEqual.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -263,11 +282,11 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Equal] -// CHECK:STDOUT: %.loc14_12.1: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc14_12.2: init bool = call %.loc14_12.1(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc14_16.1: bool = value_of_initializer %.loc14_12.2 -// CHECK:STDOUT: %.loc14_16.2: bool = converted %.loc14_12.2, %.loc14_16.1 +// CHECK:STDOUT: %.1: Equal = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc14_12: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %Equal.call: init bool = call %.loc14_12(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc14_16.1: bool = value_of_initializer %Equal.call +// CHECK:STDOUT: %.loc14_16.2: bool = converted %Equal.call, %.loc14_16.1 // CHECK:STDOUT: return %.loc14_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -275,11 +294,11 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element1 [template = @impl.%NotEqual] -// CHECK:STDOUT: %.loc18_12.1: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc18_12.2: init bool = call %.loc18_12.1(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc18_16.1: bool = value_of_initializer %.loc18_12.2 -// CHECK:STDOUT: %.loc18_16.2: bool = converted %.loc18_12.2, %.loc18_16.1 +// CHECK:STDOUT: %.1: NotEqual = interface_witness_access @impl.%.1, element1 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc18_12: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %NotEqual.call: init bool = call %.loc18_12(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc18_16.1: bool = value_of_initializer %NotEqual.call +// CHECK:STDOUT: %.loc18_16.2: bool = converted %NotEqual.call, %.loc18_16.1 // CHECK:STDOUT: return %.loc18_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -288,25 +307,34 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: constants { // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %TestEqual: type = fn_type @TestEqual [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: TestEqual = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = interface_type @Eq [template] // CHECK:STDOUT: %Self: Eq = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = assoc_entity_type @Eq, [template] -// CHECK:STDOUT: %.6: in Eq> = assoc_entity element0, file.%import_ref.7 [template] -// CHECK:STDOUT: %.7: in Eq> = assoc_entity element1, file.%import_ref.9 [template] +// CHECK:STDOUT: %Equal: type = fn_type @Equal [template] +// CHECK:STDOUT: %struct.2: Equal = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @Eq, Equal [template] +// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.7 [template] +// CHECK:STDOUT: %TestNotEqual: type = fn_type @TestNotEqual [template] +// CHECK:STDOUT: %struct.3: TestNotEqual = struct_value () [template] +// CHECK:STDOUT: %NotEqual: type = fn_type @NotEqual [template] +// CHECK:STDOUT: %struct.4: NotEqual = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @Eq, NotEqual [template] +// CHECK:STDOUT: %.8: = assoc_entity element1, file.%import_ref.9 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl -// CHECK:STDOUT: .TestEqual = %TestEqual -// CHECK:STDOUT: .TestNotEqual = %TestNotEqual +// CHECK:STDOUT: .TestEqual = %TestEqual.decl +// CHECK:STDOUT: .TestNotEqual = %TestNotEqual.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} -// CHECK:STDOUT: %TestEqual: = fn_decl @TestEqual [template] { +// CHECK:STDOUT: %TestEqual.decl: TestEqual = fn_decl @TestEqual [template = constants.%struct.1] { // CHECK:STDOUT: %D.ref.loc8_17: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc8_14.1: D = param a // CHECK:STDOUT: @TestEqual.%a: D = bind_name a, %a.loc8_14.1 @@ -317,12 +345,12 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_30 [template = constants.%.4] // CHECK:STDOUT: %import_ref.2 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.3: in Eq> = import_ref ir2, inst+18, loc_30 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.4: in Eq> = import_ref ir2, inst+32, loc_50 [template = constants.%.7] +// CHECK:STDOUT: %import_ref.3: = import_ref ir2, inst+21, loc_30 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+38, loc_50 [template = constants.%.8] // CHECK:STDOUT: %import_ref.5 = import_ref ir2, inst+16, unloaded -// CHECK:STDOUT: %import_ref.6 = import_ref ir2, inst+31, unloaded +// CHECK:STDOUT: %import_ref.6 = import_ref ir2, inst+34, unloaded // CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+16, unloaded -// CHECK:STDOUT: %TestNotEqual: = fn_decl @TestNotEqual [template] { +// CHECK:STDOUT: %TestNotEqual.decl: TestNotEqual = fn_decl @TestNotEqual [template = constants.%struct.3] { // CHECK:STDOUT: %D.ref.loc16_20: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc16_17.1: D = param a // CHECK:STDOUT: @TestNotEqual.%a: D = bind_name a, %a.loc16_17.1 @@ -332,7 +360,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: @TestNotEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.8: type = import_ref ir2, inst+1, loc_50 [template = constants.%.4] -// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+31, unloaded +// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+34, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Eq { @@ -356,6 +384,8 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Equal[%self: Self](%other: Self) -> bool; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TestNotEqual(%a: D, %b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: D = name_ref a, %a @@ -363,6 +393,8 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @NotEqual[%self: Self](%other: Self) -> bool; +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_no_impl_for_args.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -371,12 +403,25 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %.2: type = interface_type @Eq [template] // CHECK:STDOUT: %Self: Eq = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.%Equal, @impl.%NotEqual) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Equal.1: type = fn_type @Equal.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Equal = struct_value () [template] +// CHECK:STDOUT: %NotEqual.1: type = fn_type @NotEqual.1 [template] +// CHECK:STDOUT: %struct.2: NotEqual = struct_value () [template] +// CHECK:STDOUT: %Equal.2: type = fn_type @Equal.2 [template] +// CHECK:STDOUT: %struct.3: Equal = struct_value () [template] +// CHECK:STDOUT: %NotEqual.2: type = fn_type @NotEqual.2 [template] +// CHECK:STDOUT: %struct.4: NotEqual = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1, %struct.2) [template] +// CHECK:STDOUT: %TestRhsBad: type = fn_type @TestRhsBad [template] +// CHECK:STDOUT: %struct.5: TestRhsBad = struct_value () [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %.6: type = assoc_entity_type @Eq, [template] -// CHECK:STDOUT: %.7: in Eq> = assoc_entity element0, file.%import_ref.8 [template] -// CHECK:STDOUT: %.8: in Eq> = assoc_entity element1, file.%import_ref.10 [template] +// CHECK:STDOUT: %.6: type = assoc_entity_type @Eq, Equal [template] +// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.8 [template] +// CHECK:STDOUT: %TestLhsBad: type = fn_type @TestLhsBad [template] +// CHECK:STDOUT: %struct.6: TestLhsBad = struct_value () [template] +// CHECK:STDOUT: %.8: type = assoc_entity_type @Eq, NotEqual [template] +// CHECK:STDOUT: %.9: = assoc_entity element1, file.%import_ref.10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -384,25 +429,25 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl -// CHECK:STDOUT: .TestRhsBad = %TestRhsBad -// CHECK:STDOUT: .TestLhsBad = %TestLhsBad +// CHECK:STDOUT: .TestRhsBad = %TestRhsBad.decl +// CHECK:STDOUT: .TestLhsBad = %TestLhsBad.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_23 [template = constants.%.2] // CHECK:STDOUT: %import_ref.2 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.3: in Eq> = import_ref ir2, inst+18, loc_73 [template = constants.%.7] -// CHECK:STDOUT: %import_ref.4: in Eq> = import_ref ir2, inst+32, loc_93 [template = constants.%.8] -// CHECK:STDOUT: %import_ref.5: = import_ref ir2, inst+16, loc_24 [template = imports.%Equal] -// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+31, loc_24 [template = imports.%NotEqual] +// CHECK:STDOUT: %import_ref.3: = import_ref ir2, inst+21, loc_73 [template = constants.%.7] +// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+38, loc_93 [template = constants.%.9] +// CHECK:STDOUT: %import_ref.5: Equal = import_ref ir2, inst+16, loc_24 [template = constants.%struct.3] +// CHECK:STDOUT: %import_ref.6: NotEqual = import_ref ir2, inst+34, loc_24 [template = constants.%struct.4] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc9: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Eq.decl: type = interface_decl @Eq [template = constants.%.2] {} // CHECK:STDOUT: %Eq.ref: type = name_ref Eq, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestRhsBad: = fn_decl @TestRhsBad [template] { +// CHECK:STDOUT: %TestRhsBad.decl: TestRhsBad = fn_decl @TestRhsBad [template = constants.%struct.5] { // CHECK:STDOUT: %C.ref.loc14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc14_15.1: C = param a // CHECK:STDOUT: @TestRhsBad.%a: C = bind_name a, %a.loc14_15.1 @@ -413,7 +458,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.7: type = import_ref ir2, inst+1, loc_73 [template = constants.%.2] // CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+16, unloaded -// CHECK:STDOUT: %TestLhsBad: = fn_decl @TestLhsBad [template] { +// CHECK:STDOUT: %TestLhsBad.decl: TestLhsBad = fn_decl @TestLhsBad [template = constants.%struct.6] { // CHECK:STDOUT: %D.ref.loc25: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc25_15.1: D = param a // CHECK:STDOUT: @TestLhsBad.%a: D = bind_name a, %a.loc25_15.1 @@ -423,7 +468,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: @TestLhsBad.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_93 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+31, unloaded +// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+34, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Eq { @@ -435,7 +480,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Eq { -// CHECK:STDOUT: %Equal: = fn_decl @Equal.1 [template] { +// CHECK:STDOUT: %Equal.decl: Equal = fn_decl @Equal.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc10_18: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc10_12.1: C = param self // CHECK:STDOUT: %self.loc10_12.2: C = bind_name self, %self.loc10_12.1 @@ -444,7 +489,7 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %other.loc10_21.2: C = bind_name other, %other.loc10_21.1 // CHECK:STDOUT: %return.var.loc10: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %NotEqual: = fn_decl @NotEqual.1 [template] { +// CHECK:STDOUT: %NotEqual.decl: NotEqual = fn_decl @NotEqual.1 [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref.loc11_21: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc11_15.1: C = param self // CHECK:STDOUT: %self.loc11_15.2: C = bind_name self, %self.loc11_15.1 @@ -453,11 +498,11 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: %other.loc11_24.2: C = bind_name other, %other.loc11_24.1 // CHECK:STDOUT: %return.var.loc11: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Equal, %NotEqual) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Equal.decl, %NotEqual.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Equal = %Equal -// CHECK:STDOUT: .NotEqual = %NotEqual +// CHECK:STDOUT: .Equal = %Equal.decl +// CHECK:STDOUT: .NotEqual = %NotEqual.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -483,11 +528,11 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: D = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Equal] -// CHECK:STDOUT: %.loc22_12.1: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc22_12.2: init bool = call %.loc22_12.1() [template = ] -// CHECK:STDOUT: %.loc22_16.1: bool = value_of_initializer %.loc22_12.2 [template = ] -// CHECK:STDOUT: %.loc22_16.2: bool = converted %.loc22_12.2, %.loc22_16.1 [template = ] +// CHECK:STDOUT: %.1: Equal = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc22_12: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %Equal.call: init bool = call %.loc22_12() [template = ] +// CHECK:STDOUT: %.loc22_16.1: bool = value_of_initializer %Equal.call [template = ] +// CHECK:STDOUT: %.loc22_16.2: bool = converted %Equal.call, %.loc22_16.1 [template = ] // CHECK:STDOUT: return %.loc22_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon index c2314ee65dde..116df9ae2fc8 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon @@ -57,13 +57,18 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %.1: type = interface_type @Inc [template] // CHECK:STDOUT: %Self.1: Inc = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.2: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.3: type = assoc_entity_type @Inc, [template] -// CHECK:STDOUT: %.4: in Inc> = assoc_entity element0, @Inc.%Op [template] -// CHECK:STDOUT: %.5: type = interface_type @AddAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.4: type = assoc_entity_type @Inc, Op [template] +// CHECK:STDOUT: %.5: = assoc_entity element0, @Inc.%Op.decl [template] +// CHECK:STDOUT: %.6: type = interface_type @AddAssign [template] // CHECK:STDOUT: %Self.2: AddAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.7: type = assoc_entity_type @AddAssign, [template] -// CHECK:STDOUT: %.8: in AddAssign> = assoc_entity element0, @AddAssign.%Op [template] +// CHECK:STDOUT: %.7: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.8: type = assoc_entity_type @AddAssign, Op [template] +// CHECK:STDOUT: %.9: = assoc_entity element0, @AddAssign.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -72,12 +77,12 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: .AddAssign = %AddAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Inc.decl: type = interface_decl @Inc [template = constants.%.1] {} -// CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.5] {} +// CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.6] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Inc { // CHECK:STDOUT: %Self: Inc = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: Inc = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_24.1: type = facet_type_access %Self.ref [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_24.2: type = converted %Self.ref, %.loc5_24.1 [symbolic = constants.%Self.1] @@ -86,21 +91,21 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %self.loc5_14.3: Self* = bind_name self, %self.loc5_14.1 // CHECK:STDOUT: %.loc5_9: Self* = addr_pattern %self.loc5_14.3 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_28: in Inc> = assoc_entity element0, %Op [template = constants.%.4] +// CHECK:STDOUT: %.loc5_28: = assoc_entity element0, %Op.decl [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_28 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @AddAssign { // CHECK:STDOUT: %Self: AddAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_20: AddAssign = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.1: type = facet_type_access %Self.ref.loc8_20 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.2: type = converted %Self.ref.loc8_20, %.loc8_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.6] +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.7] // CHECK:STDOUT: %self.loc8_14.1: Self* = param self // CHECK:STDOUT: %self.loc8_14.3: Self* = bind_name self, %self.loc8_14.1 // CHECK:STDOUT: %.loc8_9: Self* = addr_pattern %self.loc8_14.3 @@ -110,12 +115,12 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %other.loc8_27.1: Self = param other // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_39: in AddAssign> = assoc_entity element0, %Op [template = constants.%.8] +// CHECK:STDOUT: %.loc8_39: = assoc_entity element0, %Op.decl [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[addr @Inc.%self.loc5_14.3: Self*](); @@ -130,57 +135,69 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %.2: type = interface_type @Inc [template] // CHECK:STDOUT: %Self.1: Inc = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.3: type = ptr_type C [template] -// CHECK:STDOUT: %.4: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.5: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.6: type = interface_type @AddAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.6: = interface_witness (%struct.1) [template] +// CHECK:STDOUT: %.7: type = interface_type @AddAssign [template] // CHECK:STDOUT: %Self.2: AddAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.7: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.8: = interface_witness (@impl.2.%Op) [template] -// CHECK:STDOUT: %.9: type = tuple_type () [template] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.3: Op = struct_value () [template] +// CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] +// CHECK:STDOUT: %.9: = interface_witness (%struct.3) [template] +// CHECK:STDOUT: %TestIncNonRef: type = fn_type @TestIncNonRef [template] +// CHECK:STDOUT: %struct.5: TestIncNonRef = struct_value () [template] // CHECK:STDOUT: %.10: type = ptr_type {} [template] -// CHECK:STDOUT: %.11: type = assoc_entity_type @Inc, [template] -// CHECK:STDOUT: %.12: in Inc> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %.13: type = assoc_entity_type @AddAssign, [template] -// CHECK:STDOUT: %.14: in AddAssign> = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %.11: type = assoc_entity_type @Inc, Op [template] +// CHECK:STDOUT: %.12: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestAddAssignNonRef: type = fn_type @TestAddAssignNonRef [template] +// CHECK:STDOUT: %struct.6: TestAddAssignNonRef = struct_value () [template] +// CHECK:STDOUT: %.13: type = assoc_entity_type @AddAssign, Op [template] +// CHECK:STDOUT: %.14: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestIncNonRef = %TestIncNonRef -// CHECK:STDOUT: .TestAddAssignNonRef = %TestAddAssignNonRef +// CHECK:STDOUT: .TestIncNonRef = %TestIncNonRef.decl +// CHECK:STDOUT: .TestAddAssignNonRef = %TestAddAssignNonRef.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in Inc> = import_ref ir2, inst+15, loc_65 [template = constants.%.12] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+18, loc_65 [template = constants.%.12] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+13, loc_19 [template = imports.%Op.1] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+13, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Inc.decl: type = interface_decl @Inc [template = constants.%.2] {} // CHECK:STDOUT: %Inc.ref: type = name_ref Inc, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+17, loc_38 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.6: in AddAssign> = import_ref ir2, inst+36, loc_82 [template = constants.%.14] -// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+34, loc_39 [template = imports.%Op.2] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+20, loc_38 [template = constants.%.7] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+41, loc_82 [template = constants.%.14] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+22, unloaded +// CHECK:STDOUT: %import_ref.8: Op = import_ref ir2, inst+37, loc_39 [template = constants.%struct.4] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc11: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc11: = name_ref Core, %Core [template = %Core] -// CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.6] {} -// CHECK:STDOUT: %AddAssign.ref: type = name_ref AddAssign, %import_ref.5 [template = constants.%.6] +// CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.7] {} +// CHECK:STDOUT: %AddAssign.ref: type = name_ref AddAssign, %import_ref.5 [template = constants.%.7] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestIncNonRef: = fn_decl @TestIncNonRef [template] { +// CHECK:STDOUT: %TestIncNonRef.decl: TestIncNonRef = fn_decl @TestIncNonRef [template = constants.%struct.5] { // CHECK:STDOUT: %C.ref.loc15: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc15_18.1: C = param a // CHECK:STDOUT: @TestIncNonRef.%a: C = bind_name a, %a.loc15_18.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_65 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+13, unloaded -// CHECK:STDOUT: %TestAddAssignNonRef: = fn_decl @TestAddAssignNonRef [template] { +// CHECK:STDOUT: %TestAddAssignNonRef.decl: TestAddAssignNonRef = fn_decl @TestAddAssignNonRef [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc26_27: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc26_24.1: C = param a // CHECK:STDOUT: @TestAddAssignNonRef.%a: C = bind_name a, %a.loc26_24.1 @@ -188,8 +205,8 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %b.loc26_30.1: C = param b // CHECK:STDOUT: @TestAddAssignNonRef.%b: C = bind_name b, %b.loc26_30.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+17, loc_82 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+34, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+20, loc_82 [template = constants.%.7] +// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+37, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Inc { @@ -207,22 +224,22 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Inc { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc9_21: type = ptr_type C [template = constants.%.3] // CHECK:STDOUT: %self.loc9_14.1: C* = param self // CHECK:STDOUT: %self.loc9_14.3: C* = bind_name self, %self.loc9_14.1 // CHECK:STDOUT: %.loc9_9: C* = addr_pattern %self.loc9_14.3 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as AddAssign { -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.3] { // CHECK:STDOUT: %C.ref.loc12_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc12_21: type = ptr_type C [template = constants.%.3] // CHECK:STDOUT: %self.loc12_14.1: C* = param self @@ -232,10 +249,10 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %other.loc12_24.1: C = param other // CHECK:STDOUT: %other.loc12_24.2: C = bind_name other, %other.loc12_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.8] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -255,9 +272,9 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: fn @TestIncNonRef(%a: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a -// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] -// CHECK:STDOUT: %.loc23_3.1: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc23_3.2: init () = call %.loc23_3.1() [template = ] +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc23: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc23() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -265,9 +282,9 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] -// CHECK:STDOUT: %.loc33_5.1: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc33_5.2: init () = call %.loc33_5.1() [template = ] +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc33: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc33() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon index 19eff1d21b7d..93d27e2fa8d1 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon @@ -63,22 +63,31 @@ fn TestRef(b: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Negate [template] // CHECK:STDOUT: %Self.1: Negate = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Negate, [template] -// CHECK:STDOUT: %.3: in Negate> = assoc_entity element0, @Negate.%Op [template] -// CHECK:STDOUT: %.4: type = interface_type @Add [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Negate, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Negate.%Op.decl [template] +// CHECK:STDOUT: %.5: type = interface_type @Add [template] // CHECK:STDOUT: %Self.2: Add = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = assoc_entity_type @Add, [template] -// CHECK:STDOUT: %.6: in Add> = assoc_entity element0, @Add.%Op [template] -// CHECK:STDOUT: %.7: type = interface_type @AddAssign [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.6: type = assoc_entity_type @Add, Op [template] +// CHECK:STDOUT: %.7: = assoc_entity element0, @Add.%Op.decl [template] +// CHECK:STDOUT: %.8: type = interface_type @AddAssign [template] // CHECK:STDOUT: %Self.3: AddAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.9: type = assoc_entity_type @AddAssign, [template] -// CHECK:STDOUT: %.10: in AddAssign> = assoc_entity element0, @AddAssign.%Op [template] -// CHECK:STDOUT: %.11: type = interface_type @Inc [template] +// CHECK:STDOUT: %.9: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.3: Op = struct_value () [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @AddAssign, Op [template] +// CHECK:STDOUT: %.11: = assoc_entity element0, @AddAssign.%Op.decl [template] +// CHECK:STDOUT: %.12: type = interface_type @Inc [template] // CHECK:STDOUT: %Self.4: Inc = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.12: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.13: type = assoc_entity_type @Inc, [template] -// CHECK:STDOUT: %.14: in Inc> = assoc_entity element0, @Inc.%Op [template] +// CHECK:STDOUT: %.13: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] +// CHECK:STDOUT: %.14: type = assoc_entity_type @Inc, Op [template] +// CHECK:STDOUT: %.15: = assoc_entity element0, @Inc.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -89,31 +98,31 @@ fn TestRef(b: C) { // CHECK:STDOUT: .Inc = %Inc.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Negate.decl: type = interface_decl @Negate [template = constants.%.1] {} -// CHECK:STDOUT: %Add.decl: type = interface_decl @Add [template = constants.%.4] {} -// CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.7] {} -// CHECK:STDOUT: %Inc.decl: type = interface_decl @Inc [template = constants.%.11] {} +// CHECK:STDOUT: %Add.decl: type = interface_decl @Add [template = constants.%.5] {} +// CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.8] {} +// CHECK:STDOUT: %Inc.decl: type = interface_decl @Inc [template = constants.%.12] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Negate { // CHECK:STDOUT: %Self: Negate = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: Negate = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref, %.loc5_15.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %self.loc5_9.1: Self = param self // CHECK:STDOUT: %self.loc5_9.2: Self = bind_name self, %self.loc5_9.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_22: in Negate> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_22: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_22 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Add { // CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_15: Add = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_15.1: type = facet_type_access %Self.ref.loc8_15 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_15.2: type = converted %Self.ref.loc8_15, %.loc8_15.1 [symbolic = constants.%Self.2] @@ -129,21 +138,21 @@ fn TestRef(b: C) { // CHECK:STDOUT: %.loc8_37.2: type = converted %Self.ref.loc8_37, %.loc8_37.1 [symbolic = constants.%Self.2] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_41: in Add> = assoc_entity element0, %Op [template = constants.%.6] +// CHECK:STDOUT: %.loc8_41: = assoc_entity element0, %Op.decl [template = constants.%.7] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @AddAssign { // CHECK:STDOUT: %Self: AddAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.3] { // CHECK:STDOUT: %Self.ref.loc11_20: AddAssign = name_ref Self, %Self [symbolic = constants.%Self.3] // CHECK:STDOUT: %.loc11_24.1: type = facet_type_access %Self.ref.loc11_20 [symbolic = constants.%Self.3] // CHECK:STDOUT: %.loc11_24.2: type = converted %Self.ref.loc11_20, %.loc11_24.1 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc11_24.3: type = ptr_type Self [symbolic = constants.%.8] +// CHECK:STDOUT: %.loc11_24.3: type = ptr_type Self [symbolic = constants.%.9] // CHECK:STDOUT: %self.loc11_14.1: Self* = param self // CHECK:STDOUT: %self.loc11_14.3: Self* = bind_name self, %self.loc11_14.1 // CHECK:STDOUT: %.loc11_9: Self* = addr_pattern %self.loc11_14.3 @@ -153,31 +162,31 @@ fn TestRef(b: C) { // CHECK:STDOUT: %other.loc11_27.1: Self = param other // CHECK:STDOUT: %other.loc11_27.2: Self = bind_name other, %other.loc11_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11_39: in AddAssign> = assoc_entity element0, %Op [template = constants.%.10] +// CHECK:STDOUT: %.loc11_39: = assoc_entity element0, %Op.decl [template = constants.%.11] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc11_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Inc { // CHECK:STDOUT: %Self: Inc = bind_symbolic_name Self 0 [symbolic = constants.%Self.4] -// CHECK:STDOUT: %Op: = fn_decl @Op.4 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.4 [template = constants.%struct.4] { // CHECK:STDOUT: %Self.ref: Inc = name_ref Self, %Self [symbolic = constants.%Self.4] // CHECK:STDOUT: %.loc14_24.1: type = facet_type_access %Self.ref [symbolic = constants.%Self.4] // CHECK:STDOUT: %.loc14_24.2: type = converted %Self.ref, %.loc14_24.1 [symbolic = constants.%Self.4] -// CHECK:STDOUT: %.loc14_24.3: type = ptr_type Self [symbolic = constants.%.12] +// CHECK:STDOUT: %.loc14_24.3: type = ptr_type Self [symbolic = constants.%.13] // CHECK:STDOUT: %self.loc14_14.1: Self* = param self // CHECK:STDOUT: %self.loc14_14.3: Self* = bind_name self, %self.loc14_14.1 // CHECK:STDOUT: %.loc14_9: Self* = addr_pattern %self.loc14_14.3 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc14_28: in Inc> = assoc_entity element0, %Op [template = constants.%.14] +// CHECK:STDOUT: %.loc14_28: = assoc_entity element0, %Op.decl [template = constants.%.15] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc14_28 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@Negate.%self.loc5_9.2: Self](); @@ -193,38 +202,54 @@ fn TestRef(b: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %TestUnary: type = fn_type @TestUnary [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: TestUnary = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = interface_type @Negate [template] // CHECK:STDOUT: %Self.1: Negate = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = assoc_entity_type @Negate, [template] -// CHECK:STDOUT: %.6: in Negate> = assoc_entity element0, file.%import_ref.5 [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @Negate, Op [template] +// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.5 [template] +// CHECK:STDOUT: %TestBinary: type = fn_type @TestBinary [template] +// CHECK:STDOUT: %struct.3: TestBinary = struct_value () [template] // CHECK:STDOUT: %.7: type = interface_type @Add [template] // CHECK:STDOUT: %Self.2: Add = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.8: type = assoc_entity_type @Add, [template] -// CHECK:STDOUT: %.9: in Add> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] +// CHECK:STDOUT: %.8: type = assoc_entity_type @Add, Op [template] +// CHECK:STDOUT: %.9: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestRef: type = fn_type @TestRef [template] +// CHECK:STDOUT: %struct.5: TestRef = struct_value () [template] +// CHECK:STDOUT: %struct.6: C = struct_value () [template] // CHECK:STDOUT: %.10: type = interface_type @AddAssign [template] // CHECK:STDOUT: %Self.3: AddAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.11: type = assoc_entity_type @AddAssign, [template] -// CHECK:STDOUT: %.12: in AddAssign> = assoc_entity element0, file.%import_ref.15 [template] -// CHECK:STDOUT: %.13: type = interface_type @Inc [template] +// CHECK:STDOUT: %.11: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.7: Op = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @AddAssign, Op [template] +// CHECK:STDOUT: %.13: = assoc_entity element0, file.%import_ref.15 [template] +// CHECK:STDOUT: %.14: type = interface_type @Inc [template] // CHECK:STDOUT: %Self.4: Inc = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.14: type = assoc_entity_type @Inc, [template] -// CHECK:STDOUT: %.15: in Inc> = assoc_entity element0, file.%import_ref.20 [template] +// CHECK:STDOUT: %.15: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.8: Op = struct_value () [template] +// CHECK:STDOUT: %.16: type = assoc_entity_type @Inc, Op [template] +// CHECK:STDOUT: %.17: = assoc_entity element0, file.%import_ref.20 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestUnary = %TestUnary -// CHECK:STDOUT: .TestBinary = %TestBinary -// CHECK:STDOUT: .TestRef = %TestRef +// CHECK:STDOUT: .TestUnary = %TestUnary.decl +// CHECK:STDOUT: .TestBinary = %TestBinary.decl +// CHECK:STDOUT: .TestRef = %TestRef.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %TestUnary: = fn_decl @TestUnary [template] { +// CHECK:STDOUT: %TestUnary.decl: TestUnary = fn_decl @TestUnary [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc8_17: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc8_14.1: C = param a // CHECK:STDOUT: @TestUnary.%a: C = bind_name a, %a.loc8_14.1 @@ -232,11 +257,11 @@ fn TestRef(b: C) { // CHECK:STDOUT: @TestUnary.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_25 [template = constants.%.4] -// CHECK:STDOUT: %import_ref.2: in Negate> = import_ref ir2, inst+12, loc_25 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+15, loc_25 [template = constants.%.6] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded // CHECK:STDOUT: %import_ref.4 = import_ref ir2, inst+10, unloaded // CHECK:STDOUT: %import_ref.5 = import_ref ir2, inst+10, unloaded -// CHECK:STDOUT: %TestBinary: = fn_decl @TestBinary [template] { +// CHECK:STDOUT: %TestBinary.decl: TestBinary = fn_decl @TestBinary [template = constants.%struct.3] { // CHECK:STDOUT: %C.ref.loc16_18: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc16_15.1: C = param a // CHECK:STDOUT: @TestBinary.%a: C = bind_name a, %a.loc16_15.1 @@ -246,26 +271,26 @@ fn TestRef(b: C) { // CHECK:STDOUT: %C.ref.loc16_30: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestBinary.%return: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.6: type = import_ref ir2, inst+14, loc_45 [template = constants.%.7] -// CHECK:STDOUT: %import_ref.7: in Add> = import_ref ir2, inst+34, loc_45 [template = constants.%.9] -// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+16, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+32, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+32, unloaded -// CHECK:STDOUT: %TestRef: = fn_decl @TestRef [template] { +// CHECK:STDOUT: %import_ref.6: type = import_ref ir2, inst+17, loc_45 [template = constants.%.7] +// CHECK:STDOUT: %import_ref.7: = import_ref ir2, inst+39, loc_45 [template = constants.%.9] +// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+19, unloaded +// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+35, unloaded +// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+35, unloaded +// CHECK:STDOUT: %TestRef.decl: TestRef = fn_decl @TestRef [template = constants.%struct.5] { // CHECK:STDOUT: %C.ref.loc24: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.loc24_12.1: C = param b // CHECK:STDOUT: @TestRef.%b: C = bind_name b, %b.loc24_12.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+36, loc_66 [template = constants.%.10] -// CHECK:STDOUT: %import_ref.12: in AddAssign> = import_ref ir2, inst+55, loc_66 [template = constants.%.12] -// CHECK:STDOUT: %import_ref.13 = import_ref ir2, inst+38, unloaded -// CHECK:STDOUT: %import_ref.14 = import_ref ir2, inst+53, unloaded -// CHECK:STDOUT: %import_ref.15 = import_ref ir2, inst+53, unloaded -// CHECK:STDOUT: %import_ref.16: type = import_ref ir2, inst+57, loc_69 [template = constants.%.13] -// CHECK:STDOUT: %import_ref.17: in Inc> = import_ref ir2, inst+71, loc_69 [template = constants.%.15] -// CHECK:STDOUT: %import_ref.18 = import_ref ir2, inst+59, unloaded -// CHECK:STDOUT: %import_ref.19 = import_ref ir2, inst+69, unloaded -// CHECK:STDOUT: %import_ref.20 = import_ref ir2, inst+69, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+41, loc_66 [template = constants.%.10] +// CHECK:STDOUT: %import_ref.12: = import_ref ir2, inst+62, loc_66 [template = constants.%.13] +// CHECK:STDOUT: %import_ref.13 = import_ref ir2, inst+43, unloaded +// CHECK:STDOUT: %import_ref.14 = import_ref ir2, inst+58, unloaded +// CHECK:STDOUT: %import_ref.15 = import_ref ir2, inst+58, unloaded +// CHECK:STDOUT: %import_ref.16: type = import_ref ir2, inst+64, loc_69 [template = constants.%.14] +// CHECK:STDOUT: %import_ref.17: = import_ref ir2, inst+80, loc_69 [template = constants.%.17] +// CHECK:STDOUT: %import_ref.18 = import_ref ir2, inst+66, unloaded +// CHECK:STDOUT: %import_ref.19 = import_ref ir2, inst+76, unloaded +// CHECK:STDOUT: %import_ref.20 = import_ref ir2, inst+76, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Negate { @@ -308,6 +333,8 @@ fn TestRef(b: C) { // CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Op.1[%self: Self](); +// CHECK:STDOUT: // CHECK:STDOUT: fn @TestBinary(%a: C, %b: C) -> %return: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a @@ -316,20 +343,26 @@ fn TestRef(b: C) { // CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TestRef(%b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %a.var: ref C = var a // CHECK:STDOUT: %a: ref C = bind_name a, %a.var // CHECK:STDOUT: %.loc25_15.1: {} = struct_literal () -// CHECK:STDOUT: %.loc25_15.2: init C = class_init (), %a.var [template = constants.%struct] -// CHECK:STDOUT: %.loc25_16: init C = converted %.loc25_15.1, %.loc25_15.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc25_15.2: init C = class_init (), %a.var [template = constants.%struct.6] +// CHECK:STDOUT: %.loc25_16: init C = converted %.loc25_15.1, %.loc25_15.2 [template = constants.%struct.6] // CHECK:STDOUT: assign %a.var, %.loc25_16 // CHECK:STDOUT: %a.ref.loc30: ref C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.10] {} // CHECK:STDOUT: %a.ref.loc34: ref C = name_ref a, %a -// CHECK:STDOUT: %Inc.decl: type = interface_decl @Inc [template = constants.%.13] {} +// CHECK:STDOUT: %Inc.decl: type = interface_decl @Inc [template = constants.%.14] {} // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Op.3[addr %self: Self*](%other: Self); +// CHECK:STDOUT: +// CHECK:STDOUT: fn @Op.4[addr %self: Self*](); +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon index b3d3783112be..5c684eaec2c7 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon @@ -58,13 +58,18 @@ fn TestAssign(b: D) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Add [template] // CHECK:STDOUT: %Self.1: Add = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Add, [template] -// CHECK:STDOUT: %.3: in Add> = assoc_entity element0, @Add.%Op [template] -// CHECK:STDOUT: %.4: type = interface_type @AddAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Add, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Add.%Op.decl [template] +// CHECK:STDOUT: %.5: type = interface_type @AddAssign [template] // CHECK:STDOUT: %Self.2: AddAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.6: type = assoc_entity_type @AddAssign, [template] -// CHECK:STDOUT: %.7: in AddAssign> = assoc_entity element0, @AddAssign.%Op [template] +// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @AddAssign, Op [template] +// CHECK:STDOUT: %.8: = assoc_entity element0, @AddAssign.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -73,12 +78,12 @@ fn TestAssign(b: D) { // CHECK:STDOUT: .AddAssign = %AddAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Add.decl: type = interface_decl @Add [template = constants.%.1] {} -// CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.4] {} +// CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Add { // CHECK:STDOUT: %Self: Add = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc5_15: Add = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self.1] @@ -94,21 +99,21 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in Add> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @AddAssign { // CHECK:STDOUT: %Self: AddAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_20: AddAssign = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.1: type = facet_type_access %Self.ref.loc8_20 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.2: type = converted %Self.ref.loc8_20, %.loc8_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.6] // CHECK:STDOUT: %self.loc8_14.1: Self* = param self // CHECK:STDOUT: %self.loc8_14.3: Self* = bind_name self, %self.loc8_14.1 // CHECK:STDOUT: %.loc8_9: Self* = addr_pattern %self.loc8_14.3 @@ -118,12 +123,12 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %other.loc8_27.1: Self = param other // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_39: in AddAssign> = assoc_entity element0, %Op [template = constants.%.7] +// CHECK:STDOUT: %.loc8_39: = assoc_entity element0, %Op.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@Add.%self.loc5_9.2: Self](@Add.%other.loc5_21.2: Self) -> Self; @@ -138,19 +143,31 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %.2: type = interface_type @Add [template] // CHECK:STDOUT: %Self.1: Add = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.4: type = interface_type @AddAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] +// CHECK:STDOUT: %.5: type = interface_type @AddAssign [template] // CHECK:STDOUT: %Self.2: AddAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = ptr_type C [template] -// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.7: = interface_witness (@impl.2.%Op) [template] -// CHECK:STDOUT: %.8: type = tuple_type () [template] +// CHECK:STDOUT: %.6: type = ptr_type C [template] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.3: Op = struct_value () [template] +// CHECK:STDOUT: %.7: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] +// CHECK:STDOUT: %.8: = interface_witness (%struct.3) [template] +// CHECK:STDOUT: %Test: type = fn_type @Test [template] +// CHECK:STDOUT: %struct.5: Test = struct_value () [template] // CHECK:STDOUT: %.9: type = ptr_type {} [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @Add, [template] -// CHECK:STDOUT: %.11: in Add> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] -// CHECK:STDOUT: %.12: type = assoc_entity_type @AddAssign, [template] -// CHECK:STDOUT: %.13: in AddAssign> = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @Add, Op [template] +// CHECK:STDOUT: %.11: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestAssign: type = fn_type @TestAssign [template] +// CHECK:STDOUT: %struct.6: TestAssign = struct_value () [template] +// CHECK:STDOUT: %struct.7: C = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @AddAssign, Op [template] +// CHECK:STDOUT: %.13: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -158,33 +175,33 @@ fn TestAssign(b: D) { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl -// CHECK:STDOUT: .Test = %Test -// CHECK:STDOUT: .TestAssign = %TestAssign +// CHECK:STDOUT: .Test = %Test.decl +// CHECK:STDOUT: .TestAssign = %TestAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_23 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in Add> = import_ref ir2, inst+21, loc_81 [template = constants.%.11] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+24, loc_81 [template = constants.%.11] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+19, loc_24 [template = imports.%Op.1] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+19, loc_24 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc9: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc9: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Add.decl: type = interface_decl @Add [template = constants.%.2] {} // CHECK:STDOUT: %Add.ref: type = name_ref Add, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+23, loc_46 [template = constants.%.4] -// CHECK:STDOUT: %import_ref.6: in AddAssign> = import_ref ir2, inst+42, loc_102 [template = constants.%.13] -// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+25, unloaded -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+40, loc_47 [template = imports.%Op.2] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+26, loc_46 [template = constants.%.5] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+47, loc_102 [template = constants.%.13] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+28, unloaded +// CHECK:STDOUT: %import_ref.8: Op = import_ref ir2, inst+43, loc_47 [template = constants.%struct.4] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc12: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc12: = name_ref Core, %Core [template = %Core] -// CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.4] {} -// CHECK:STDOUT: %AddAssign.ref: type = name_ref AddAssign, %import_ref.5 [template = constants.%.4] +// CHECK:STDOUT: %AddAssign.decl: type = interface_decl @AddAssign [template = constants.%.5] {} +// CHECK:STDOUT: %AddAssign.ref: type = name_ref AddAssign, %import_ref.5 [template = constants.%.5] // CHECK:STDOUT: } -// CHECK:STDOUT: %Test: = fn_decl @Test [template] { +// CHECK:STDOUT: %Test.decl: Test = fn_decl @Test [template = constants.%struct.5] { // CHECK:STDOUT: %C.ref.loc16_12: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc16_9.1: C = param a // CHECK:STDOUT: @Test.%a: C = bind_name a, %a.loc16_9.1 @@ -196,13 +213,13 @@ fn TestAssign(b: D) { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_81 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { +// CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.6] { // CHECK:STDOUT: %D.ref.loc27: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %b.loc27_15.1: D = param b // CHECK:STDOUT: @TestAssign.%b: D = bind_name b, %b.loc27_15.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+23, loc_102 [template = constants.%.4] -// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+40, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+26, loc_102 [template = constants.%.5] +// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+43, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Add { @@ -220,7 +237,7 @@ fn TestAssign(b: D) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Add { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc10_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc10_9.1: C = param self // CHECK:STDOUT: %self.loc10_9.2: C = bind_name self, %self.loc10_9.1 @@ -230,17 +247,17 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %C.ref.loc10_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as AddAssign { -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.3] { // CHECK:STDOUT: %C.ref.loc13_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc13_21: type = ptr_type C [template = constants.%.5] +// CHECK:STDOUT: %.loc13_21: type = ptr_type C [template = constants.%.6] // CHECK:STDOUT: %self.loc13_14.1: C* = param self // CHECK:STDOUT: %self.loc13_14.3: C* = bind_name self, %self.loc13_14.1 // CHECK:STDOUT: %.loc13_9: C* = addr_pattern %self.loc13_14.3 @@ -248,10 +265,10 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %other.loc13_24.1: C = param other // CHECK:STDOUT: %other.loc13_24.2: C = bind_name other, %other.loc13_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.7] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -277,11 +294,11 @@ fn TestAssign(b: D) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: D = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] // CHECK:STDOUT: %.loc24_12.1: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc24_12.2: ref C = temporary_storage -// CHECK:STDOUT: %.loc24_12.3: init C = call %.loc24_12.1() [template = ] -// CHECK:STDOUT: return %.loc24_12.3 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc24_12.1() [template = ] +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%b: D) { @@ -290,15 +307,15 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %a.var: ref C = var a // CHECK:STDOUT: %a: ref C = bind_name a, %a.var // CHECK:STDOUT: %.loc28_15.1: {} = struct_literal () -// CHECK:STDOUT: %.loc28_15.2: init C = class_init (), %a.var [template = constants.%struct] -// CHECK:STDOUT: %.loc28_16: init C = converted %.loc28_15.1, %.loc28_15.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc28_15.2: init C = class_init (), %a.var [template = constants.%struct.7] +// CHECK:STDOUT: %.loc28_16: init C = converted %.loc28_15.1, %.loc28_15.2 [template = constants.%struct.7] // CHECK:STDOUT: assign %a.var, %.loc28_16 // CHECK:STDOUT: %a.ref: ref C = name_ref a, %a // CHECK:STDOUT: %b.ref: D = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] -// CHECK:STDOUT: %.loc35_5.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc35_5: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc35_3: C* = addr_of %a.ref -// CHECK:STDOUT: %.loc35_5.2: init () = call %.loc35_5.1() [template = ] +// CHECK:STDOUT: %Op.call: init () = call %.loc35_5() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/inc.carbon b/toolchain/check/testdata/operators/overloaded/inc.carbon index c4a6d752d590..9ba47ed45bfe 100644 --- a/toolchain/check/testdata/operators/overloaded/inc.carbon +++ b/toolchain/check/testdata/operators/overloaded/inc.carbon @@ -37,8 +37,11 @@ fn TestOp() { // CHECK:STDOUT: %.1: type = interface_type @Inc [template] // CHECK:STDOUT: %Self: Inc = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.2: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.3: type = assoc_entity_type @Inc, [template] -// CHECK:STDOUT: %.4: in Inc> = assoc_entity element0, @Inc.%Op [template] +// CHECK:STDOUT: %Op: type = fn_type @Op [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Op = struct_value () [template] +// CHECK:STDOUT: %.4: type = assoc_entity_type @Inc, Op [template] +// CHECK:STDOUT: %.5: = assoc_entity element0, @Inc.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -50,7 +53,7 @@ fn TestOp() { // CHECK:STDOUT: // CHECK:STDOUT: interface @Inc { // CHECK:STDOUT: %Self: Inc = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %Op: = fn_decl @Op [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op [template = constants.%struct] { // CHECK:STDOUT: %Self.ref: Inc = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc5_24.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] // CHECK:STDOUT: %.loc5_24.2: type = converted %Self.ref, %.loc5_24.1 [symbolic = constants.%Self] @@ -59,12 +62,12 @@ fn TestOp() { // CHECK:STDOUT: %self.loc5_14.3: Self* = bind_name self, %self.loc5_14.1 // CHECK:STDOUT: %.loc5_9: Self* = addr_pattern %self.loc5_14.3 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_28: in Inc> = assoc_entity element0, %Op [template = constants.%.4] +// CHECK:STDOUT: %.loc5_28: = assoc_entity element0, %Op.decl [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_28 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op[addr @Inc.%self.loc5_14.3: Self*](); @@ -77,34 +80,40 @@ fn TestOp() { // CHECK:STDOUT: %.2: type = interface_type @Inc [template] // CHECK:STDOUT: %Self: Inc = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.3: type = ptr_type C [template] -// CHECK:STDOUT: %.4: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.5: = interface_witness (@impl.%Op) [template] -// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.6: = interface_witness (%struct.1) [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.3: TestOp = struct_value () [template] // CHECK:STDOUT: %.7: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] -// CHECK:STDOUT: %.8: type = assoc_entity_type @Inc, [template] -// CHECK:STDOUT: %.9: in Inc> = assoc_entity element0, file.%import_ref.6 [template] +// CHECK:STDOUT: %struct.4: C = struct_value () [template] +// CHECK:STDOUT: %.8: type = assoc_entity_type @Inc, Op [template] +// CHECK:STDOUT: %.9: = assoc_entity element0, file.%import_ref.6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp +// CHECK:STDOUT: .TestOp = %TestOp.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in Inc> = import_ref ir2, inst+15, loc_47 [template = constants.%.9] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+18, loc_47 [template = constants.%.9] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+13, loc_19 [template = imports.%Op] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+13, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Inc.decl: type = interface_decl @Inc [template = constants.%.2] {} // CHECK:STDOUT: %Inc.ref: type = name_ref Inc, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] {} +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.3] {} // CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+1, loc_47 [template = constants.%.2] // CHECK:STDOUT: %import_ref.6 = import_ref ir2, inst+13, unloaded // CHECK:STDOUT: } @@ -117,17 +126,17 @@ fn TestOp() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Inc { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc9_21: type = ptr_type C [template = constants.%.3] // CHECK:STDOUT: %self.loc9_14.1: C* = param self // CHECK:STDOUT: %self.loc9_14.3: C* = bind_name self, %self.loc9_14.1 // CHECK:STDOUT: %.loc9_9: C* = addr_pattern %self.loc9_14.3 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.5] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -146,14 +155,14 @@ fn TestOp() { // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var // CHECK:STDOUT: %.loc13_15.1: {} = struct_literal () -// CHECK:STDOUT: %.loc13_15.2: init C = class_init (), %c.var [template = constants.%struct] -// CHECK:STDOUT: %.loc13_16: init C = converted %.loc13_15.1, %.loc13_15.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc13_15.2: init C = class_init (), %c.var [template = constants.%struct.4] +// CHECK:STDOUT: %.loc13_16: init C = converted %.loc13_15.1, %.loc13_15.2 [template = constants.%struct.4] // CHECK:STDOUT: assign %c.var, %.loc13_16 // CHECK:STDOUT: %c.ref: ref C = name_ref c, %c -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Op] -// CHECK:STDOUT: %.loc14_3.1: = bound_method %c.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc14_3: = bound_method %c.ref, %.1 // CHECK:STDOUT: %.loc14_5: C* = addr_of %c.ref -// CHECK:STDOUT: %.loc14_3.2: init () = call %.loc14_3.1(%.loc14_5) +// CHECK:STDOUT: %Op.call: init () = call %.loc14_3(%.loc14_5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/left_shift.carbon b/toolchain/check/testdata/operators/overloaded/left_shift.carbon index c6afdec6e24e..a43a34a28fef 100644 --- a/toolchain/check/testdata/operators/overloaded/left_shift.carbon +++ b/toolchain/check/testdata/operators/overloaded/left_shift.carbon @@ -47,13 +47,18 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @LeftShift [template] // CHECK:STDOUT: %Self.1: LeftShift = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @LeftShift, [template] -// CHECK:STDOUT: %.3: in LeftShift> = assoc_entity element0, @LeftShift.%Op [template] -// CHECK:STDOUT: %.4: type = interface_type @LeftShiftAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @LeftShift, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @LeftShift.%Op.decl [template] +// CHECK:STDOUT: %.5: type = interface_type @LeftShiftAssign [template] // CHECK:STDOUT: %Self.2: LeftShiftAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.6: type = assoc_entity_type @LeftShiftAssign, [template] -// CHECK:STDOUT: %.7: in LeftShiftAssign> = assoc_entity element0, @LeftShiftAssign.%Op [template] +// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @LeftShiftAssign, Op [template] +// CHECK:STDOUT: %.8: = assoc_entity element0, @LeftShiftAssign.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,12 +67,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .LeftShiftAssign = %LeftShiftAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %LeftShift.decl: type = interface_decl @LeftShift [template = constants.%.1] {} -// CHECK:STDOUT: %LeftShiftAssign.decl: type = interface_decl @LeftShiftAssign [template = constants.%.4] {} +// CHECK:STDOUT: %LeftShiftAssign.decl: type = interface_decl @LeftShiftAssign [template = constants.%.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @LeftShift { // CHECK:STDOUT: %Self: LeftShift = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc5_15: LeftShift = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self.1] @@ -83,21 +88,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in LeftShift> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @LeftShiftAssign { // CHECK:STDOUT: %Self: LeftShiftAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_20: LeftShiftAssign = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.1: type = facet_type_access %Self.ref.loc8_20 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.2: type = converted %Self.ref.loc8_20, %.loc8_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.6] // CHECK:STDOUT: %self.loc8_14.1: Self* = param self // CHECK:STDOUT: %self.loc8_14.3: Self* = bind_name self, %self.loc8_14.1 // CHECK:STDOUT: %.loc8_9: Self* = addr_pattern %self.loc8_14.3 @@ -107,12 +112,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc8_27.1: Self = param other // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_39: in LeftShiftAssign> = assoc_entity element0, %Op [template = constants.%.7] +// CHECK:STDOUT: %.loc8_39: = assoc_entity element0, %Op.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@LeftShift.%self.loc5_9.2: Self](@LeftShift.%other.loc5_21.2: Self) -> Self; @@ -126,51 +131,63 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @LeftShift [template] // CHECK:STDOUT: %Self.1: LeftShift = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %.6: type = interface_type @LeftShiftAssign [template] // CHECK:STDOUT: %Self.2: LeftShiftAssign = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.7: type = ptr_type C [template] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] // CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.9: = interface_witness (@impl.2.%Op) [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @LeftShift, [template] -// CHECK:STDOUT: %.11: in LeftShift> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %.12: type = assoc_entity_type @LeftShiftAssign, [template] -// CHECK:STDOUT: %.13: in LeftShiftAssign> = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.5: Op = struct_value () [template] +// CHECK:STDOUT: %.9: = interface_witness (%struct.4) [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.6: TestOp = struct_value () [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @LeftShift, Op [template] +// CHECK:STDOUT: %.11: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestAssign: type = fn_type @TestAssign [template] +// CHECK:STDOUT: %struct.7: TestAssign = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @LeftShiftAssign, Op [template] +// CHECK:STDOUT: %.13: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp -// CHECK:STDOUT: .TestAssign = %TestAssign +// CHECK:STDOUT: .TestOp = %TestOp.decl +// CHECK:STDOUT: .TestAssign = %TestAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in LeftShift> = import_ref ir2, inst+21, loc_82 [template = constants.%.11] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+24, loc_82 [template = constants.%.11] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+19, loc_19 [template = imports.%Op.1] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+19, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %LeftShift.decl: type = interface_decl @LeftShift [template = constants.%.2] {} // CHECK:STDOUT: %LeftShift.ref: type = name_ref LeftShift, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+23, loc_46 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.6: in LeftShiftAssign> = import_ref ir2, inst+42, loc_101 [template = constants.%.13] -// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+25, unloaded -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+40, loc_47 [template = imports.%Op.2] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+26, loc_46 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+47, loc_101 [template = constants.%.13] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+28, unloaded +// CHECK:STDOUT: %import_ref.8: Op = import_ref ir2, inst+43, loc_47 [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %LeftShiftAssign.decl: type = interface_decl @LeftShiftAssign [template = constants.%.6] {} // CHECK:STDOUT: %LeftShiftAssign.ref: type = name_ref LeftShiftAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc17_14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc17_11.1: C = param a // CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc17_11.1 @@ -182,7 +199,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_82 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { +// CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { // CHECK:STDOUT: %C.ref.loc21_18: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %.loc21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %a.loc21_15.1: C* = param a @@ -191,8 +208,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %b.loc21_22.1: C = param b // CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc21_22.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+23, loc_101 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+40, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+26, loc_101 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+43, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @LeftShift { @@ -210,7 +227,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as LeftShift { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_9.1: C = param self // CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 @@ -220,15 +237,15 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as LeftShiftAssign { -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc14_21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %self.loc14_14.1: C* = param self @@ -238,10 +255,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc14_24.1: C = param other // CHECK:STDOUT: %other.loc14_24.2: C = bind_name other, %other.loc14_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.9] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,8 +270,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc9_9.2: C](@impl.1.%other.loc9_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc10_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -271,11 +288,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] -// CHECK:STDOUT: %.loc18_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc17: ref C = splice_block %return {} -// CHECK:STDOUT: %.loc18_12.2: init C = call %.loc18_12.1(%a.ref, %b.ref) to %.loc17 -// CHECK:STDOUT: return %.loc18_12.2 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc18(%a.ref, %b.ref) to %.loc17 +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { @@ -283,10 +300,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C* = name_ref a, %a // CHECK:STDOUT: %.loc22_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] -// CHECK:STDOUT: %.loc22_6.1: = bound_method %.loc22_3.1, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_6: = bound_method %.loc22_3.1, %.1 // CHECK:STDOUT: %.loc22_3.2: C* = addr_of %.loc22_3.1 -// CHECK:STDOUT: %.loc22_6.2: init () = call %.loc22_6.1(%.loc22_3.2, %b.ref) +// CHECK:STDOUT: %Op.call: init () = call %.loc22_6(%.loc22_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/mod.carbon b/toolchain/check/testdata/operators/overloaded/mod.carbon index cf9ae0693664..e02b3c1f643c 100644 --- a/toolchain/check/testdata/operators/overloaded/mod.carbon +++ b/toolchain/check/testdata/operators/overloaded/mod.carbon @@ -47,13 +47,18 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Mod [template] // CHECK:STDOUT: %Self.1: Mod = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Mod, [template] -// CHECK:STDOUT: %.3: in Mod> = assoc_entity element0, @Mod.%Op [template] -// CHECK:STDOUT: %.4: type = interface_type @ModAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Mod, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Mod.%Op.decl [template] +// CHECK:STDOUT: %.5: type = interface_type @ModAssign [template] // CHECK:STDOUT: %Self.2: ModAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.6: type = assoc_entity_type @ModAssign, [template] -// CHECK:STDOUT: %.7: in ModAssign> = assoc_entity element0, @ModAssign.%Op [template] +// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @ModAssign, Op [template] +// CHECK:STDOUT: %.8: = assoc_entity element0, @ModAssign.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,12 +67,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .ModAssign = %ModAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Mod.decl: type = interface_decl @Mod [template = constants.%.1] {} -// CHECK:STDOUT: %ModAssign.decl: type = interface_decl @ModAssign [template = constants.%.4] {} +// CHECK:STDOUT: %ModAssign.decl: type = interface_decl @ModAssign [template = constants.%.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Mod { // CHECK:STDOUT: %Self: Mod = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc5_15: Mod = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self.1] @@ -83,21 +88,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in Mod> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @ModAssign { // CHECK:STDOUT: %Self: ModAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_20: ModAssign = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.1: type = facet_type_access %Self.ref.loc8_20 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.2: type = converted %Self.ref.loc8_20, %.loc8_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.6] // CHECK:STDOUT: %self.loc8_14.1: Self* = param self // CHECK:STDOUT: %self.loc8_14.3: Self* = bind_name self, %self.loc8_14.1 // CHECK:STDOUT: %.loc8_9: Self* = addr_pattern %self.loc8_14.3 @@ -107,12 +112,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc8_27.1: Self = param other // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_39: in ModAssign> = assoc_entity element0, %Op [template = constants.%.7] +// CHECK:STDOUT: %.loc8_39: = assoc_entity element0, %Op.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@Mod.%self.loc5_9.2: Self](@Mod.%other.loc5_21.2: Self) -> Self; @@ -126,51 +131,63 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Mod [template] // CHECK:STDOUT: %Self.1: Mod = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %.6: type = interface_type @ModAssign [template] // CHECK:STDOUT: %Self.2: ModAssign = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.7: type = ptr_type C [template] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] // CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.9: = interface_witness (@impl.2.%Op) [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @Mod, [template] -// CHECK:STDOUT: %.11: in Mod> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %.12: type = assoc_entity_type @ModAssign, [template] -// CHECK:STDOUT: %.13: in ModAssign> = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.5: Op = struct_value () [template] +// CHECK:STDOUT: %.9: = interface_witness (%struct.4) [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.6: TestOp = struct_value () [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @Mod, Op [template] +// CHECK:STDOUT: %.11: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestAssign: type = fn_type @TestAssign [template] +// CHECK:STDOUT: %struct.7: TestAssign = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @ModAssign, Op [template] +// CHECK:STDOUT: %.13: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp -// CHECK:STDOUT: .TestAssign = %TestAssign +// CHECK:STDOUT: .TestOp = %TestOp.decl +// CHECK:STDOUT: .TestAssign = %TestAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in Mod> = import_ref ir2, inst+21, loc_82 [template = constants.%.11] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+24, loc_82 [template = constants.%.11] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+19, loc_19 [template = imports.%Op.1] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+19, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Mod.decl: type = interface_decl @Mod [template = constants.%.2] {} // CHECK:STDOUT: %Mod.ref: type = name_ref Mod, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+23, loc_46 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.6: in ModAssign> = import_ref ir2, inst+42, loc_101 [template = constants.%.13] -// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+25, unloaded -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+40, loc_47 [template = imports.%Op.2] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+26, loc_46 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+47, loc_101 [template = constants.%.13] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+28, unloaded +// CHECK:STDOUT: %import_ref.8: Op = import_ref ir2, inst+43, loc_47 [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %ModAssign.decl: type = interface_decl @ModAssign [template = constants.%.6] {} // CHECK:STDOUT: %ModAssign.ref: type = name_ref ModAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc17_14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc17_11.1: C = param a // CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc17_11.1 @@ -182,7 +199,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_82 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { +// CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { // CHECK:STDOUT: %C.ref.loc21_18: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %.loc21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %a.loc21_15.1: C* = param a @@ -191,8 +208,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %b.loc21_22.1: C = param b // CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc21_22.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+23, loc_101 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+40, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+26, loc_101 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+43, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Mod { @@ -210,7 +227,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Mod { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_9.1: C = param self // CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 @@ -220,15 +237,15 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as ModAssign { -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc14_21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %self.loc14_14.1: C* = param self @@ -238,10 +255,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc14_24.1: C = param other // CHECK:STDOUT: %other.loc14_24.2: C = bind_name other, %other.loc14_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.9] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,8 +270,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc9_9.2: C](@impl.1.%other.loc9_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc10_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -271,11 +288,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] -// CHECK:STDOUT: %.loc18_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc17: ref C = splice_block %return {} -// CHECK:STDOUT: %.loc18_12.2: init C = call %.loc18_12.1(%a.ref, %b.ref) to %.loc17 -// CHECK:STDOUT: return %.loc18_12.2 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc18(%a.ref, %b.ref) to %.loc17 +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { @@ -283,10 +300,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C* = name_ref a, %a // CHECK:STDOUT: %.loc22_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] -// CHECK:STDOUT: %.loc22_6.1: = bound_method %.loc22_3.1, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_6: = bound_method %.loc22_3.1, %.1 // CHECK:STDOUT: %.loc22_3.2: C* = addr_of %.loc22_3.1 -// CHECK:STDOUT: %.loc22_6.2: init () = call %.loc22_6.1(%.loc22_3.2, %b.ref) +// CHECK:STDOUT: %Op.call: init () = call %.loc22_6(%.loc22_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/mul.carbon b/toolchain/check/testdata/operators/overloaded/mul.carbon index 30cf7659c59d..3e7adcb94009 100644 --- a/toolchain/check/testdata/operators/overloaded/mul.carbon +++ b/toolchain/check/testdata/operators/overloaded/mul.carbon @@ -47,13 +47,18 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Mul [template] // CHECK:STDOUT: %Self.1: Mul = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Mul, [template] -// CHECK:STDOUT: %.3: in Mul> = assoc_entity element0, @Mul.%Op [template] -// CHECK:STDOUT: %.4: type = interface_type @MulAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Mul, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Mul.%Op.decl [template] +// CHECK:STDOUT: %.5: type = interface_type @MulAssign [template] // CHECK:STDOUT: %Self.2: MulAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.6: type = assoc_entity_type @MulAssign, [template] -// CHECK:STDOUT: %.7: in MulAssign> = assoc_entity element0, @MulAssign.%Op [template] +// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @MulAssign, Op [template] +// CHECK:STDOUT: %.8: = assoc_entity element0, @MulAssign.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,12 +67,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .MulAssign = %MulAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Mul.decl: type = interface_decl @Mul [template = constants.%.1] {} -// CHECK:STDOUT: %MulAssign.decl: type = interface_decl @MulAssign [template = constants.%.4] {} +// CHECK:STDOUT: %MulAssign.decl: type = interface_decl @MulAssign [template = constants.%.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Mul { // CHECK:STDOUT: %Self: Mul = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc5_15: Mul = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self.1] @@ -83,21 +88,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in Mul> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @MulAssign { // CHECK:STDOUT: %Self: MulAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_20: MulAssign = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.1: type = facet_type_access %Self.ref.loc8_20 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.2: type = converted %Self.ref.loc8_20, %.loc8_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.6] // CHECK:STDOUT: %self.loc8_14.1: Self* = param self // CHECK:STDOUT: %self.loc8_14.3: Self* = bind_name self, %self.loc8_14.1 // CHECK:STDOUT: %.loc8_9: Self* = addr_pattern %self.loc8_14.3 @@ -107,12 +112,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc8_27.1: Self = param other // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_39: in MulAssign> = assoc_entity element0, %Op [template = constants.%.7] +// CHECK:STDOUT: %.loc8_39: = assoc_entity element0, %Op.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@Mul.%self.loc5_9.2: Self](@Mul.%other.loc5_21.2: Self) -> Self; @@ -126,51 +131,63 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Mul [template] // CHECK:STDOUT: %Self.1: Mul = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %.6: type = interface_type @MulAssign [template] // CHECK:STDOUT: %Self.2: MulAssign = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.7: type = ptr_type C [template] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] // CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.9: = interface_witness (@impl.2.%Op) [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @Mul, [template] -// CHECK:STDOUT: %.11: in Mul> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %.12: type = assoc_entity_type @MulAssign, [template] -// CHECK:STDOUT: %.13: in MulAssign> = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.5: Op = struct_value () [template] +// CHECK:STDOUT: %.9: = interface_witness (%struct.4) [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.6: TestOp = struct_value () [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @Mul, Op [template] +// CHECK:STDOUT: %.11: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestAssign: type = fn_type @TestAssign [template] +// CHECK:STDOUT: %struct.7: TestAssign = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @MulAssign, Op [template] +// CHECK:STDOUT: %.13: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp -// CHECK:STDOUT: .TestAssign = %TestAssign +// CHECK:STDOUT: .TestOp = %TestOp.decl +// CHECK:STDOUT: .TestAssign = %TestAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in Mul> = import_ref ir2, inst+21, loc_82 [template = constants.%.11] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+24, loc_82 [template = constants.%.11] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+19, loc_19 [template = imports.%Op.1] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+19, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Mul.decl: type = interface_decl @Mul [template = constants.%.2] {} // CHECK:STDOUT: %Mul.ref: type = name_ref Mul, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+23, loc_46 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.6: in MulAssign> = import_ref ir2, inst+42, loc_101 [template = constants.%.13] -// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+25, unloaded -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+40, loc_47 [template = imports.%Op.2] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+26, loc_46 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+47, loc_101 [template = constants.%.13] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+28, unloaded +// CHECK:STDOUT: %import_ref.8: Op = import_ref ir2, inst+43, loc_47 [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %MulAssign.decl: type = interface_decl @MulAssign [template = constants.%.6] {} // CHECK:STDOUT: %MulAssign.ref: type = name_ref MulAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc17_14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc17_11.1: C = param a // CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc17_11.1 @@ -182,7 +199,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_82 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { +// CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { // CHECK:STDOUT: %C.ref.loc21_18: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %.loc21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %a.loc21_15.1: C* = param a @@ -191,8 +208,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %b.loc21_22.1: C = param b // CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc21_22.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+23, loc_101 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+40, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+26, loc_101 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+43, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Mul { @@ -210,7 +227,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Mul { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_9.1: C = param self // CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 @@ -220,15 +237,15 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as MulAssign { -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc14_21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %self.loc14_14.1: C* = param self @@ -238,10 +255,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc14_24.1: C = param other // CHECK:STDOUT: %other.loc14_24.2: C = bind_name other, %other.loc14_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.9] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,8 +270,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc9_9.2: C](@impl.1.%other.loc9_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc10_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -271,11 +288,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] -// CHECK:STDOUT: %.loc18_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc17: ref C = splice_block %return {} -// CHECK:STDOUT: %.loc18_12.2: init C = call %.loc18_12.1(%a.ref, %b.ref) to %.loc17 -// CHECK:STDOUT: return %.loc18_12.2 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc18(%a.ref, %b.ref) to %.loc17 +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { @@ -283,10 +300,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C* = name_ref a, %a // CHECK:STDOUT: %.loc22_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] -// CHECK:STDOUT: %.loc22_6.1: = bound_method %.loc22_3.1, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_6: = bound_method %.loc22_3.1, %.1 // CHECK:STDOUT: %.loc22_3.2: C* = addr_of %.loc22_3.1 -// CHECK:STDOUT: %.loc22_6.2: init () = call %.loc22_6.1(%.loc22_3.2, %b.ref) +// CHECK:STDOUT: %Op.call: init () = call %.loc22_6(%.loc22_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/negate.carbon b/toolchain/check/testdata/operators/overloaded/negate.carbon index d0ceca014c65..531c058ac1eb 100644 --- a/toolchain/check/testdata/operators/overloaded/negate.carbon +++ b/toolchain/check/testdata/operators/overloaded/negate.carbon @@ -37,8 +37,11 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Negate [template] // CHECK:STDOUT: %Self: Negate = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Negate, [template] -// CHECK:STDOUT: %.3: in Negate> = assoc_entity element0, @Negate.%Op [template] +// CHECK:STDOUT: %Op: type = fn_type @Op [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Negate, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Negate.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -50,7 +53,7 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: interface @Negate { // CHECK:STDOUT: %Self: Negate = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %Op: = fn_decl @Op [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op [template = constants.%struct] { // CHECK:STDOUT: %Self.ref.loc5_15: Negate = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self] @@ -61,12 +64,12 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: %.loc5_26.2: type = converted %Self.ref.loc5_26, %.loc5_26.1 [symbolic = constants.%Self] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_30: in Negate> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_30: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_30 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op[@Negate.%self.loc5_9.2: Self]() -> Self; @@ -78,33 +81,39 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Negate [template] // CHECK:STDOUT: %Self: Negate = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.%Op) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] -// CHECK:STDOUT: %.6: type = assoc_entity_type @Negate, [template] -// CHECK:STDOUT: %.7: in Negate> = assoc_entity element0, file.%import_ref.6 [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.4: TestOp = struct_value () [template] +// CHECK:STDOUT: %.6: type = assoc_entity_type @Negate, Op [template] +// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp +// CHECK:STDOUT: .TestOp = %TestOp.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in Negate> = import_ref ir2, inst+16, loc_50 [template = constants.%.7] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+19, loc_50 [template = constants.%.7] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+14, loc_19 [template = imports.%Op] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+14, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Negate.decl: type = interface_decl @Negate [template = constants.%.2] {} // CHECK:STDOUT: %Negate.ref: type = name_ref Negate, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc14_14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc14_11.1: C = param a // CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc14_11.1 @@ -123,17 +132,17 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Negate { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_9.1: C = param self // CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 // CHECK:STDOUT: %C.ref.loc9_23: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -145,8 +154,8 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: fn @Op.1[@impl.%self.loc9_9.2: C]() -> @impl.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc10_14 to @impl.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -155,10 +164,10 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: fn @TestOp(%a: C) -> %return: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Op] -// CHECK:STDOUT: %.loc15_10.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc15: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc14: ref C = splice_block %return {} -// CHECK:STDOUT: %.loc15_10.2: init C = call %.loc15_10.1(%a.ref) to %.loc14 -// CHECK:STDOUT: return %.loc15_10.2 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc15(%a.ref) to %.loc14 +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/ordered.carbon b/toolchain/check/testdata/operators/overloaded/ordered.carbon index ed79ed6672ca..471dae4017b0 100644 --- a/toolchain/check/testdata/operators/overloaded/ordered.carbon +++ b/toolchain/check/testdata/operators/overloaded/ordered.carbon @@ -93,11 +93,23 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Ordered [template] // CHECK:STDOUT: %Self: Ordered = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Ordered, [template] -// CHECK:STDOUT: %.3: in Ordered> = assoc_entity element0, @Ordered.%Less [template] -// CHECK:STDOUT: %.4: in Ordered> = assoc_entity element1, @Ordered.%LessOrEquivalent [template] -// CHECK:STDOUT: %.5: in Ordered> = assoc_entity element2, @Ordered.%Greater [template] -// CHECK:STDOUT: %.6: in Ordered> = assoc_entity element3, @Ordered.%GreaterOrEquivalent [template] +// CHECK:STDOUT: %Less: type = fn_type @Less [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Less = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Ordered, Less [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Ordered.%Less.decl [template] +// CHECK:STDOUT: %LessOrEquivalent: type = fn_type @LessOrEquivalent [template] +// CHECK:STDOUT: %struct.2: LessOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @Ordered, LessOrEquivalent [template] +// CHECK:STDOUT: %.6: = assoc_entity element1, @Ordered.%LessOrEquivalent.decl [template] +// CHECK:STDOUT: %Greater: type = fn_type @Greater [template] +// CHECK:STDOUT: %struct.3: Greater = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @Ordered, Greater [template] +// CHECK:STDOUT: %.8: = assoc_entity element2, @Ordered.%Greater.decl [template] +// CHECK:STDOUT: %GreaterOrEquivalent: type = fn_type @GreaterOrEquivalent [template] +// CHECK:STDOUT: %struct.4: GreaterOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type @Ordered, GreaterOrEquivalent [template] +// CHECK:STDOUT: %.10: = assoc_entity element3, @Ordered.%GreaterOrEquivalent.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -109,7 +121,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: interface @Ordered { // CHECK:STDOUT: %Self: Ordered = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %Less: = fn_decl @Less [template] { +// CHECK:STDOUT: %Less.decl: Less = fn_decl @Less [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc8_17: Ordered = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc8_17.1: type = facet_type_access %Self.ref.loc8_17 [symbolic = constants.%Self] // CHECK:STDOUT: %.loc8_17.2: type = converted %Self.ref.loc8_17, %.loc8_17.1 [symbolic = constants.%Self] @@ -122,8 +134,8 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %other.loc8_23.2: Self = bind_name other, %other.loc8_23.1 // CHECK:STDOUT: %return.var.loc8: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_43: in Ordered> = assoc_entity element0, %Less [template = constants.%.3] -// CHECK:STDOUT: %LessOrEquivalent: = fn_decl @LessOrEquivalent [template] { +// CHECK:STDOUT: %.loc8_43: = assoc_entity element0, %Less.decl [template = constants.%.4] +// CHECK:STDOUT: %LessOrEquivalent.decl: LessOrEquivalent = fn_decl @LessOrEquivalent [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc9_29: Ordered = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc9_29.1: type = facet_type_access %Self.ref.loc9_29 [symbolic = constants.%Self] // CHECK:STDOUT: %.loc9_29.2: type = converted %Self.ref.loc9_29, %.loc9_29.1 [symbolic = constants.%Self] @@ -136,8 +148,8 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %other.loc9_35.2: Self = bind_name other, %other.loc9_35.1 // CHECK:STDOUT: %return.var.loc9: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc9_55: in Ordered> = assoc_entity element1, %LessOrEquivalent [template = constants.%.4] -// CHECK:STDOUT: %Greater: = fn_decl @Greater [template] { +// CHECK:STDOUT: %.loc9_55: = assoc_entity element1, %LessOrEquivalent.decl [template = constants.%.6] +// CHECK:STDOUT: %Greater.decl: Greater = fn_decl @Greater [template = constants.%struct.3] { // CHECK:STDOUT: %Self.ref.loc10_20: Ordered = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc10_20.1: type = facet_type_access %Self.ref.loc10_20 [symbolic = constants.%Self] // CHECK:STDOUT: %.loc10_20.2: type = converted %Self.ref.loc10_20, %.loc10_20.1 [symbolic = constants.%Self] @@ -150,8 +162,8 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %other.loc10_26.2: Self = bind_name other, %other.loc10_26.1 // CHECK:STDOUT: %return.var.loc10: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_46: in Ordered> = assoc_entity element2, %Greater [template = constants.%.5] -// CHECK:STDOUT: %GreaterOrEquivalent: = fn_decl @GreaterOrEquivalent [template] { +// CHECK:STDOUT: %.loc10_46: = assoc_entity element2, %Greater.decl [template = constants.%.8] +// CHECK:STDOUT: %GreaterOrEquivalent.decl: GreaterOrEquivalent = fn_decl @GreaterOrEquivalent [template = constants.%struct.4] { // CHECK:STDOUT: %Self.ref.loc11_32: Ordered = name_ref Self, %Self [symbolic = constants.%Self] // CHECK:STDOUT: %.loc11_32.1: type = facet_type_access %Self.ref.loc11_32 [symbolic = constants.%Self] // CHECK:STDOUT: %.loc11_32.2: type = converted %Self.ref.loc11_32, %.loc11_32.1 [symbolic = constants.%Self] @@ -164,7 +176,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %other.loc11_38.2: Self = bind_name other, %other.loc11_38.1 // CHECK:STDOUT: %return.var.loc11: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11_58: in Ordered> = assoc_entity element3, %GreaterOrEquivalent [template = constants.%.6] +// CHECK:STDOUT: %.loc11_58: = assoc_entity element3, %GreaterOrEquivalent.decl [template = constants.%.10] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -172,7 +184,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: .LessOrEquivalent = %.loc9_55 // CHECK:STDOUT: .Greater = %.loc10_46 // CHECK:STDOUT: .GreaterOrEquivalent = %.loc11_58 -// CHECK:STDOUT: witness = (%Less, %LessOrEquivalent, %Greater, %GreaterOrEquivalent) +// CHECK:STDOUT: witness = (%Less.decl, %LessOrEquivalent.decl, %Greater.decl, %GreaterOrEquivalent.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Less[@Ordered.%self.loc8_11.2: Self](@Ordered.%other.loc8_23.2: Self) -> bool; @@ -190,44 +202,71 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Ordered [template] // CHECK:STDOUT: %Self: Ordered = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.%Less, @impl.%LessOrEquivalent, @impl.%Greater, @impl.%GreaterOrEquivalent) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Less.1: type = fn_type @Less.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Less = struct_value () [template] +// CHECK:STDOUT: %LessOrEquivalent.1: type = fn_type @LessOrEquivalent.1 [template] +// CHECK:STDOUT: %struct.2: LessOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %Greater.1: type = fn_type @Greater.1 [template] +// CHECK:STDOUT: %struct.3: Greater = struct_value () [template] +// CHECK:STDOUT: %GreaterOrEquivalent.1: type = fn_type @GreaterOrEquivalent.1 [template] +// CHECK:STDOUT: %struct.4: GreaterOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %Less.2: type = fn_type @Less.2 [template] +// CHECK:STDOUT: %struct.5: Less = struct_value () [template] +// CHECK:STDOUT: %LessOrEquivalent.2: type = fn_type @LessOrEquivalent.2 [template] +// CHECK:STDOUT: %struct.6: LessOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %Greater.2: type = fn_type @Greater.2 [template] +// CHECK:STDOUT: %struct.7: Greater = struct_value () [template] +// CHECK:STDOUT: %GreaterOrEquivalent.2: type = fn_type @GreaterOrEquivalent.2 [template] +// CHECK:STDOUT: %struct.8: GreaterOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1, %struct.2, %struct.3, %struct.4) [template] +// CHECK:STDOUT: %TestLess: type = fn_type @TestLess [template] +// CHECK:STDOUT: %struct.9: TestLess = struct_value () [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %.6: type = assoc_entity_type @Ordered, [template] -// CHECK:STDOUT: %.7: in Ordered> = assoc_entity element0, file.%import_ref.12 [template] -// CHECK:STDOUT: %.8: in Ordered> = assoc_entity element1, file.%import_ref.14 [template] -// CHECK:STDOUT: %.9: in Ordered> = assoc_entity element2, file.%import_ref.16 [template] -// CHECK:STDOUT: %.10: in Ordered> = assoc_entity element3, file.%import_ref.18 [template] +// CHECK:STDOUT: %.6: type = assoc_entity_type @Ordered, Less [template] +// CHECK:STDOUT: %.7: = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %TestLessEqual: type = fn_type @TestLessEqual [template] +// CHECK:STDOUT: %struct.10: TestLessEqual = struct_value () [template] +// CHECK:STDOUT: %.8: type = assoc_entity_type @Ordered, LessOrEquivalent [template] +// CHECK:STDOUT: %.9: = assoc_entity element1, file.%import_ref.14 [template] +// CHECK:STDOUT: %TestGreater: type = fn_type @TestGreater [template] +// CHECK:STDOUT: %struct.11: TestGreater = struct_value () [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @Ordered, Greater [template] +// CHECK:STDOUT: %.11: = assoc_entity element2, file.%import_ref.16 [template] +// CHECK:STDOUT: %TestGreaterEqual: type = fn_type @TestGreaterEqual [template] +// CHECK:STDOUT: %struct.12: TestGreaterEqual = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @Ordered, GreaterOrEquivalent [template] +// CHECK:STDOUT: %.13: = assoc_entity element3, file.%import_ref.18 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestLess = %TestLess -// CHECK:STDOUT: .TestLessEqual = %TestLessEqual -// CHECK:STDOUT: .TestGreater = %TestGreater -// CHECK:STDOUT: .TestGreaterEqual = %TestGreaterEqual +// CHECK:STDOUT: .TestLess = %TestLess.decl +// CHECK:STDOUT: .TestLessEqual = %TestLessEqual.decl +// CHECK:STDOUT: .TestGreater = %TestGreater.decl +// CHECK:STDOUT: .TestGreaterEqual = %TestGreaterEqual.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in Ordered> = import_ref ir2, inst+60, loc_158 [template = constants.%.10] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+72, loc_158 [template = constants.%.13] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: in Ordered> = import_ref ir2, inst+46, loc_138 [template = constants.%.9] -// CHECK:STDOUT: %import_ref.5: in Ordered> = import_ref ir2, inst+18, loc_98 [template = constants.%.7] -// CHECK:STDOUT: %import_ref.6: in Ordered> = import_ref ir2, inst+32, loc_118 [template = constants.%.8] -// CHECK:STDOUT: %import_ref.7: = import_ref ir2, inst+16, loc_19 [template = imports.%Less] -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+31, loc_19 [template = imports.%LessOrEquivalent] -// CHECK:STDOUT: %import_ref.9: = import_ref ir2, inst+45, loc_19 [template = imports.%Greater] -// CHECK:STDOUT: %import_ref.10: = import_ref ir2, inst+59, loc_19 [template = imports.%GreaterOrEquivalent] +// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+55, loc_138 [template = constants.%.11] +// CHECK:STDOUT: %import_ref.5: = import_ref ir2, inst+21, loc_98 [template = constants.%.7] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+38, loc_118 [template = constants.%.9] +// CHECK:STDOUT: %import_ref.7: Less = import_ref ir2, inst+16, loc_19 [template = constants.%struct.5] +// CHECK:STDOUT: %import_ref.8: LessOrEquivalent = import_ref ir2, inst+34, loc_19 [template = constants.%struct.6] +// CHECK:STDOUT: %import_ref.9: Greater = import_ref ir2, inst+51, loc_19 [template = constants.%struct.7] +// CHECK:STDOUT: %import_ref.10: GreaterOrEquivalent = import_ref ir2, inst+68, loc_19 [template = constants.%struct.8] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Ordered.decl: type = interface_decl @Ordered [template = constants.%.2] {} // CHECK:STDOUT: %Ordered.ref: type = name_ref Ordered, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestLess: = fn_decl @TestLess [template] { +// CHECK:STDOUT: %TestLess.decl: TestLess = fn_decl @TestLess [template = constants.%struct.9] { // CHECK:STDOUT: %C.ref.loc15_16: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc15_13.1: C = param a // CHECK:STDOUT: @TestLess.%a: C = bind_name a, %a.loc15_13.1 @@ -238,7 +277,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+1, loc_98 [template = constants.%.2] // CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+16, unloaded -// CHECK:STDOUT: %TestLessEqual: = fn_decl @TestLessEqual [template] { +// CHECK:STDOUT: %TestLessEqual.decl: TestLessEqual = fn_decl @TestLessEqual [template = constants.%struct.10] { // CHECK:STDOUT: %C.ref.loc19_21: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc19_18.1: C = param a // CHECK:STDOUT: @TestLessEqual.%a: C = bind_name a, %a.loc19_18.1 @@ -248,8 +287,8 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: @TestLessEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.13: type = import_ref ir2, inst+1, loc_118 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.14 = import_ref ir2, inst+31, unloaded -// CHECK:STDOUT: %TestGreater: = fn_decl @TestGreater [template] { +// CHECK:STDOUT: %import_ref.14 = import_ref ir2, inst+34, unloaded +// CHECK:STDOUT: %TestGreater.decl: TestGreater = fn_decl @TestGreater [template = constants.%struct.11] { // CHECK:STDOUT: %C.ref.loc23_19: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc23_16.1: C = param a // CHECK:STDOUT: @TestGreater.%a: C = bind_name a, %a.loc23_16.1 @@ -259,8 +298,8 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: @TestGreater.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.15: type = import_ref ir2, inst+1, loc_138 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.16 = import_ref ir2, inst+45, unloaded -// CHECK:STDOUT: %TestGreaterEqual: = fn_decl @TestGreaterEqual [template] { +// CHECK:STDOUT: %import_ref.16 = import_ref ir2, inst+51, unloaded +// CHECK:STDOUT: %TestGreaterEqual.decl: TestGreaterEqual = fn_decl @TestGreaterEqual [template = constants.%struct.12] { // CHECK:STDOUT: %C.ref.loc27_24: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc27_21.1: C = param a // CHECK:STDOUT: @TestGreaterEqual.%a: C = bind_name a, %a.loc27_21.1 @@ -270,7 +309,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: @TestGreaterEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.17: type = import_ref ir2, inst+1, loc_158 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.18 = import_ref ir2, inst+59, unloaded +// CHECK:STDOUT: %import_ref.18 = import_ref ir2, inst+68, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Ordered { @@ -284,7 +323,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Ordered { -// CHECK:STDOUT: %Less: = fn_decl @Less.1 [template] { +// CHECK:STDOUT: %Less.decl: Less = fn_decl @Less.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_17: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_11.1: C = param self // CHECK:STDOUT: %self.loc9_11.2: C = bind_name self, %self.loc9_11.1 @@ -293,7 +332,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %other.loc9_20.2: C = bind_name other, %other.loc9_20.1 // CHECK:STDOUT: %return.var.loc9: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %LessOrEquivalent: = fn_decl @LessOrEquivalent.1 [template] { +// CHECK:STDOUT: %LessOrEquivalent.decl: LessOrEquivalent = fn_decl @LessOrEquivalent.1 [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref.loc10_29: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc10_23.1: C = param self // CHECK:STDOUT: %self.loc10_23.2: C = bind_name self, %self.loc10_23.1 @@ -302,7 +341,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %other.loc10_32.2: C = bind_name other, %other.loc10_32.1 // CHECK:STDOUT: %return.var.loc10: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Greater: = fn_decl @Greater.1 [template] { +// CHECK:STDOUT: %Greater.decl: Greater = fn_decl @Greater.1 [template = constants.%struct.3] { // CHECK:STDOUT: %C.ref.loc11_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc11_14.1: C = param self // CHECK:STDOUT: %self.loc11_14.2: C = bind_name self, %self.loc11_14.1 @@ -311,7 +350,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %other.loc11_23.2: C = bind_name other, %other.loc11_23.1 // CHECK:STDOUT: %return.var.loc11: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %GreaterOrEquivalent: = fn_decl @GreaterOrEquivalent.1 [template] { +// CHECK:STDOUT: %GreaterOrEquivalent.decl: GreaterOrEquivalent = fn_decl @GreaterOrEquivalent.1 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc12_32: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc12_26.1: C = param self // CHECK:STDOUT: %self.loc12_26.2: C = bind_name self, %self.loc12_26.1 @@ -320,13 +359,13 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: %other.loc12_35.2: C = bind_name other, %other.loc12_35.1 // CHECK:STDOUT: %return.var.loc12: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Less, %LessOrEquivalent, %Greater, %GreaterOrEquivalent) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Less.decl, %LessOrEquivalent.decl, %Greater.decl, %GreaterOrEquivalent.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Less = %Less -// CHECK:STDOUT: .LessOrEquivalent = %LessOrEquivalent -// CHECK:STDOUT: .Greater = %Greater -// CHECK:STDOUT: .GreaterOrEquivalent = %GreaterOrEquivalent +// CHECK:STDOUT: .Less = %Less.decl +// CHECK:STDOUT: .LessOrEquivalent = %LessOrEquivalent.decl +// CHECK:STDOUT: .Greater = %Greater.decl +// CHECK:STDOUT: .GreaterOrEquivalent = %GreaterOrEquivalent.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -355,11 +394,11 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Less] -// CHECK:STDOUT: %.loc16_12.1: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc16_12.2: init bool = call %.loc16_12.1(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc16_15.1: bool = value_of_initializer %.loc16_12.2 -// CHECK:STDOUT: %.loc16_15.2: bool = converted %.loc16_12.2, %.loc16_15.1 +// CHECK:STDOUT: %.1: Less = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc16_12: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %Less.call: init bool = call %.loc16_12(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc16_15.1: bool = value_of_initializer %Less.call +// CHECK:STDOUT: %.loc16_15.2: bool = converted %Less.call, %.loc16_15.1 // CHECK:STDOUT: return %.loc16_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -367,11 +406,11 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element1 [template = @impl.%LessOrEquivalent] -// CHECK:STDOUT: %.loc20_12.1: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc20_12.2: init bool = call %.loc20_12.1(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc20_16.1: bool = value_of_initializer %.loc20_12.2 -// CHECK:STDOUT: %.loc20_16.2: bool = converted %.loc20_12.2, %.loc20_16.1 +// CHECK:STDOUT: %.1: LessOrEquivalent = interface_witness_access @impl.%.1, element1 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc20_12: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %LessOrEquivalent.call: init bool = call %.loc20_12(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc20_16.1: bool = value_of_initializer %LessOrEquivalent.call +// CHECK:STDOUT: %.loc20_16.2: bool = converted %LessOrEquivalent.call, %.loc20_16.1 // CHECK:STDOUT: return %.loc20_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -379,11 +418,11 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element2 [template = @impl.%Greater] -// CHECK:STDOUT: %.loc24_12.1: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc24_12.2: init bool = call %.loc24_12.1(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc24_15.1: bool = value_of_initializer %.loc24_12.2 -// CHECK:STDOUT: %.loc24_15.2: bool = converted %.loc24_12.2, %.loc24_15.1 +// CHECK:STDOUT: %.1: Greater = interface_witness_access @impl.%.1, element2 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc24_12: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %Greater.call: init bool = call %.loc24_12(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc24_15.1: bool = value_of_initializer %Greater.call +// CHECK:STDOUT: %.loc24_15.2: bool = converted %Greater.call, %.loc24_15.1 // CHECK:STDOUT: return %.loc24_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -391,11 +430,11 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element3 [template = @impl.%GreaterOrEquivalent] -// CHECK:STDOUT: %.loc28_12.1: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc28_12.2: init bool = call %.loc28_12.1(%a.ref, %b.ref) -// CHECK:STDOUT: %.loc28_16.1: bool = value_of_initializer %.loc28_12.2 -// CHECK:STDOUT: %.loc28_16.2: bool = converted %.loc28_12.2, %.loc28_16.1 +// CHECK:STDOUT: %.1: GreaterOrEquivalent = interface_witness_access @impl.%.1, element3 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc28_12: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %GreaterOrEquivalent.call: init bool = call %.loc28_12(%a.ref, %b.ref) +// CHECK:STDOUT: %.loc28_16.1: bool = value_of_initializer %GreaterOrEquivalent.call +// CHECK:STDOUT: %.loc28_16.2: bool = converted %GreaterOrEquivalent.call, %.loc28_16.1 // CHECK:STDOUT: return %.loc28_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -404,29 +443,48 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: constants { // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %TestLess: type = fn_type @TestLess [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: TestLess = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = interface_type @Ordered [template] // CHECK:STDOUT: %Self: Ordered = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = assoc_entity_type @Ordered, [template] -// CHECK:STDOUT: %.6: in Ordered> = assoc_entity element0, file.%import_ref.11 [template] -// CHECK:STDOUT: %.7: in Ordered> = assoc_entity element1, file.%import_ref.13 [template] -// CHECK:STDOUT: %.8: in Ordered> = assoc_entity element2, file.%import_ref.15 [template] -// CHECK:STDOUT: %.9: in Ordered> = assoc_entity element3, file.%import_ref.17 [template] +// CHECK:STDOUT: %Less: type = fn_type @Less [template] +// CHECK:STDOUT: %struct.2: Less = struct_value () [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @Ordered, Less [template] +// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.11 [template] +// CHECK:STDOUT: %TestLessEqual: type = fn_type @TestLessEqual [template] +// CHECK:STDOUT: %struct.3: TestLessEqual = struct_value () [template] +// CHECK:STDOUT: %LessOrEquivalent: type = fn_type @LessOrEquivalent [template] +// CHECK:STDOUT: %struct.4: LessOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @Ordered, LessOrEquivalent [template] +// CHECK:STDOUT: %.8: = assoc_entity element1, file.%import_ref.13 [template] +// CHECK:STDOUT: %TestGreater: type = fn_type @TestGreater [template] +// CHECK:STDOUT: %struct.5: TestGreater = struct_value () [template] +// CHECK:STDOUT: %Greater: type = fn_type @Greater [template] +// CHECK:STDOUT: %struct.6: Greater = struct_value () [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type @Ordered, Greater [template] +// CHECK:STDOUT: %.10: = assoc_entity element2, file.%import_ref.15 [template] +// CHECK:STDOUT: %TestGreaterEqual: type = fn_type @TestGreaterEqual [template] +// CHECK:STDOUT: %struct.7: TestGreaterEqual = struct_value () [template] +// CHECK:STDOUT: %GreaterOrEquivalent: type = fn_type @GreaterOrEquivalent [template] +// CHECK:STDOUT: %struct.8: GreaterOrEquivalent = struct_value () [template] +// CHECK:STDOUT: %.11: type = assoc_entity_type @Ordered, GreaterOrEquivalent [template] +// CHECK:STDOUT: %.12: = assoc_entity element3, file.%import_ref.17 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl -// CHECK:STDOUT: .TestLess = %TestLess -// CHECK:STDOUT: .TestLessEqual = %TestLessEqual -// CHECK:STDOUT: .TestGreater = %TestGreater -// CHECK:STDOUT: .TestGreaterEqual = %TestGreaterEqual +// CHECK:STDOUT: .TestLess = %TestLess.decl +// CHECK:STDOUT: .TestLessEqual = %TestLessEqual.decl +// CHECK:STDOUT: .TestGreater = %TestGreater.decl +// CHECK:STDOUT: .TestGreaterEqual = %TestGreaterEqual.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} -// CHECK:STDOUT: %TestLess: = fn_decl @TestLess [template] { +// CHECK:STDOUT: %TestLess.decl: TestLess = fn_decl @TestLess [template = constants.%struct.1] { // CHECK:STDOUT: %D.ref.loc8_16: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc8_13.1: D = param a // CHECK:STDOUT: @TestLess.%a: D = bind_name a, %a.loc8_13.1 @@ -436,17 +494,17 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: @TestLess.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_30 [template = constants.%.4] -// CHECK:STDOUT: %import_ref.2: in Ordered> = import_ref ir2, inst+60, loc_90 [template = constants.%.9] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+72, loc_90 [template = constants.%.12] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: in Ordered> = import_ref ir2, inst+46, loc_70 [template = constants.%.8] -// CHECK:STDOUT: %import_ref.5: in Ordered> = import_ref ir2, inst+18, loc_30 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.6: in Ordered> = import_ref ir2, inst+32, loc_50 [template = constants.%.7] +// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+55, loc_70 [template = constants.%.10] +// CHECK:STDOUT: %import_ref.5: = import_ref ir2, inst+21, loc_30 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+38, loc_50 [template = constants.%.8] // CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+16, unloaded -// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+31, unloaded -// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+45, unloaded -// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+59, unloaded +// CHECK:STDOUT: %import_ref.8 = import_ref ir2, inst+34, unloaded +// CHECK:STDOUT: %import_ref.9 = import_ref ir2, inst+51, unloaded +// CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+68, unloaded // CHECK:STDOUT: %import_ref.11 = import_ref ir2, inst+16, unloaded -// CHECK:STDOUT: %TestLessEqual: = fn_decl @TestLessEqual [template] { +// CHECK:STDOUT: %TestLessEqual.decl: TestLessEqual = fn_decl @TestLessEqual [template = constants.%struct.3] { // CHECK:STDOUT: %D.ref.loc16_21: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc16_18.1: D = param a // CHECK:STDOUT: @TestLessEqual.%a: D = bind_name a, %a.loc16_18.1 @@ -456,8 +514,8 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: @TestLessEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.12: type = import_ref ir2, inst+1, loc_50 [template = constants.%.4] -// CHECK:STDOUT: %import_ref.13 = import_ref ir2, inst+31, unloaded -// CHECK:STDOUT: %TestGreater: = fn_decl @TestGreater [template] { +// CHECK:STDOUT: %import_ref.13 = import_ref ir2, inst+34, unloaded +// CHECK:STDOUT: %TestGreater.decl: TestGreater = fn_decl @TestGreater [template = constants.%struct.5] { // CHECK:STDOUT: %D.ref.loc24_19: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc24_16.1: D = param a // CHECK:STDOUT: @TestGreater.%a: D = bind_name a, %a.loc24_16.1 @@ -467,8 +525,8 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: @TestGreater.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.14: type = import_ref ir2, inst+1, loc_70 [template = constants.%.4] -// CHECK:STDOUT: %import_ref.15 = import_ref ir2, inst+45, unloaded -// CHECK:STDOUT: %TestGreaterEqual: = fn_decl @TestGreaterEqual [template] { +// CHECK:STDOUT: %import_ref.15 = import_ref ir2, inst+51, unloaded +// CHECK:STDOUT: %TestGreaterEqual.decl: TestGreaterEqual = fn_decl @TestGreaterEqual [template = constants.%struct.7] { // CHECK:STDOUT: %D.ref.loc32_24: type = name_ref D, %D.decl [template = constants.%D] // CHECK:STDOUT: %a.loc32_21.1: D = param a // CHECK:STDOUT: @TestGreaterEqual.%a: D = bind_name a, %a.loc32_21.1 @@ -478,7 +536,7 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: @TestGreaterEqual.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.16: type = import_ref ir2, inst+1, loc_90 [template = constants.%.4] -// CHECK:STDOUT: %import_ref.17 = import_ref ir2, inst+59, unloaded +// CHECK:STDOUT: %import_ref.17 = import_ref ir2, inst+68, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Ordered { @@ -504,6 +562,8 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Less[%self: Self](%other: Self) -> bool; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TestLessEqual(%a: D, %b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: D = name_ref a, %a @@ -511,6 +571,8 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @LessOrEquivalent[%self: Self](%other: Self) -> bool; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TestGreater(%a: D, %b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: D = name_ref a, %a @@ -518,6 +580,8 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @Greater[%self: Self](%other: Self) -> bool; +// CHECK:STDOUT: // CHECK:STDOUT: fn @TestGreaterEqual(%a: D, %b: D) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: D = name_ref a, %a @@ -525,3 +589,5 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @GreaterOrEquivalent[%self: Self](%other: Self) -> bool; +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/right_shift.carbon b/toolchain/check/testdata/operators/overloaded/right_shift.carbon index 6c3c3758978a..2f0a5c6f43ac 100644 --- a/toolchain/check/testdata/operators/overloaded/right_shift.carbon +++ b/toolchain/check/testdata/operators/overloaded/right_shift.carbon @@ -47,13 +47,18 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @RightShift [template] // CHECK:STDOUT: %Self.1: RightShift = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @RightShift, [template] -// CHECK:STDOUT: %.3: in RightShift> = assoc_entity element0, @RightShift.%Op [template] -// CHECK:STDOUT: %.4: type = interface_type @RightShiftAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @RightShift, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @RightShift.%Op.decl [template] +// CHECK:STDOUT: %.5: type = interface_type @RightShiftAssign [template] // CHECK:STDOUT: %Self.2: RightShiftAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.6: type = assoc_entity_type @RightShiftAssign, [template] -// CHECK:STDOUT: %.7: in RightShiftAssign> = assoc_entity element0, @RightShiftAssign.%Op [template] +// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @RightShiftAssign, Op [template] +// CHECK:STDOUT: %.8: = assoc_entity element0, @RightShiftAssign.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,12 +67,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .RightShiftAssign = %RightShiftAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %RightShift.decl: type = interface_decl @RightShift [template = constants.%.1] {} -// CHECK:STDOUT: %RightShiftAssign.decl: type = interface_decl @RightShiftAssign [template = constants.%.4] {} +// CHECK:STDOUT: %RightShiftAssign.decl: type = interface_decl @RightShiftAssign [template = constants.%.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @RightShift { // CHECK:STDOUT: %Self: RightShift = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc5_15: RightShift = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self.1] @@ -83,21 +88,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in RightShift> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @RightShiftAssign { // CHECK:STDOUT: %Self: RightShiftAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_20: RightShiftAssign = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.1: type = facet_type_access %Self.ref.loc8_20 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.2: type = converted %Self.ref.loc8_20, %.loc8_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.6] // CHECK:STDOUT: %self.loc8_14.1: Self* = param self // CHECK:STDOUT: %self.loc8_14.3: Self* = bind_name self, %self.loc8_14.1 // CHECK:STDOUT: %.loc8_9: Self* = addr_pattern %self.loc8_14.3 @@ -107,12 +112,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc8_27.1: Self = param other // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_39: in RightShiftAssign> = assoc_entity element0, %Op [template = constants.%.7] +// CHECK:STDOUT: %.loc8_39: = assoc_entity element0, %Op.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@RightShift.%self.loc5_9.2: Self](@RightShift.%other.loc5_21.2: Self) -> Self; @@ -126,51 +131,63 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @RightShift [template] // CHECK:STDOUT: %Self.1: RightShift = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %.6: type = interface_type @RightShiftAssign [template] // CHECK:STDOUT: %Self.2: RightShiftAssign = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.7: type = ptr_type C [template] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] // CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.9: = interface_witness (@impl.2.%Op) [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @RightShift, [template] -// CHECK:STDOUT: %.11: in RightShift> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %.12: type = assoc_entity_type @RightShiftAssign, [template] -// CHECK:STDOUT: %.13: in RightShiftAssign> = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.5: Op = struct_value () [template] +// CHECK:STDOUT: %.9: = interface_witness (%struct.4) [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.6: TestOp = struct_value () [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @RightShift, Op [template] +// CHECK:STDOUT: %.11: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestAssign: type = fn_type @TestAssign [template] +// CHECK:STDOUT: %struct.7: TestAssign = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @RightShiftAssign, Op [template] +// CHECK:STDOUT: %.13: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp -// CHECK:STDOUT: .TestAssign = %TestAssign +// CHECK:STDOUT: .TestOp = %TestOp.decl +// CHECK:STDOUT: .TestAssign = %TestAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in RightShift> = import_ref ir2, inst+21, loc_82 [template = constants.%.11] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+24, loc_82 [template = constants.%.11] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+19, loc_19 [template = imports.%Op.1] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+19, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %RightShift.decl: type = interface_decl @RightShift [template = constants.%.2] {} // CHECK:STDOUT: %RightShift.ref: type = name_ref RightShift, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+23, loc_46 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.6: in RightShiftAssign> = import_ref ir2, inst+42, loc_101 [template = constants.%.13] -// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+25, unloaded -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+40, loc_47 [template = imports.%Op.2] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+26, loc_46 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+47, loc_101 [template = constants.%.13] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+28, unloaded +// CHECK:STDOUT: %import_ref.8: Op = import_ref ir2, inst+43, loc_47 [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %RightShiftAssign.decl: type = interface_decl @RightShiftAssign [template = constants.%.6] {} // CHECK:STDOUT: %RightShiftAssign.ref: type = name_ref RightShiftAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc17_14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc17_11.1: C = param a // CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc17_11.1 @@ -182,7 +199,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_82 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { +// CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { // CHECK:STDOUT: %C.ref.loc21_18: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %.loc21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %a.loc21_15.1: C* = param a @@ -191,8 +208,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %b.loc21_22.1: C = param b // CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc21_22.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+23, loc_101 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+40, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+26, loc_101 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+43, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @RightShift { @@ -210,7 +227,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as RightShift { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_9.1: C = param self // CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 @@ -220,15 +237,15 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as RightShiftAssign { -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc14_21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %self.loc14_14.1: C* = param self @@ -238,10 +255,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc14_24.1: C = param other // CHECK:STDOUT: %other.loc14_24.2: C = bind_name other, %other.loc14_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.9] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,8 +270,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc9_9.2: C](@impl.1.%other.loc9_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc10_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -271,11 +288,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] -// CHECK:STDOUT: %.loc18_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc17: ref C = splice_block %return {} -// CHECK:STDOUT: %.loc18_12.2: init C = call %.loc18_12.1(%a.ref, %b.ref) to %.loc17 -// CHECK:STDOUT: return %.loc18_12.2 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc18(%a.ref, %b.ref) to %.loc17 +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { @@ -283,10 +300,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C* = name_ref a, %a // CHECK:STDOUT: %.loc22_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] -// CHECK:STDOUT: %.loc22_6.1: = bound_method %.loc22_3.1, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_6: = bound_method %.loc22_3.1, %.1 // CHECK:STDOUT: %.loc22_3.2: C* = addr_of %.loc22_3.1 -// CHECK:STDOUT: %.loc22_6.2: init () = call %.loc22_6.1(%.loc22_3.2, %b.ref) +// CHECK:STDOUT: %Op.call: init () = call %.loc22_6(%.loc22_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/sub.carbon b/toolchain/check/testdata/operators/overloaded/sub.carbon index be63103525c5..8e790f45e89f 100644 --- a/toolchain/check/testdata/operators/overloaded/sub.carbon +++ b/toolchain/check/testdata/operators/overloaded/sub.carbon @@ -47,13 +47,18 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = interface_type @Sub [template] // CHECK:STDOUT: %Self.1: Sub = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.2: type = assoc_entity_type @Sub, [template] -// CHECK:STDOUT: %.3: in Sub> = assoc_entity element0, @Sub.%Op [template] -// CHECK:STDOUT: %.4: type = interface_type @SubAssign [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %.3: type = assoc_entity_type @Sub, Op [template] +// CHECK:STDOUT: %.4: = assoc_entity element0, @Sub.%Op.decl [template] +// CHECK:STDOUT: %.5: type = interface_type @SubAssign [template] // CHECK:STDOUT: %Self.2: SubAssign = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.5: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.6: type = assoc_entity_type @SubAssign, [template] -// CHECK:STDOUT: %.7: in SubAssign> = assoc_entity element0, @SubAssign.%Op [template] +// CHECK:STDOUT: %.6: type = ptr_type Self [symbolic] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @SubAssign, Op [template] +// CHECK:STDOUT: %.8: = assoc_entity element0, @SubAssign.%Op.decl [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,12 +67,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .SubAssign = %SubAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Sub.decl: type = interface_decl @Sub [template = constants.%.1] {} -// CHECK:STDOUT: %SubAssign.decl: type = interface_decl @SubAssign [template = constants.%.4] {} +// CHECK:STDOUT: %SubAssign.decl: type = interface_decl @SubAssign [template = constants.%.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Sub { // CHECK:STDOUT: %Self: Sub = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref.loc5_15: Sub = name_ref Self, %Self [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.1: type = facet_type_access %Self.ref.loc5_15 [symbolic = constants.%Self.1] // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %.loc5_15.1 [symbolic = constants.%Self.1] @@ -83,21 +88,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %.loc5_37.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc5_41: in Sub> = assoc_entity element0, %Op [template = constants.%.3] +// CHECK:STDOUT: %.loc5_41: = assoc_entity element0, %Op.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc5_41 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @SubAssign { // CHECK:STDOUT: %Self: SubAssign = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %Op: = fn_decl @Op.2 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref.loc8_20: SubAssign = name_ref Self, %Self [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.1: type = facet_type_access %Self.ref.loc8_20 [symbolic = constants.%Self.2] // CHECK:STDOUT: %.loc8_24.2: type = converted %Self.ref.loc8_20, %.loc8_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.5] +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type Self [symbolic = constants.%.6] // CHECK:STDOUT: %self.loc8_14.1: Self* = param self // CHECK:STDOUT: %self.loc8_14.3: Self* = bind_name self, %self.loc8_14.1 // CHECK:STDOUT: %.loc8_9: Self* = addr_pattern %self.loc8_14.3 @@ -107,12 +112,12 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc8_27.1: Self = param other // CHECK:STDOUT: %other.loc8_27.2: Self = bind_name other, %other.loc8_27.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_39: in SubAssign> = assoc_entity element0, %Op [template = constants.%.7] +// CHECK:STDOUT: %.loc8_39: = assoc_entity element0, %Op.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self // CHECK:STDOUT: .Op = %.loc8_39 -// CHECK:STDOUT: witness = (%Op) +// CHECK:STDOUT: witness = (%Op.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.1[@Sub.%self.loc5_9.2: Self](@Sub.%other.loc5_21.2: Self) -> Self; @@ -126,51 +131,63 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = interface_type @Sub [template] // CHECK:STDOUT: %Self.1: Sub = bind_symbolic_name Self 0 [symbolic] -// CHECK:STDOUT: %.3: = interface_witness (@impl.1.%Op) [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %Op.1: type = fn_type @Op.1 [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Op = struct_value () [template] +// CHECK:STDOUT: %Op.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %struct.2: Op = struct_value () [template] +// CHECK:STDOUT: %.4: = interface_witness (%struct.1) [template] // CHECK:STDOUT: %.5: type = ptr_type {} [template] -// CHECK:STDOUT: %struct: C = struct_value () [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] // CHECK:STDOUT: %.6: type = interface_type @SubAssign [template] // CHECK:STDOUT: %Self.2: SubAssign = bind_symbolic_name Self 0 [symbolic] // CHECK:STDOUT: %.7: type = ptr_type C [template] +// CHECK:STDOUT: %Op.3: type = fn_type @Op.3 [template] +// CHECK:STDOUT: %struct.4: Op = struct_value () [template] // CHECK:STDOUT: %.8: type = ptr_type Self [symbolic] -// CHECK:STDOUT: %.9: = interface_witness (@impl.2.%Op) [template] -// CHECK:STDOUT: %.10: type = assoc_entity_type @Sub, [template] -// CHECK:STDOUT: %.11: in Sub> = assoc_entity element0, file.%import_ref.10 [template] -// CHECK:STDOUT: %.12: type = assoc_entity_type @SubAssign, [template] -// CHECK:STDOUT: %.13: in SubAssign> = assoc_entity element0, file.%import_ref.12 [template] +// CHECK:STDOUT: %Op.4: type = fn_type @Op.4 [template] +// CHECK:STDOUT: %struct.5: Op = struct_value () [template] +// CHECK:STDOUT: %.9: = interface_witness (%struct.4) [template] +// CHECK:STDOUT: %TestOp: type = fn_type @TestOp [template] +// CHECK:STDOUT: %struct.6: TestOp = struct_value () [template] +// CHECK:STDOUT: %.10: type = assoc_entity_type @Sub, Op [template] +// CHECK:STDOUT: %.11: = assoc_entity element0, file.%import_ref.10 [template] +// CHECK:STDOUT: %TestAssign: type = fn_type @TestAssign [template] +// CHECK:STDOUT: %struct.7: TestAssign = struct_value () [template] +// CHECK:STDOUT: %.12: type = assoc_entity_type @SubAssign, Op [template] +// CHECK:STDOUT: %.13: = assoc_entity element0, file.%import_ref.12 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .TestOp = %TestOp -// CHECK:STDOUT: .TestAssign = %TestAssign +// CHECK:STDOUT: .TestOp = %TestOp.decl +// CHECK:STDOUT: .TestAssign = %TestAssign.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: type = import_ref ir2, inst+1, loc_18 [template = constants.%.2] -// CHECK:STDOUT: %import_ref.2: in Sub> = import_ref ir2, inst+21, loc_82 [template = constants.%.11] +// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+24, loc_82 [template = constants.%.11] // CHECK:STDOUT: %import_ref.3 = import_ref ir2, inst+3, unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref ir2, inst+19, loc_19 [template = imports.%Op.1] +// CHECK:STDOUT: %import_ref.4: Op = import_ref ir2, inst+19, loc_19 [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Sub.decl: type = interface_decl @Sub [template = constants.%.2] {} // CHECK:STDOUT: %Sub.ref: type = name_ref Sub, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+23, loc_46 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.6: in SubAssign> = import_ref ir2, inst+42, loc_101 [template = constants.%.13] -// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+25, unloaded -// CHECK:STDOUT: %import_ref.8: = import_ref ir2, inst+40, loc_47 [template = imports.%Op.2] +// CHECK:STDOUT: %import_ref.5: type = import_ref ir2, inst+26, loc_46 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.6: = import_ref ir2, inst+47, loc_101 [template = constants.%.13] +// CHECK:STDOUT: %import_ref.7 = import_ref ir2, inst+28, unloaded +// CHECK:STDOUT: %import_ref.8: Op = import_ref ir2, inst+43, loc_47 [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %SubAssign.decl: type = interface_decl @SubAssign [template = constants.%.6] {} // CHECK:STDOUT: %SubAssign.ref: type = name_ref SubAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } -// CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { +// CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { // CHECK:STDOUT: %C.ref.loc17_14: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.loc17_11.1: C = param a // CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc17_11.1 @@ -182,7 +199,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir2, inst+1, loc_82 [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir2, inst+19, unloaded -// CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { +// CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { // CHECK:STDOUT: %C.ref.loc21_18: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %.loc21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %a.loc21_15.1: C* = param a @@ -191,8 +208,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %b.loc21_22.1: C = param b // CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc21_22.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+23, loc_101 [template = constants.%.6] -// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+40, unloaded +// CHECK:STDOUT: %import_ref.11: type = import_ref ir2, inst+26, loc_101 [template = constants.%.6] +// CHECK:STDOUT: %import_ref.12 = import_ref ir2, inst+43, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Sub { @@ -210,7 +227,7 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Sub { -// CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %self.loc9_9.1: C = param self // CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 @@ -220,15 +237,15 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %C.ref.loc9_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.3] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as SubAssign { -// CHECK:STDOUT: %Op: = fn_decl @Op.3 [template] { +// CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { // CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %.loc14_21: type = ptr_type C [template = constants.%.7] // CHECK:STDOUT: %self.loc14_14.1: C* = param self @@ -238,10 +255,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %other.loc14_24.1: C = param other // CHECK:STDOUT: %other.loc14_24.2: C = bind_name other, %other.loc14_24.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.9] +// CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Op = %Op +// CHECK:STDOUT: .Op = %Op.decl // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -253,8 +270,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc9_9.2: C](@impl.1.%other.loc9_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc10_14: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%struct.3] // CHECK:STDOUT: return %.loc10_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -271,11 +288,11 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] -// CHECK:STDOUT: %.loc18_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18: = bound_method %a.ref, %.1 // CHECK:STDOUT: %.loc17: ref C = splice_block %return {} -// CHECK:STDOUT: %.loc18_12.2: init C = call %.loc18_12.1(%a.ref, %b.ref) to %.loc17 -// CHECK:STDOUT: return %.loc18_12.2 to %return +// CHECK:STDOUT: %Op.call: init C = call %.loc18(%a.ref, %b.ref) to %.loc17 +// CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { @@ -283,10 +300,10 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C* = name_ref a, %a // CHECK:STDOUT: %.loc22_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b -// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] -// CHECK:STDOUT: %.loc22_6.1: = bound_method %.loc22_3.1, %.1 +// CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_6: = bound_method %.loc22_3.1, %.1 // CHECK:STDOUT: %.loc22_3.2: C* = addr_of %.loc22_3.1 -// CHECK:STDOUT: %.loc22_6.2: init () = call %.loc22_6.1(%.loc22_3.2, %b.ref) +// CHECK:STDOUT: %Op.call: init () = call %.loc22_6(%.loc22_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/package_expr/fail_not_found.carbon b/toolchain/check/testdata/package_expr/fail_not_found.carbon index e14290125048..d97c3bb2a2b1 100644 --- a/toolchain/check/testdata/package_expr/fail_not_found.carbon +++ b/toolchain/check/testdata/package_expr/fail_not_found.carbon @@ -13,13 +13,19 @@ fn Main() { // CHECK:STDOUT: --- fail_not_found.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // 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 2c4b7c25fbbc..960aec119534 100644 --- a/toolchain/check/testdata/package_expr/syntax.carbon +++ b/toolchain/check/testdata/package_expr/syntax.carbon @@ -71,26 +71,29 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .x = %x -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [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.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: assign %x.var, %.loc7 // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var @@ -112,30 +115,34 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Foo = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .NS = %NS -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %NS: = namespace [template] { // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] {} +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { @@ -148,7 +155,7 @@ fn Main() { // CHECK:STDOUT: %package.ref: = name_ref package, package [template = package] // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %Foo.ref: = name_ref Foo, @C.%Foo [template = @C.%Foo] +// CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, @C.%Foo.decl [template = constants.%struct.1] // CHECK:STDOUT: %Foo.call: init () = call %Foo.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/packages/cross_package_import.carbon b/toolchain/check/testdata/packages/cross_package_import.carbon index 448fad4c6d05..9f85370edd6d 100644 --- a/toolchain/check/testdata/packages/cross_package_import.carbon +++ b/toolchain/check/testdata/packages/cross_package_import.carbon @@ -178,13 +178,19 @@ fn Other.G() {} // CHECK:STDOUT: --- other_fn.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -194,26 +200,38 @@ fn Other.G() {} // CHECK:STDOUT: // CHECK:STDOUT: --- other_fn_extern.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @F(); // CHECK:STDOUT: // CHECK:STDOUT: --- other_fn_conflict.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %x.loc4_6.1: i32 = param x // CHECK:STDOUT: @F.%x: i32 = bind_name x, %x.loc4_6.1 // CHECK:STDOUT: } @@ -226,13 +244,19 @@ fn Other.G() {} // CHECK:STDOUT: // CHECK:STDOUT: --- other_fn2.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F2: type = fn_type @F2 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F2 = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F2 = %F2 +// CHECK:STDOUT: .F2 = %F2.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F2: = fn_decl @F2 [template] {} +// CHECK:STDOUT: %F2.decl: F2 = fn_decl @F2 [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F2() { @@ -254,29 +278,35 @@ fn Other.G() {} // CHECK:STDOUT: --- main_use_other.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Run: type = fn_type @Run [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Run = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %F2: type = fn_type @F2 [template] +// CHECK:STDOUT: %struct.3: F2 = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Other = %Other -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Other: = namespace [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} -// CHECK:STDOUT: %import_ref.1: = import_ref ir2, inst+2, loc_22 [template = imports.%F] -// CHECK:STDOUT: %import_ref.2: = import_ref ir3, inst+2, loc_28 [template = imports.%F2] +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.1] {} +// CHECK:STDOUT: %import_ref.1: F = import_ref ir2, inst+2, loc_22 [template = constants.%struct.2] +// CHECK:STDOUT: %import_ref.2: F2 = import_ref ir3, inst+2, loc_28 [template = constants.%struct.3] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Other.ref.loc8: = name_ref Other, file.%Other [template = file.%Other] -// CHECK:STDOUT: %F.ref: = name_ref F, file.%import_ref.1 [template = imports.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%import_ref.1 [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: %Other.ref.loc9: = name_ref Other, file.%Other [template = file.%Other] -// CHECK:STDOUT: %F2.ref: = name_ref F2, file.%import_ref.2 [template = imports.%F2] +// CHECK:STDOUT: %F2.ref: F2 = name_ref F2, file.%import_ref.2 [template = constants.%struct.3] // CHECK:STDOUT: %F2.call: init () = call %F2.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -288,26 +318,30 @@ fn Other.G() {} // CHECK:STDOUT: --- fail_todo_main_use_other_extern.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Run: type = fn_type @Run [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Run = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Other = %Other -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Other: = namespace [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} -// CHECK:STDOUT: %import_ref.1: = import_ref ir2, inst+2, loc_22 [template = imports.%F] +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.1] {} +// CHECK:STDOUT: %import_ref.1: F = import_ref ir2, inst+2, loc_22 [template = constants.%struct.2] // CHECK:STDOUT: %import_ref.2 = import_ref ir3, inst+2, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Other.ref: = name_ref Other, file.%Other [template = file.%Other] -// CHECK:STDOUT: %F.ref: = name_ref F, file.%import_ref.1 [template = imports.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%import_ref.1 [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -328,26 +362,30 @@ fn Other.G() {} // CHECK:STDOUT: --- fail_main_use_other_ambiguous.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Run: type = fn_type @Run [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Run = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Other = %Other -// CHECK:STDOUT: .Run = %Run +// CHECK:STDOUT: .Run = %Run.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Other: = namespace [template] {} -// CHECK:STDOUT: %Run: = fn_decl @Run [template] {} -// CHECK:STDOUT: %import_ref.1: = import_ref ir2, inst+2, loc_22 [template = imports.%F] +// CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.1] {} +// CHECK:STDOUT: %import_ref.1: F = import_ref ir2, inst+2, loc_22 [template = constants.%struct.2] // CHECK:STDOUT: %import_ref.2 = import_ref ir3, inst+4, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Other.ref: = name_ref Other, file.%Other [template = file.%Other] -// CHECK:STDOUT: %F.ref: = name_ref F, file.%import_ref.1 [template = imports.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%import_ref.1 [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -356,6 +394,12 @@ fn Other.G() {} // CHECK:STDOUT: // CHECK:STDOUT: --- fail_main_namespace_conflict.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Other = %Other @@ -364,8 +408,8 @@ fn Other.G() {} // CHECK:STDOUT: %import_ref.1: = import_ref ir1, inst+2, loaded // CHECK:STDOUT: %Other: = namespace %import_ref.1, [template] {} // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %import_ref.2: = import_ref ir2, inst+2, loaded [template = imports.%F] -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %import_ref.2: F = import_ref ir2, inst+2, loaded [template = constants.%struct] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -375,6 +419,12 @@ fn Other.G() {} // CHECK:STDOUT: // CHECK:STDOUT: --- fail_main_reopen_other.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: G = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core @@ -382,10 +432,10 @@ fn Other.G() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Other: = namespace [template] { -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %.loc13: = namespace [template] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { @@ -395,6 +445,12 @@ fn Other.G() {} // CHECK:STDOUT: // CHECK:STDOUT: --- fail_main_add_to_other.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: G = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core @@ -402,9 +458,9 @@ fn Other.G() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Other: = namespace [template] { -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { diff --git a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon index cc83c8c07042..074518cb5a54 100644 --- a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon +++ b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon @@ -37,13 +37,19 @@ import library "var"; // CHECK:STDOUT: --- fn.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Foo = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] {} +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] {} // 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 6f2f66e746b2..e1b50cc9517a 100644 --- a/toolchain/check/testdata/packages/loaded_global.carbon +++ b/toolchain/check/testdata/packages/loaded_global.carbon @@ -36,13 +36,19 @@ var package_b: () = package.B(); // CHECK:STDOUT: --- implicit.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); @@ -51,6 +57,8 @@ var package_b: () = package.B(); // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -60,7 +68,7 @@ var package_b: () = package.B(); // CHECK:STDOUT: .a = %a // CHECK:STDOUT: .package_a = %package_a // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir0, inst+2, loc_11 [template = imports.%A] +// CHECK:STDOUT: %import_ref: A = import_ref ir0, inst+2, loc_11 [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc4_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc4_9.2: type = converted %.loc4_9.1, constants.%.1 [template = constants.%.1] @@ -76,11 +84,11 @@ var package_b: () = package.B(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc4: = name_ref A, file.%import_ref [template = imports.%A] +// CHECK:STDOUT: %A.ref.loc4: A = name_ref A, file.%import_ref [template = constants.%struct] // CHECK:STDOUT: %A.call.loc4: init () = call %A.ref.loc4() // CHECK:STDOUT: assign file.%a.var, %A.call.loc4 // CHECK:STDOUT: %package.ref: = name_ref package, package [template = package] -// CHECK:STDOUT: %A.ref.loc6: = name_ref A, file.%import_ref [template = imports.%A] +// CHECK:STDOUT: %A.ref.loc6: A = name_ref A, file.%import_ref [template = constants.%struct] // CHECK:STDOUT: %A.call.loc6: init () = call %A.ref.loc6() // CHECK:STDOUT: assign file.%package_a.var, %A.call.loc6 // CHECK:STDOUT: return @@ -88,13 +96,19 @@ var package_b: () = package.B(); // CHECK:STDOUT: // CHECK:STDOUT: --- same_package.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: B = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .B = %B +// CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %B: = fn_decl @B [template] {} +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B(); @@ -103,6 +117,8 @@ var package_b: () = package.B(); // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct: B = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -112,7 +128,7 @@ var package_b: () = package.B(); // CHECK:STDOUT: .b = %b // CHECK:STDOUT: .package_b = %package_b // CHECK:STDOUT: } -// CHECK:STDOUT: %import_ref: = import_ref ir1, inst+2, loc_17 [template = imports.%B] +// CHECK:STDOUT: %import_ref: B = import_ref ir1, inst+2, loc_17 [template = constants.%struct] // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %.loc6_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1] @@ -128,11 +144,11 @@ var package_b: () = package.B(); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %B.ref.loc6: = name_ref B, file.%import_ref [template = imports.%B] +// CHECK:STDOUT: %B.ref.loc6: B = name_ref B, file.%import_ref [template = constants.%struct] // CHECK:STDOUT: %B.call.loc6: init () = call %B.ref.loc6() // CHECK:STDOUT: assign file.%b.var, %B.call.loc6 // CHECK:STDOUT: %package.ref: = name_ref package, package [template = package] -// CHECK:STDOUT: %B.ref.loc8: = name_ref B, file.%import_ref [template = imports.%B] +// CHECK:STDOUT: %B.ref.loc8: B = name_ref B, file.%import_ref [template = constants.%struct] // CHECK:STDOUT: %B.call.loc8: init () = call %B.ref.loc8() // CHECK:STDOUT: assign file.%package_b.var, %B.call.loc8 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/packages/unused_lazy_import.carbon b/toolchain/check/testdata/packages/unused_lazy_import.carbon index 2fa551ee34a5..53a90b9aab1f 100644 --- a/toolchain/check/testdata/packages/unused_lazy_import.carbon +++ b/toolchain/check/testdata/packages/unused_lazy_import.carbon @@ -16,13 +16,19 @@ package Implicit impl; // CHECK:STDOUT: --- implicit.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // 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 109513e07537..2f75608f4528 100644 --- a/toolchain/check/testdata/pointer/address_of_deref.carbon +++ b/toolchain/check/testdata/pointer/address_of_deref.carbon @@ -12,17 +12,20 @@ fn F() -> i32 { // CHECK:STDOUT: --- address_of_deref.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: type = ptr_type i32 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.3: type = ptr_type i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -31,7 +34,7 @@ fn F() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign %n.var, %.loc8 // CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n // CHECK:STDOUT: %.loc9_13: i32* = addr_of %n.ref diff --git a/toolchain/check/testdata/pointer/address_of_lvalue.carbon b/toolchain/check/testdata/pointer/address_of_lvalue.carbon index 525284f783a7..b5633a919937 100644 --- a/toolchain/check/testdata/pointer/address_of_lvalue.carbon +++ b/toolchain/check/testdata/pointer/address_of_lvalue.carbon @@ -19,58 +19,61 @@ fn F() { // CHECK:STDOUT: --- address_of_lvalue.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.3, %.4) [template] -// CHECK:STDOUT: %.5: type = ptr_type i32 [template] -// CHECK:STDOUT: %.6: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.7: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.8: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.3, %.4) [template] -// CHECK:STDOUT: %.9: i32 = int_literal 0 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %struct.2: {.a: i32, .b: i32} = struct_value (%.4, %.5) [template] +// CHECK:STDOUT: %.6: type = ptr_type i32 [template] +// CHECK:STDOUT: %.7: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.8: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.9: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.4, %.5) [template] +// CHECK:STDOUT: %.10: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] +// CHECK:STDOUT: %.loc8_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %s.var: ref {.a: i32, .b: i32} = var s // CHECK:STDOUT: %s: ref {.a: i32, .b: i32} = bind_name s, %s.var -// CHECK:STDOUT: %.loc8_37: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_45: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_37: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc8_45: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %.loc8_46.1: {.a: i32, .b: i32} = struct_literal (%.loc8_37, %.loc8_45) // CHECK:STDOUT: %.loc8_46.2: ref i32 = struct_access %s.var, element0 -// CHECK:STDOUT: %.loc8_46.3: init i32 = initialize_from %.loc8_37 to %.loc8_46.2 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_46.3: init i32 = initialize_from %.loc8_37 to %.loc8_46.2 [template = constants.%.4] // CHECK:STDOUT: %.loc8_46.4: ref i32 = struct_access %s.var, element1 -// CHECK:STDOUT: %.loc8_46.5: init i32 = initialize_from %.loc8_45 to %.loc8_46.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_46.6: init {.a: i32, .b: i32} = struct_init (%.loc8_46.3, %.loc8_46.5) to %s.var [template = constants.%struct] -// CHECK:STDOUT: %.loc8_47: init {.a: i32, .b: i32} = converted %.loc8_46.1, %.loc8_46.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc8_46.5: init i32 = initialize_from %.loc8_45 to %.loc8_46.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc8_46.6: init {.a: i32, .b: i32} = struct_init (%.loc8_46.3, %.loc8_46.5) to %s.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc8_47: init {.a: i32, .b: i32} = converted %.loc8_46.1, %.loc8_46.6 [template = constants.%struct.2] // CHECK:STDOUT: assign %s.var, %.loc8_47 -// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] -// CHECK:STDOUT: %.loc10_28: type = ptr_type {.a: i32, .b: i32} [template = constants.%.2] +// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] +// CHECK:STDOUT: %.loc10_28: type = ptr_type {.a: i32, .b: i32} [template = constants.%.3] // CHECK:STDOUT: %p.var: ref {.a: i32, .b: i32}* = var p // CHECK:STDOUT: %p: ref {.a: i32, .b: i32}* = bind_name p, %p.var // CHECK:STDOUT: %s.ref.loc10: ref {.a: i32, .b: i32} = name_ref s, %s // CHECK:STDOUT: %.loc10_32: {.a: i32, .b: i32}* = addr_of %s.ref.loc10 // CHECK:STDOUT: assign %p.var, %.loc10_32 -// CHECK:STDOUT: %.loc11_13: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_13: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: %q.var: ref i32* = var q // CHECK:STDOUT: %q: ref i32* = bind_name q, %q.var // CHECK:STDOUT: %s.ref.loc11: ref {.a: i32, .b: i32} = name_ref s, %s // CHECK:STDOUT: %.loc11_19: ref i32 = struct_access %s.ref.loc11, element0 // CHECK:STDOUT: %.loc11_17: i32* = addr_of %.loc11_19 // CHECK:STDOUT: assign %q.var, %.loc11_17 -// CHECK:STDOUT: %.loc12_13: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_13: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: %r.var: ref i32* = var r // CHECK:STDOUT: %r: ref i32* = bind_name r, %r.var // CHECK:STDOUT: %s.ref.loc12: ref {.a: i32, .b: i32} = name_ref s, %s @@ -78,32 +81,32 @@ fn F() { // CHECK:STDOUT: %.loc12_17: i32* = addr_of %.loc12_19 // CHECK:STDOUT: assign %r.var, %.loc12_17 // CHECK:STDOUT: %.loc14_19.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc14_19.2: type = converted %.loc14_19.1, constants.%.7 [template = constants.%.7] +// CHECK:STDOUT: %.loc14_19.2: type = converted %.loc14_19.1, constants.%.8 [template = constants.%.8] // CHECK:STDOUT: %t.var: ref (i32, i32) = var t // CHECK:STDOUT: %t: ref (i32, i32) = bind_name t, %t.var -// CHECK:STDOUT: %.loc14_24: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_27: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_24: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_27: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %.loc14_28.1: (i32, i32) = tuple_literal (%.loc14_24, %.loc14_27) // CHECK:STDOUT: %.loc14_28.2: ref i32 = tuple_access %t.var, element0 -// CHECK:STDOUT: %.loc14_28.3: init i32 = initialize_from %.loc14_24 to %.loc14_28.2 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_28.3: init i32 = initialize_from %.loc14_24 to %.loc14_28.2 [template = constants.%.4] // CHECK:STDOUT: %.loc14_28.4: ref i32 = tuple_access %t.var, element1 -// CHECK:STDOUT: %.loc14_28.5: init i32 = initialize_from %.loc14_27 to %.loc14_28.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_28.5: init i32 = initialize_from %.loc14_27 to %.loc14_28.4 [template = constants.%.5] // CHECK:STDOUT: %.loc14_28.6: init (i32, i32) = tuple_init (%.loc14_28.3, %.loc14_28.5) to %t.var [template = constants.%tuple] // CHECK:STDOUT: %.loc14_29: init (i32, i32) = converted %.loc14_28.1, %.loc14_28.6 [template = constants.%tuple] // CHECK:STDOUT: assign %t.var, %.loc14_29 -// CHECK:STDOUT: %.loc15_14: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_14: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: %t0.var: ref i32* = var t0 // CHECK:STDOUT: %t0: ref i32* = bind_name t0, %t0.var // CHECK:STDOUT: %t.ref.loc15: ref (i32, i32) = name_ref t, %t -// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.10] // CHECK:STDOUT: %.loc15_22: ref i32 = tuple_index %t.ref.loc15, %.loc15_21 // CHECK:STDOUT: %.loc15_18: i32* = addr_of %.loc15_22 // CHECK:STDOUT: assign %t0.var, %.loc15_18 -// CHECK:STDOUT: %.loc16_14: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc16_14: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: %t1.var: ref i32* = var t1 // CHECK:STDOUT: %t1: ref i32* = bind_name t1, %t1.var // CHECK:STDOUT: %t.ref.loc16: ref (i32, i32) = name_ref t, %t -// CHECK:STDOUT: %.loc16_21: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc16_21: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc16_22: ref i32 = tuple_index %t.ref.loc16, %.loc16_21 // CHECK:STDOUT: %.loc16_18: i32* = addr_of %.loc16_22 // CHECK:STDOUT: assign %t1.var, %.loc16_18 diff --git a/toolchain/check/testdata/pointer/arrow.carbon b/toolchain/check/testdata/pointer/arrow.carbon index 4db1d31b2f06..d03887ad1613 100644 --- a/toolchain/check/testdata/pointer/arrow.carbon +++ b/toolchain/check/testdata/pointer/arrow.carbon @@ -23,42 +23,46 @@ fn Foo(ptr: C*) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.1: type = ptr_type C [template] -// CHECK:STDOUT: %.2: type = unbound_element_type C, C* [template] -// CHECK:STDOUT: %.3: type = struct_type {.field: C*} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.field: C*} [template] -// CHECK:STDOUT: %.5: type = tuple_type () [template] +// CHECK:STDOUT: %Member: type = fn_type @Member [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Member = struct_value () [template] +// CHECK:STDOUT: %.2: type = ptr_type C [template] +// CHECK:STDOUT: %.3: type = unbound_element_type C, C* [template] +// CHECK:STDOUT: %.4: type = struct_type {.field: C*} [template] +// CHECK:STDOUT: %Foo: type = fn_type @Foo [template] +// CHECK:STDOUT: %struct.2: Foo = struct_value () [template] +// CHECK:STDOUT: %.5: type = ptr_type {.field: C*} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .Foo = %Foo +// CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %Foo: = fn_decl @Foo [template] { +// CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc12: type = ptr_type C [template = constants.%.1] +// CHECK:STDOUT: %.loc12: type = ptr_type C [template = constants.%.2] // CHECK:STDOUT: %ptr.loc12_8.1: C* = param ptr // CHECK:STDOUT: @Foo.%ptr: C* = bind_name ptr, %ptr.loc12_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %Member: = fn_decl @Member [template] { +// CHECK:STDOUT: %Member.decl: Member = fn_decl @Member [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C] // CHECK:STDOUT: %self.loc8_13.1: C = param self // CHECK:STDOUT: %self.loc8_13.2: C = bind_name self, %self.loc8_13.1 // CHECK:STDOUT: } // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc9_15: type = ptr_type C [template = constants.%.1] +// CHECK:STDOUT: %.loc9_15: type = ptr_type C [template = constants.%.2] // CHECK:STDOUT: %.loc9_12: = field_decl field, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .Member = %Member +// CHECK:STDOUT: .Member = %Member.decl // CHECK:STDOUT: .field = %.loc9_12 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -68,16 +72,16 @@ fn Foo(ptr: C*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ptr.ref.loc13: C* = name_ref ptr, %ptr // CHECK:STDOUT: %.loc13_4.1: ref C = deref %ptr.ref.loc13 -// CHECK:STDOUT: %Member.ref.loc13: = name_ref Member, @C.%Member [template = @C.%Member] +// CHECK:STDOUT: %Member.ref.loc13: Member = name_ref Member, @C.%Member.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc13_9: = bound_method %.loc13_4.1, %Member.ref.loc13 // CHECK:STDOUT: %.loc13_4.2: C = bind_value %.loc13_4.1 -// CHECK:STDOUT: %.loc13_16: init () = call %.loc13_9(%.loc13_4.2) +// CHECK:STDOUT: %Member.call.loc13: init () = call %.loc13_9(%.loc13_4.2) // CHECK:STDOUT: %ptr.ref.loc14: C* = name_ref ptr, %ptr // CHECK:STDOUT: %.loc14_6.1: ref C = deref %ptr.ref.loc14 -// CHECK:STDOUT: %Member.ref.loc14: = name_ref Member, @C.%Member [template = @C.%Member] +// CHECK:STDOUT: %Member.ref.loc14: Member = name_ref Member, @C.%Member.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc14_6.2: = bound_method %.loc14_6.1, %Member.ref.loc14 // CHECK:STDOUT: %.loc14_6.3: C = bind_value %.loc14_6.1 -// CHECK:STDOUT: %.loc14_14: init () = call %.loc14_6.2(%.loc14_6.3) +// CHECK:STDOUT: %Member.call.loc14: init () = call %.loc14_6.2(%.loc14_6.3) // CHECK:STDOUT: %ptr.ref.loc16: C* = name_ref ptr, %ptr // CHECK:STDOUT: %.loc16_4: ref C = deref %ptr.ref.loc16 // CHECK:STDOUT: %field.ref.loc16: = name_ref field, @C.%.loc9_12 [template = @C.%.loc9_12] diff --git a/toolchain/check/testdata/pointer/basic.carbon b/toolchain/check/testdata/pointer/basic.carbon index 2e8fe03e5282..689cef76e8f4 100644 --- a/toolchain/check/testdata/pointer/basic.carbon +++ b/toolchain/check/testdata/pointer/basic.carbon @@ -14,17 +14,20 @@ fn F() -> i32 { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: type = ptr_type i32 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.3: type = ptr_type i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -33,9 +36,9 @@ fn F() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign %n.var, %.loc8 -// CHECK:STDOUT: %.loc9_13: type = ptr_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc9_13: type = ptr_type i32 [template = constants.%.3] // CHECK:STDOUT: %p.var: ref i32* = var p // CHECK:STDOUT: %p: ref i32* = bind_name p, %p.var // CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n diff --git a/toolchain/check/testdata/pointer/fail_address_of_error.carbon b/toolchain/check/testdata/pointer/fail_address_of_error.carbon index 8eb8cc8be1e2..65c24dddd591 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_error.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_error.carbon @@ -22,13 +22,19 @@ fn Test() { // CHECK:STDOUT: --- fail_address_of_error.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Test: type = fn_type @Test [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Test = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Test = %Test +// CHECK:STDOUT: .Test = %Test.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Test: = fn_decl @Test [template] {} +// CHECK:STDOUT: %Test.decl: Test = fn_decl @Test [template = constants.%struct] {} // 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 db9bd0a8d6c1..1bce4c6f3d7c 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_value.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_value.carbon @@ -98,54 +98,71 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: --- fail_address_of_value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.3: type = ptr_type i32 [template] -// CHECK:STDOUT: %.4: bool = bool_literal true [template] -// CHECK:STDOUT: %.5: type = ptr_type bool [template] -// CHECK:STDOUT: %.6: f64 = float_literal 1 [template] -// CHECK:STDOUT: %.7: type = ptr_type f64 [template] -// CHECK:STDOUT: %.8: type = ptr_type String [template] -// CHECK:STDOUT: %.9: String = string_literal "Hello" [template] -// CHECK:STDOUT: %.10: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.11: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.12: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.13: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.14: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.15: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.16: bool = bool_literal false [template] -// CHECK:STDOUT: %.17: type = ptr_type type [template] -// CHECK:STDOUT: %.18: type = const_type i32 [template] -// CHECK:STDOUT: %.19: type = ptr_type const i32 [template] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.10, %.11) [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %H: type = fn_type @H [template] +// CHECK:STDOUT: %struct.2: H = struct_value () [template] +// CHECK:STDOUT: %AddressOfLiteral: type = fn_type @AddressOfLiteral [template] +// CHECK:STDOUT: %struct.3: AddressOfLiteral = struct_value () [template] +// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.4: type = ptr_type i32 [template] +// CHECK:STDOUT: %.5: bool = bool_literal true [template] +// CHECK:STDOUT: %.6: type = ptr_type bool [template] +// CHECK:STDOUT: %.7: f64 = float_literal 1 [template] +// CHECK:STDOUT: %.8: type = ptr_type f64 [template] +// CHECK:STDOUT: %.9: type = ptr_type String [template] +// CHECK:STDOUT: %.10: String = string_literal "Hello" [template] +// CHECK:STDOUT: %.11: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.12: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.13: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.14: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.15: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.16: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %AddressOfOperator: type = fn_type @AddressOfOperator [template] +// CHECK:STDOUT: %struct.4: AddressOfOperator = struct_value () [template] +// CHECK:STDOUT: %.17: bool = bool_literal false [template] +// CHECK:STDOUT: %AddressOfCall: type = fn_type @AddressOfCall [template] +// CHECK:STDOUT: %struct.5: AddressOfCall = struct_value () [template] +// CHECK:STDOUT: %AddressOfType: type = fn_type @AddressOfType [template] +// CHECK:STDOUT: %struct.6: AddressOfType = struct_value () [template] +// CHECK:STDOUT: %.18: type = ptr_type type [template] +// CHECK:STDOUT: %.19: type = const_type i32 [template] +// CHECK:STDOUT: %.20: type = ptr_type const i32 [template] +// CHECK:STDOUT: %AddressOfTupleElementValue: type = fn_type @AddressOfTupleElementValue [template] +// CHECK:STDOUT: %struct.7: AddressOfTupleElementValue = struct_value () [template] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.11, %.12) [template] +// CHECK:STDOUT: %AddressOfParam: type = fn_type @AddressOfParam [template] +// CHECK:STDOUT: %struct.8: AddressOfParam = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .H = %H -// CHECK:STDOUT: .AddressOfLiteral = %AddressOfLiteral -// CHECK:STDOUT: .AddressOfOperator = %AddressOfOperator -// CHECK:STDOUT: .AddressOfCall = %AddressOfCall -// CHECK:STDOUT: .AddressOfType = %AddressOfType -// CHECK:STDOUT: .AddressOfTupleElementValue = %AddressOfTupleElementValue -// CHECK:STDOUT: .AddressOfParam = %AddressOfParam +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .H = %H.decl +// CHECK:STDOUT: .AddressOfLiteral = %AddressOfLiteral.decl +// CHECK:STDOUT: .AddressOfOperator = %AddressOfOperator.decl +// CHECK:STDOUT: .AddressOfCall = %AddressOfCall.decl +// CHECK:STDOUT: .AddressOfType = %AddressOfType.decl +// CHECK:STDOUT: .AddressOfTupleElementValue = %AddressOfTupleElementValue.decl +// CHECK:STDOUT: .AddressOfParam = %AddressOfParam.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %H: = fn_decl @H [template] { -// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32} [template = constants.%.1] +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: @H.%return: ref {.a: i32} = var // CHECK:STDOUT: } -// 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: %AddressOfLiteral.decl: AddressOfLiteral = fn_decl @AddressOfLiteral [template = constants.%struct.3] {} +// CHECK:STDOUT: %AddressOfOperator.decl: AddressOfOperator = fn_decl @AddressOfOperator [template = constants.%struct.4] {} +// CHECK:STDOUT: %AddressOfCall.decl: AddressOfCall = fn_decl @AddressOfCall [template = constants.%struct.5] {} +// CHECK:STDOUT: %AddressOfType.decl: AddressOfType = fn_decl @AddressOfType [template = constants.%struct.6] {} +// CHECK:STDOUT: %AddressOfTupleElementValue.decl: AddressOfTupleElementValue = fn_decl @AddressOfTupleElementValue [template = constants.%struct.7] {} +// CHECK:STDOUT: %AddressOfParam.decl: AddressOfParam = fn_decl @AddressOfParam [template = constants.%struct.8] { // CHECK:STDOUT: %param.loc91_19.1: i32 = param param // CHECK:STDOUT: @AddressOfParam.%param: i32 = bind_name param, %param.loc91_19.1 // CHECK:STDOUT: } @@ -157,19 +174,19 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfLiteral() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc16_4: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc16_4: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc16_3: i32* = addr_of [template = ] -// CHECK:STDOUT: %.loc21_4: bool = bool_literal true [template = constants.%.4] +// CHECK:STDOUT: %.loc21_4: bool = bool_literal true [template = constants.%.5] // CHECK:STDOUT: %.loc21_3: bool* = addr_of [template = ] -// CHECK:STDOUT: %.loc26_4: f64 = float_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc26_4: f64 = float_literal 1 [template = constants.%.7] // CHECK:STDOUT: %.loc26_3: f64* = addr_of [template = ] -// CHECK:STDOUT: %.loc31_4: String = string_literal "Hello" [template = constants.%.9] +// CHECK:STDOUT: %.loc31_4: String = string_literal "Hello" [template = constants.%.10] // CHECK:STDOUT: %.loc31_3: String* = addr_of [template = ] -// CHECK:STDOUT: %.loc36_5: i32 = int_literal 1 [template = constants.%.10] -// CHECK:STDOUT: %.loc36_8: i32 = int_literal 2 [template = constants.%.11] +// CHECK:STDOUT: %.loc36_5: i32 = int_literal 1 [template = constants.%.11] +// CHECK:STDOUT: %.loc36_8: i32 = int_literal 2 [template = constants.%.12] // CHECK:STDOUT: %.loc36_9: (i32, i32) = tuple_literal (%.loc36_5, %.loc36_8) // CHECK:STDOUT: %.loc36_3: (i32, i32)* = addr_of [template = ] -// CHECK:STDOUT: %.loc41_10: i32 = int_literal 5 [template = constants.%.14] +// CHECK:STDOUT: %.loc41_10: i32 = int_literal 5 [template = constants.%.15] // CHECK:STDOUT: %.loc41_11: {.a: i32} = struct_literal (%.loc41_10) // CHECK:STDOUT: %.loc41_3: {.a: i32}* = addr_of [template = ] // CHECK:STDOUT: return @@ -177,32 +194,32 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfOperator() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc49_5: bool = bool_literal true [template = constants.%.4] -// CHECK:STDOUT: %.loc49_10.1: bool = bool_literal false [template = constants.%.16] +// CHECK:STDOUT: %.loc49_5: bool = bool_literal true [template = constants.%.5] +// CHECK:STDOUT: %.loc49_10.1: bool = bool_literal false [template = constants.%.17] // CHECK:STDOUT: if %.loc49_5 br !and.rhs else br !and.result(%.loc49_10.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %.loc49_14: bool = bool_literal false [template = constants.%.16] +// CHECK:STDOUT: %.loc49_14: bool = bool_literal false [template = constants.%.17] // CHECK:STDOUT: br !and.result(%.loc49_14) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: -// CHECK:STDOUT: %.loc49_10.2: bool = block_arg !and.result [template = constants.%.16] +// CHECK:STDOUT: %.loc49_10.2: bool = block_arg !and.result [template = constants.%.17] // CHECK:STDOUT: %.loc49_3: bool* = addr_of [template = ] -// CHECK:STDOUT: %H.ref: = name_ref H, file.%H [template = file.%H] +// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.2] // CHECK:STDOUT: %H.call: init {.a: i32} = call %H.ref() // CHECK:STDOUT: %.loc54_5.1: ref {.a: i32} = temporary_storage // CHECK:STDOUT: %.loc54_5.2: ref {.a: i32} = temporary %.loc54_5.1, %H.call // CHECK:STDOUT: %.loc54_7: ref i32 = struct_access %.loc54_5.2, element0 // CHECK:STDOUT: %.loc54_3: i32* = addr_of [template = ] -// CHECK:STDOUT: %.loc59_9: bool = bool_literal true [template = constants.%.4] -// CHECK:STDOUT: %.loc59_5: bool = not %.loc59_9 [template = constants.%.16] +// CHECK:STDOUT: %.loc59_9: bool = bool_literal true [template = constants.%.5] +// CHECK:STDOUT: %.loc59_5: bool = not %.loc59_9 [template = constants.%.17] // CHECK:STDOUT: %.loc59_3: bool* = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfCall() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.1] // CHECK:STDOUT: %G.call: init i32 = call %G.ref() // CHECK:STDOUT: %.loc67: i32* = addr_of [template = ] // CHECK:STDOUT: return @@ -211,28 +228,28 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: fn @AddressOfType() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc75: type* = addr_of [template = ] -// CHECK:STDOUT: %.loc80_5: type = const_type i32 [template = constants.%.18] -// CHECK:STDOUT: %.loc80_14: type = ptr_type const i32 [template = constants.%.19] +// CHECK:STDOUT: %.loc80_5: type = const_type i32 [template = constants.%.19] +// CHECK:STDOUT: %.loc80_14: type = ptr_type const i32 [template = constants.%.20] // CHECK:STDOUT: %.loc80_3: type* = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfTupleElementValue() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc88_6: i32 = int_literal 1 [template = constants.%.10] -// CHECK:STDOUT: %.loc88_9: i32 = int_literal 2 [template = constants.%.11] +// CHECK:STDOUT: %.loc88_6: i32 = int_literal 1 [template = constants.%.11] +// CHECK:STDOUT: %.loc88_9: i32 = int_literal 2 [template = constants.%.12] // CHECK:STDOUT: %.loc88_10.1: (i32, i32) = tuple_literal (%.loc88_6, %.loc88_9) -// CHECK:STDOUT: %.loc88_12: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc88_12: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.loc88_6, %.loc88_9) [template = constants.%tuple] // CHECK:STDOUT: %.loc88_10.2: (i32, i32) = converted %.loc88_10.1, %tuple [template = constants.%tuple] -// CHECK:STDOUT: %.loc88_13: i32 = tuple_index %.loc88_10.2, %.loc88_12 [template = constants.%.10] +// CHECK:STDOUT: %.loc88_13: i32 = tuple_index %.loc88_10.2, %.loc88_12 [template = constants.%.11] // CHECK:STDOUT: %.loc88_3: i32* = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfParam(%param: i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc95_22: type = ptr_type i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc95_22: type = ptr_type i32 [template = constants.%.4] // CHECK:STDOUT: %param_addr.var: ref i32* = var param_addr // CHECK:STDOUT: %param_addr: ref i32* = bind_name param_addr, %param_addr.var // CHECK:STDOUT: %param.ref: i32 = name_ref param, %param diff --git a/toolchain/check/testdata/pointer/fail_deref_function.carbon b/toolchain/check/testdata/pointer/fail_deref_function.carbon index 62e8ca269091..2c38a1861389 100644 --- a/toolchain/check/testdata/pointer/fail_deref_function.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_function.carbon @@ -18,20 +18,26 @@ fn A() { // CHECK:STDOUT: --- fail_deref_function.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc12: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref.loc12: A = name_ref A, file.%A.decl [template = constants.%struct] // CHECK:STDOUT: %.loc12: ref = deref -// CHECK:STDOUT: %A.ref.loc16: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref.loc16: A = name_ref A, file.%A.decl [template = constants.%struct] // CHECK:STDOUT: %.loc16: ref = deref // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_deref_namespace.carbon b/toolchain/check/testdata/pointer/fail_deref_namespace.carbon index 6f41054b2ce3..8e506a77c081 100644 --- a/toolchain/check/testdata/pointer/fail_deref_namespace.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_namespace.carbon @@ -20,15 +20,21 @@ fn F() { // CHECK:STDOUT: --- fail_deref_namespace.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // 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 7dbb51d8e411..1880e124af45 100644 --- a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon @@ -39,19 +39,21 @@ fn Deref(n: i32) { // CHECK:STDOUT: --- fail_deref_not_pointer.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Deref: type = fn_type @Deref [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Deref = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] -// CHECK:STDOUT: %struct: {} = struct_value () [template] +// CHECK:STDOUT: %struct.2: {} = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Deref = %Deref +// CHECK:STDOUT: .Deref = %Deref.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Deref: = fn_decl @Deref [template] { +// CHECK:STDOUT: %Deref.decl: Deref = fn_decl @Deref [template = constants.%struct.1] { // CHECK:STDOUT: %n.loc7_10.1: i32 = param n // CHECK:STDOUT: @Deref.%n: i32 = bind_name n, %n.loc7_10.1 // CHECK:STDOUT: } @@ -72,12 +74,12 @@ fn Deref(n: i32) { // CHECK:STDOUT: %.loc27_4.2: () = converted %.loc27_4.1, %tuple.loc27 [template = constants.%tuple] // CHECK:STDOUT: %.loc27_5: ref = deref %.loc27_4.2 // CHECK:STDOUT: %.loc32_5.1: {} = struct_literal () -// CHECK:STDOUT: %struct.loc32: {} = struct_value () [template = constants.%struct] -// CHECK:STDOUT: %.loc32_5.2: {} = converted %.loc32_5.1, %struct.loc32 [template = constants.%struct] +// CHECK:STDOUT: %struct.loc32: {} = struct_value () [template = constants.%struct.2] +// CHECK:STDOUT: %.loc32_5.2: {} = converted %.loc32_5.1, %struct.loc32 [template = constants.%struct.2] // CHECK:STDOUT: %.loc32_3: ref = deref %.loc32_5.2 // CHECK:STDOUT: %.loc36_4.1: {} = struct_literal () -// CHECK:STDOUT: %struct.loc36: {} = struct_value () [template = constants.%struct] -// CHECK:STDOUT: %.loc36_4.2: {} = converted %.loc36_4.1, %struct.loc36 [template = constants.%struct] +// CHECK:STDOUT: %struct.loc36: {} = struct_value () [template = constants.%struct.2] +// CHECK:STDOUT: %.loc36_4.2: {} = converted %.loc36_4.1, %struct.loc36 [template = constants.%struct.2] // CHECK:STDOUT: %.loc36_5: ref = deref %.loc36_4.2 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon index 7478d1cafb43..7f7acc5c1d3c 100644 --- a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon @@ -19,15 +19,18 @@ fn ConstMismatch(p: const {}*) -> const ({}*) { // CHECK:STDOUT: %.3: type = ptr_type const {} [template] // CHECK:STDOUT: %.4: type = ptr_type {} [template] // CHECK:STDOUT: %.5: type = const_type {}* [template] +// CHECK:STDOUT: %ConstMismatch: type = fn_type @ConstMismatch [template] +// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %struct: ConstMismatch = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .ConstMismatch = %ConstMismatch +// CHECK:STDOUT: .ConstMismatch = %ConstMismatch.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %ConstMismatch: = fn_decl @ConstMismatch [template] { +// CHECK:STDOUT: %ConstMismatch.decl: ConstMismatch = fn_decl @ConstMismatch [template = constants.%struct] { // CHECK:STDOUT: %.loc7_28: {} = struct_literal () // CHECK:STDOUT: %.loc7_21.1: type = converted %.loc7_28, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %.loc7_21.2: type = const_type {} [template = constants.%.2] diff --git a/toolchain/check/testdata/pointer/nested_const.carbon b/toolchain/check/testdata/pointer/nested_const.carbon index e0e28b176faa..faf65da60ec7 100644 --- a/toolchain/check/testdata/pointer/nested_const.carbon +++ b/toolchain/check/testdata/pointer/nested_const.carbon @@ -17,15 +17,18 @@ fn F(p: const (const (const i32*)*)) -> const i32 { // CHECK:STDOUT: %.3: type = const_type const i32* [template] // CHECK:STDOUT: %.4: type = ptr_type const (const i32*) [template] // CHECK:STDOUT: %.5: type = const_type const (const i32*)* [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.6: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // 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] diff --git a/toolchain/check/testdata/pointer/types.carbon b/toolchain/check/testdata/pointer/types.carbon index 105bf2b3b090..fcd3686daee2 100644 --- a/toolchain/check/testdata/pointer/types.carbon +++ b/toolchain/check/testdata/pointer/types.carbon @@ -16,31 +16,36 @@ fn ConstPtr(p: const i32*) -> (const i32)* { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = ptr_type i32 [template] -// CHECK:STDOUT: %.2: type = const_type i32 [template] -// CHECK:STDOUT: %.3: type = ptr_type const i32 [template] +// CHECK:STDOUT: %Ptr: type = fn_type @Ptr [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Ptr = struct_value () [template] +// CHECK:STDOUT: %.3: type = const_type i32 [template] +// CHECK:STDOUT: %.4: type = ptr_type const i32 [template] +// CHECK:STDOUT: %ConstPtr: type = fn_type @ConstPtr [template] +// CHECK:STDOUT: %struct.2: ConstPtr = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Ptr = %Ptr -// CHECK:STDOUT: .ConstPtr = %ConstPtr +// CHECK:STDOUT: .Ptr = %Ptr.decl +// CHECK:STDOUT: .ConstPtr = %ConstPtr.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Ptr: = fn_decl @Ptr [template] { +// CHECK:STDOUT: %Ptr.decl: Ptr = fn_decl @Ptr [template = constants.%struct.1] { // 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: @Ptr.%return: ref i32* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %ConstPtr: = fn_decl @ConstPtr [template] { -// 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: %ConstPtr.decl: ConstPtr = fn_decl @ConstPtr [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc11_16: type = const_type i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_25: type = ptr_type const i32 [template = constants.%.4] // 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: %.loc11_32: type = const_type i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_42: type = ptr_type const i32 [template = constants.%.4] // CHECK:STDOUT: @ConstPtr.%return: ref const i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/code_after_return.carbon b/toolchain/check/testdata/return/code_after_return.carbon index a95674c2dc9e..4170d55b0fa5 100644 --- a/toolchain/check/testdata/return/code_after_return.carbon +++ b/toolchain/check/testdata/return/code_after_return.carbon @@ -12,16 +12,19 @@ fn Main() { // CHECK:STDOUT: --- code_after_return.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // 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 2e2a5689a718..5e6182559069 100644 --- a/toolchain/check/testdata/return/code_after_return_value.carbon +++ b/toolchain/check/testdata/return/code_after_return_value.carbon @@ -19,20 +19,23 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: --- code_after_return_value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.4: bool = bool_literal false [template] -// CHECK:STDOUT: %.5: bool = bool_literal true [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.5: bool = bool_literal false [template] +// CHECK:STDOUT: %.6: bool = bool_literal true [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %b.loc7_6.1: bool = param b // CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc7_6.1 // CHECK:STDOUT: @F.%return: ref i32 = var @@ -41,7 +44,7 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b: bool) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_call_in_type.carbon b/toolchain/check/testdata/return/fail_call_in_type.carbon index dc676554d741..cab4d335d1dc 100644 --- a/toolchain/check/testdata/return/fail_call_in_type.carbon +++ b/toolchain/check/testdata/return/fail_call_in_type.carbon @@ -15,21 +15,26 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: --- fail_call_in_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 6 [template] +// CHECK:STDOUT: %ReturnType: type = fn_type @ReturnType [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: ReturnType = struct_value () [template] +// CHECK:STDOUT: %Six: type = fn_type @Six [template] +// CHECK:STDOUT: %struct.2: Six = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .ReturnType = %ReturnType -// CHECK:STDOUT: .Six = %Six +// CHECK:STDOUT: .ReturnType = %ReturnType.decl +// CHECK:STDOUT: .Six = %Six.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %ReturnType: = fn_decl @ReturnType [template] { +// CHECK:STDOUT: %ReturnType.decl: ReturnType = fn_decl @ReturnType [template = constants.%struct.1] { // CHECK:STDOUT: @ReturnType.%return: ref type = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Six: = fn_decl @Six [template] { -// CHECK:STDOUT: %ReturnType.ref: = name_ref ReturnType, %ReturnType [template = %ReturnType] +// CHECK:STDOUT: %Six.decl: Six = fn_decl @Six [template = constants.%struct.2] { +// CHECK:STDOUT: %ReturnType.ref: ReturnType = name_ref ReturnType, %ReturnType.decl [template = constants.%struct.1] // CHECK:STDOUT: %ReturnType.call: init type = call %ReturnType.ref() // CHECK:STDOUT: %.loc13_24.1: type = value_of_initializer %ReturnType.call // CHECK:STDOUT: %.loc13_24.2: type = converted %ReturnType.call, %.loc13_24.1 @@ -44,7 +49,7 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13: i32 = int_literal 6 [template = constants.%.1] +// CHECK:STDOUT: %.loc13: i32 = int_literal 6 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_error_in_type.carbon b/toolchain/check/testdata/return/fail_error_in_type.carbon index 52434a4f1e58..fbd2bfa3ec71 100644 --- a/toolchain/check/testdata/return/fail_error_in_type.carbon +++ b/toolchain/check/testdata/return/fail_error_in_type.carbon @@ -11,13 +11,19 @@ fn Six() -> x; // CHECK:STDOUT: --- fail_error_in_type.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Six: type = fn_type @Six [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Six = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Six = %Six +// CHECK:STDOUT: .Six = %Six.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Six: = fn_decl @Six [template] { +// CHECK:STDOUT: %Six.decl: Six = fn_decl @Six [template = constants.%struct] { // CHECK:STDOUT: %x.ref: = name_ref x, [template = ] // CHECK:STDOUT: @Six.%return: ref = var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_let_in_type.carbon b/toolchain/check/testdata/return/fail_let_in_type.carbon index c58e280dcd4d..fb248b281b0b 100644 --- a/toolchain/check/testdata/return/fail_let_in_type.carbon +++ b/toolchain/check/testdata/return/fail_let_in_type.carbon @@ -29,21 +29,26 @@ fn FirstPerfectNumber() -> z { return 6; } // CHECK:STDOUT: --- fail_let_in_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 6 [template] +// CHECK:STDOUT: %Six: type = fn_type @Six [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Six = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 6 [template] // CHECK:STDOUT: %y: type = bind_symbolic_name y 0 [symbolic] +// CHECK:STDOUT: %HalfDozen: type = fn_type @HalfDozen [template] +// CHECK:STDOUT: %struct.2: HalfDozen = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file {} // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12: i32 = int_literal 6 [template = constants.%.1] +// CHECK:STDOUT: %.loc12: i32 = int_literal 6 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @HalfDozen() -> y { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc20: i32 = int_literal 6 [template = constants.%.1] +// CHECK:STDOUT: %.loc20: i32 = int_literal 6 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_missing_return.carbon b/toolchain/check/testdata/return/fail_missing_return.carbon index aded7217a18a..fb3a64dad8cc 100644 --- a/toolchain/check/testdata/return/fail_missing_return.carbon +++ b/toolchain/check/testdata/return/fail_missing_return.carbon @@ -12,13 +12,19 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_missing_return.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] { +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } 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 46aadd5524dd..d20825989267 100644 --- a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon +++ b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon @@ -14,15 +14,17 @@ fn F() -> () { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %.loc7_12.1: () = tuple_literal () // CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @F.%return: ref () = var 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 b49152b2d235..2e9762809026 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 @@ -13,13 +13,19 @@ fn Procedure() -> i32 { // CHECK:STDOUT: --- fail_return_var_no_returned_var.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Procedure: type = fn_type @Procedure [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Procedure = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Procedure = %Procedure +// CHECK:STDOUT: .Procedure = %Procedure.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Procedure: = fn_decl @Procedure [template] { +// CHECK:STDOUT: %Procedure.decl: Procedure = fn_decl @Procedure [template = constants.%struct] { // CHECK:STDOUT: @Procedure.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } 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 5a216f221379..57c9ce08791c 100644 --- a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon @@ -31,29 +31,34 @@ fn G() -> C { // CHECK:STDOUT: --- fail_return_with_returned_var.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %.3: type = unbound_element_type C, i32 [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct: C = struct_value (%.2, %.6) [template] +// CHECK:STDOUT: %.4: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.6: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.7: i32 = int_literal 2 [template] +// CHECK:STDOUT: %struct.3: C = struct_value (%.3, %.7) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @G.%return: ref C = var // CHECK:STDOUT: } @@ -73,9 +78,9 @@ fn G() -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign %v.var, %.loc8 -// CHECK:STDOUT: %.loc16: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc16: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -83,15 +88,15 @@ fn G() -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %c: ref C = bind_name c, %return -// CHECK:STDOUT: %.loc21_29: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc21_37: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc21_29: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc21_37: i32 = int_literal 2 [template = constants.%.7] // CHECK:STDOUT: %.loc21_38.1: {.a: i32, .b: i32} = struct_literal (%.loc21_29, %.loc21_37) // CHECK:STDOUT: %.loc21_38.2: ref i32 = class_element_access %return, element0 -// CHECK:STDOUT: %.loc21_38.3: init i32 = initialize_from %.loc21_29 to %.loc21_38.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc21_38.3: init i32 = initialize_from %.loc21_29 to %.loc21_38.2 [template = constants.%.3] // CHECK:STDOUT: %.loc21_38.4: ref i32 = class_element_access %return, element1 -// CHECK:STDOUT: %.loc21_38.5: init i32 = initialize_from %.loc21_37 to %.loc21_38.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc21_38.6: init C = class_init (%.loc21_38.3, %.loc21_38.5), %return [template = constants.%struct] -// CHECK:STDOUT: %.loc21_39: init C = converted %.loc21_38.1, %.loc21_38.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc21_38.5: init i32 = initialize_from %.loc21_37 to %.loc21_38.4 [template = constants.%.7] +// CHECK:STDOUT: %.loc21_38.6: init C = class_init (%.loc21_38.3, %.loc21_38.5), %return [template = constants.%struct.3] +// CHECK:STDOUT: %.loc21_39: init C = converted %.loc21_38.1, %.loc21_38.6 [template = constants.%struct.3] // CHECK:STDOUT: assign %return, %.loc21_39 // CHECK:STDOUT: %c.ref: ref C = name_ref c, %c // CHECK:STDOUT: return 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 c9116c957688..bb61a31be04c 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 @@ -18,16 +18,18 @@ fn Procedure() { // CHECK:STDOUT: --- fail_returned_var_no_return_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Procedure: type = fn_type @Procedure [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Procedure = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Procedure = %Procedure +// CHECK:STDOUT: .Procedure = %Procedure.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Procedure: = fn_decl @Procedure [template] {} +// CHECK:STDOUT: %Procedure.decl: Procedure = fn_decl @Procedure [template = constants.%struct] {} // 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 53c81804307f..cd6f880cdb19 100644 --- a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon @@ -38,64 +38,69 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: --- fail_returned_var_shadow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %SameScope: type = fn_type @SameScope [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: SameScope = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal true [template] +// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %DifferentScopes: type = fn_type @DifferentScopes [template] +// CHECK:STDOUT: %struct.2: DifferentScopes = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .SameScope = %SameScope -// CHECK:STDOUT: .DifferentScopes = %DifferentScopes +// CHECK:STDOUT: .SameScope = %SameScope.decl +// CHECK:STDOUT: .DifferentScopes = %DifferentScopes.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %SameScope: = fn_decl @SameScope [template] { +// CHECK:STDOUT: %SameScope.decl: SameScope = fn_decl @SameScope [template = constants.%struct.1] { // CHECK:STDOUT: @SameScope.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %DifferentScopes: = fn_decl @DifferentScopes [template] { +// CHECK:STDOUT: %DifferentScopes.decl: DifferentScopes = fn_decl @DifferentScopes [template = constants.%struct.2] { // CHECK:STDOUT: @DifferentScopes.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @SameScope() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc8 br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc9: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc9: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: assign %v.var, %.loc9 // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc17: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc17: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: assign %w.var, %.loc17 // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc19: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc19: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: return %.loc19 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @DifferentScopes() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc23: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc23: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc23 br !if.then.loc23 else br !if.else.loc23 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc23: // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc24: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc24: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: assign %v.var, %.loc24 -// CHECK:STDOUT: %.loc25: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc25: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc25 br !if.then.loc25 else br !if.else.loc25 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc25: // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc32: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc32: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: assign %w.var, %.loc32 // CHECK:STDOUT: br !if.else.loc25 // CHECK:STDOUT: @@ -103,7 +108,7 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: br !if.else.loc23 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc23: -// CHECK:STDOUT: %.loc35: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc35: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: return %.loc35 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_returned_var_type.carbon b/toolchain/check/testdata/return/fail_returned_var_type.carbon index bc2399354ee0..40b8049cfb14 100644 --- a/toolchain/check/testdata/return/fail_returned_var_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_type.carbon @@ -18,16 +18,19 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: --- fail_returned_var_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: f64 = float_literal 0 [template] +// CHECK:STDOUT: %Mismatch: type = fn_type @Mismatch [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Mismatch = struct_value () [template] +// CHECK:STDOUT: %.2: f64 = float_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Mismatch = %Mismatch +// CHECK:STDOUT: .Mismatch = %Mismatch.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Mismatch: = fn_decl @Mismatch [template] { +// CHECK:STDOUT: %Mismatch.decl: Mismatch = fn_decl @Mismatch [template = constants.%struct] { // CHECK:STDOUT: @Mismatch.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -35,7 +38,7 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: fn @Mismatch() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v: f64 = bind_name v, -// CHECK:STDOUT: %.loc14: f64 = float_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc14: f64 = float_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign , // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_type_mismatch.carbon b/toolchain/check/testdata/return/fail_type_mismatch.carbon index 67ef19669b8a..a3f7be889c84 100644 --- a/toolchain/check/testdata/return/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/return/fail_type_mismatch.carbon @@ -14,23 +14,26 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: f64 = float_literal 1 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: f64 = float_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] { +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: f64 = float_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11: f64 = float_literal 1 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_value_disallowed.carbon b/toolchain/check/testdata/return/fail_value_disallowed.carbon index a4b9dca7c744..1c6665803f9a 100644 --- a/toolchain/check/testdata/return/fail_value_disallowed.carbon +++ b/toolchain/check/testdata/return/fail_value_disallowed.carbon @@ -17,21 +17,24 @@ fn Main() { // CHECK:STDOUT: --- fail_value_disallowed.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc14: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_value_missing.carbon b/toolchain/check/testdata/return/fail_value_missing.carbon index f3afdb035d2f..0b2fb19bc7de 100644 --- a/toolchain/check/testdata/return/fail_value_missing.carbon +++ b/toolchain/check/testdata/return/fail_value_missing.carbon @@ -16,13 +16,19 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_value_missing.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] { +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_var_in_type.carbon b/toolchain/check/testdata/return/fail_var_in_type.carbon index b3e600562808..27f83d090d49 100644 --- a/toolchain/check/testdata/return/fail_var_in_type.carbon +++ b/toolchain/check/testdata/return/fail_var_in_type.carbon @@ -13,19 +13,22 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: --- fail_var_in_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 6 [template] +// CHECK:STDOUT: %Six: type = fn_type @Six [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Six = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .x = %x -// CHECK:STDOUT: .Six = %Six +// CHECK:STDOUT: .Six = %Six.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [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.decl: Six = fn_decl @Six [template = constants.%struct] { // CHECK:STDOUT: %x.ref: ref type = name_ref x, %x // CHECK:STDOUT: %.loc11: type = bind_value %x.ref // CHECK:STDOUT: @Six.%return: ref = var @@ -34,7 +37,7 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: i32 = int_literal 6 [template = constants.%.1] +// CHECK:STDOUT: %.loc11: i32 = int_literal 6 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: 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 618d20762fb5..ac851835cf5c 100644 --- a/toolchain/check/testdata/return/missing_return_no_return_type.carbon +++ b/toolchain/check/testdata/return/missing_return_no_return_type.carbon @@ -9,13 +9,19 @@ fn F() { // CHECK:STDOUT: --- missing_return_no_return_type.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // 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 e72b242131d7..68aba0880988 100644 --- a/toolchain/check/testdata/return/no_value.carbon +++ b/toolchain/check/testdata/return/no_value.carbon @@ -10,13 +10,19 @@ fn Main() { // CHECK:STDOUT: --- no_value.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // 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 18effd8e579b..e4d93b755219 100644 --- a/toolchain/check/testdata/return/returned_var.carbon +++ b/toolchain/check/testdata/return/returned_var.carbon @@ -25,27 +25,32 @@ fn G() -> i32 { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = unbound_element_type C, i32 [template] // CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %struct: C = struct_value (%.4, %.5) [template] -// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %struct.2: C = struct_value (%.5, %.6) [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.3: G = struct_value () [template] +// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @F.%return: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -64,15 +69,15 @@ fn G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %result: ref C = bind_name result, %return -// CHECK:STDOUT: %.loc13_34: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_42: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_34: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_42: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc13_43.1: {.a: i32, .b: i32} = struct_literal (%.loc13_34, %.loc13_42) // CHECK:STDOUT: %.loc13_43.2: ref i32 = class_element_access %return, element0 -// CHECK:STDOUT: %.loc13_43.3: init i32 = initialize_from %.loc13_34 to %.loc13_43.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_43.3: init i32 = initialize_from %.loc13_34 to %.loc13_43.2 [template = constants.%.5] // CHECK:STDOUT: %.loc13_43.4: ref i32 = class_element_access %return, element1 -// CHECK:STDOUT: %.loc13_43.5: init i32 = initialize_from %.loc13_42 to %.loc13_43.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_43.6: init C = class_init (%.loc13_43.3, %.loc13_43.5), %return [template = constants.%struct] -// CHECK:STDOUT: %.loc13_44: init C = converted %.loc13_43.1, %.loc13_43.6 [template = constants.%struct] +// CHECK:STDOUT: %.loc13_43.5: init i32 = initialize_from %.loc13_42 to %.loc13_43.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_43.6: init C = class_init (%.loc13_43.3, %.loc13_43.5), %return [template = constants.%struct.2] +// CHECK:STDOUT: %.loc13_44: init C = converted %.loc13_43.1, %.loc13_43.6 [template = constants.%struct.2] // CHECK:STDOUT: assign %return, %.loc13_44 // CHECK:STDOUT: return %result to %return // CHECK:STDOUT: } @@ -81,7 +86,7 @@ fn G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %result.var: ref i32 = var result // CHECK:STDOUT: %result: ref i32 = bind_name result, %result.var -// CHECK:STDOUT: %.loc18_30: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc18_30: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: assign %result.var, %.loc18_30 // CHECK:STDOUT: %.loc18_16: i32 = bind_value %result // CHECK:STDOUT: return %.loc18_16 diff --git a/toolchain/check/testdata/return/returned_var_scope.carbon b/toolchain/check/testdata/return/returned_var_scope.carbon index c7f639ce0268..855dd7bdcea5 100644 --- a/toolchain/check/testdata/return/returned_var_scope.carbon +++ b/toolchain/check/testdata/return/returned_var_scope.carbon @@ -26,22 +26,27 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: --- returned_var_scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %UnrelatedScopes: type = fn_type @UnrelatedScopes [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: UnrelatedScopes = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal true [template] +// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %EnclosingButAfter: type = fn_type @EnclosingButAfter [template] +// CHECK:STDOUT: %struct.2: EnclosingButAfter = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .UnrelatedScopes = %UnrelatedScopes -// CHECK:STDOUT: .EnclosingButAfter = %EnclosingButAfter +// CHECK:STDOUT: .UnrelatedScopes = %UnrelatedScopes.decl +// CHECK:STDOUT: .EnclosingButAfter = %EnclosingButAfter.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %UnrelatedScopes: = fn_decl @UnrelatedScopes [template] { +// CHECK:STDOUT: %UnrelatedScopes.decl: UnrelatedScopes = fn_decl @UnrelatedScopes [template = constants.%struct.1] { // CHECK:STDOUT: @UnrelatedScopes.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %EnclosingButAfter: = fn_decl @EnclosingButAfter [template] { +// CHECK:STDOUT: %EnclosingButAfter.decl: EnclosingButAfter = fn_decl @EnclosingButAfter [template = constants.%struct.2] { // CHECK:STDOUT: %b.loc17_22.1: bool = param b // CHECK:STDOUT: @EnclosingButAfter.%b: bool = bind_name b, %b.loc17_22.1 // CHECK:STDOUT: @EnclosingButAfter.%return: ref i32 = var @@ -50,29 +55,29 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @UnrelatedScopes() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc8 br !if.then.loc8 else br !if.else.loc8 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc8: // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc9: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc9: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: assign %v.var, %.loc9 // CHECK:STDOUT: br !if.else.loc8 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc8: -// CHECK:STDOUT: %.loc11: bool = bool_literal true [template = constants.%.1] +// CHECK:STDOUT: %.loc11: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: if %.loc11 br !if.then.loc11 else br !if.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc11: // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc12: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc12: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: assign %w.var, %.loc12 // CHECK:STDOUT: br !if.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc11: -// CHECK:STDOUT: %.loc14: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc14: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: return %.loc14 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -84,7 +89,7 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc19_27: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc19_27: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: assign %v.var, %.loc19_27 // CHECK:STDOUT: %.loc19_18: i32 = bind_value %v // CHECK:STDOUT: return %.loc19_18 @@ -92,7 +97,7 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: !if.else: // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: assign %w.var, %.loc22_25 // CHECK:STDOUT: %.loc22_16: i32 = bind_value %w // CHECK:STDOUT: return %.loc22_16 diff --git a/toolchain/check/testdata/return/struct.carbon b/toolchain/check/testdata/return/struct.carbon index 6bcab2b60bf4..599100760126 100644 --- a/toolchain/check/testdata/return/struct.carbon +++ b/toolchain/check/testdata/return/struct.carbon @@ -12,17 +12,20 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] -// CHECK:STDOUT: %struct: {.a: i32} = struct_value (%.2) [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Main = struct_value () [template] +// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] +// CHECK:STDOUT: %struct.2: {.a: i32} = struct_value (%.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] { +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.1] { // CHECK:STDOUT: %.loc7: type = struct_type {.a: i32} [template = constants.%.1] // CHECK:STDOUT: @Main.%return: ref {.a: i32} = var // CHECK:STDOUT: } @@ -30,10 +33,10 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> {.a: i32} { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 3 [template = constants.%.3] // CHECK:STDOUT: %.loc8_17: {.a: i32} = struct_literal (%.loc8_16) -// CHECK:STDOUT: %struct: {.a: i32} = struct_value (%.loc8_16) [template = constants.%struct] -// CHECK:STDOUT: %.loc8_18: {.a: i32} = converted %.loc8_17, %struct [template = constants.%struct] +// CHECK:STDOUT: %struct: {.a: i32} = struct_value (%.loc8_16) [template = constants.%struct.2] +// CHECK:STDOUT: %.loc8_18: {.a: i32} = converted %.loc8_17, %struct [template = constants.%struct.2] // CHECK:STDOUT: return %.loc8_18 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/tuple.carbon b/toolchain/check/testdata/return/tuple.carbon index c1e859f72f98..d03a6e82b6a2 100644 --- a/toolchain/check/testdata/return/tuple.carbon +++ b/toolchain/check/testdata/return/tuple.carbon @@ -14,19 +14,22 @@ fn Main() -> (i32, i32) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: i32 = int_literal 15 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 35 [template] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.4, %.5) [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 15 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 35 [template] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.5, %.6) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] { +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { // 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 @@ -35,13 +38,13 @@ fn Main() -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> %return: (i32, i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_11: i32 = int_literal 15 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_15: i32 = int_literal 35 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_11: i32 = int_literal 15 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_15: i32 = int_literal 35 [template = constants.%.6] // CHECK:STDOUT: %.loc9_17.1: (i32, i32) = tuple_literal (%.loc9_11, %.loc9_15) // CHECK:STDOUT: %.loc9_17.2: ref i32 = tuple_access %return, element0 -// CHECK:STDOUT: %.loc9_17.3: init i32 = initialize_from %.loc9_11 to %.loc9_17.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc9_17.3: init i32 = initialize_from %.loc9_11 to %.loc9_17.2 [template = constants.%.5] // CHECK:STDOUT: %.loc9_17.4: ref i32 = tuple_access %return, element1 -// CHECK:STDOUT: %.loc9_17.5: init i32 = initialize_from %.loc9_15 to %.loc9_17.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc9_17.5: init i32 = initialize_from %.loc9_15 to %.loc9_17.4 [template = constants.%.6] // CHECK:STDOUT: %.loc9_17.6: init (i32, i32) = tuple_init (%.loc9_17.3, %.loc9_17.5) to %return [template = constants.%tuple] // CHECK:STDOUT: %.loc9_18: init (i32, i32) = converted %.loc9_17.1, %.loc9_17.6 [template = constants.%tuple] // CHECK:STDOUT: return %.loc9_18 to %return diff --git a/toolchain/check/testdata/return/value.carbon b/toolchain/check/testdata/return/value.carbon index 37410bd42559..627c2e579048 100644 --- a/toolchain/check/testdata/return/value.carbon +++ b/toolchain/check/testdata/return/value.carbon @@ -11,23 +11,26 @@ fn Main() -> i32 { // CHECK:STDOUT: --- value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] { +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] { // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon index 409dedac0b44..9cd732e4d65c 100644 --- a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon +++ b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon @@ -12,13 +12,19 @@ fn F() { a.b; } // CHECK:STDOUT: --- fail_access_into_invalid.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] {} +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} // 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 31c69fcf023d..4f0b08ef9e2d 100644 --- a/toolchain/check/testdata/struct/fail_duplicate_name.carbon +++ b/toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -51,36 +51,39 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: --- fail_duplicate_name.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.4: type = struct_type {.b: i32, .c: i32} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.b: i32, .c: i32} [template] -// CHECK:STDOUT: %.6: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 4 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.5: type = struct_type {.b: i32, .c: i32} [template] +// CHECK:STDOUT: %.6: type = ptr_type {.b: i32, .c: i32} [template] +// CHECK:STDOUT: %.7: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.8: i32 = int_literal 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .x = %x // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: @F.%return: ref = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc23_35: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc23_35: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc23_36: {.a: i32} = struct_literal (%.loc23_35) // CHECK:STDOUT: %v: = bind_name v, -// CHECK:STDOUT: %.loc32_22: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc32_32: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc32_22: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc32_32: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: %w: i32 = bind_name w, -// CHECK:STDOUT: %.loc41: type = struct_type {.a: i32} [template = constants.%.2] +// CHECK:STDOUT: %.loc41: type = struct_type {.a: i32} [template = constants.%.3] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc49: type = struct_type {.b: i32, .c: i32} [template = constants.%.4] +// CHECK:STDOUT: %.loc49: type = struct_type {.b: i32, .c: i32} [template = constants.%.5] // CHECK:STDOUT: %y.var: ref {.b: i32, .c: i32} = var y // CHECK:STDOUT: %y: ref {.b: i32, .c: i32} = bind_name y, %y.var // CHECK:STDOUT: } @@ -89,11 +92,11 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc41_26: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc41_34: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc41_26: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc41_34: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: assign file.%x.var, -// CHECK:STDOUT: %.loc49_35: i32 = int_literal 3 [template = constants.%.6] -// CHECK:STDOUT: %.loc49_43: i32 = int_literal 4 [template = constants.%.7] +// CHECK:STDOUT: %.loc49_35: i32 = int_literal 3 [template = constants.%.7] +// CHECK:STDOUT: %.loc49_43: i32 = int_literal 4 [template = constants.%.8] // CHECK:STDOUT: assign file.%y.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_member_of_function.carbon b/toolchain/check/testdata/struct/fail_member_of_function.carbon index c5a34f4064a1..1fcd32d2bc12 100644 --- a/toolchain/check/testdata/struct/fail_member_of_function.carbon +++ b/toolchain/check/testdata/struct/fail_member_of_function.carbon @@ -13,18 +13,24 @@ fn A() { // CHECK:STDOUT: --- fail_member_of_function.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: A = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A +// CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] {} +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/literal_member_access.carbon b/toolchain/check/testdata/struct/literal_member_access.carbon index 745a521717b9..398b0108d285 100644 --- a/toolchain/check/testdata/struct/literal_member_access.carbon +++ b/toolchain/check/testdata/struct/literal_member_access.carbon @@ -14,26 +14,31 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = struct_type {.x: i32, .y: i32, .z: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: type = ptr_type {.x: i32, .y: i32, .z: i32} [template] -// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.5: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} [template] -// CHECK:STDOUT: %.6: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32} [template] -// CHECK:STDOUT: %.7: type = ptr_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32} [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: G = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: type = ptr_type {.x: i32, .y: i32, .z: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.6: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} [template] +// CHECK:STDOUT: %.7: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32} [template] +// CHECK:STDOUT: %.8: type = ptr_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -42,11 +47,11 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_25.1: ref {.x: i32, .y: i32, .z: i32} = temporary_storage // CHECK:STDOUT: %G.call: init {.x: i32, .y: i32, .z: i32} = call %G.ref() to %.loc10_25.1 -// CHECK:STDOUT: %.loc10_34: i32 = int_literal 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_34: i32 = int_literal 3 [template = constants.%.5] // CHECK:STDOUT: %.loc10_35.1: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = struct_literal (%.loc10_16, %G.call, %.loc10_34) // CHECK:STDOUT: %.loc10_25.2: ref {.x: i32, .y: i32, .z: i32} = temporary %.loc10_25.1, %G.call // CHECK:STDOUT: %.loc10_25.3: ref i32 = struct_access %.loc10_25.2, element0 diff --git a/toolchain/check/testdata/struct/nested_struct_in_place.carbon b/toolchain/check/testdata/struct/nested_struct_in_place.carbon index 64c9169341c5..e04080325afb 100644 --- a/toolchain/check/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/check/testdata/struct/nested_struct_in_place.carbon @@ -15,25 +15,30 @@ fn G() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type (type, type, type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.3: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template] -// CHECK:STDOUT: %.4: type = ptr_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.5: type = struct_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template] +// CHECK:STDOUT: %.5: type = ptr_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.6: type = struct_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} [template] +// CHECK:STDOUT: %.7: type = ptr_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %G: = fn_decl @G [template] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> (i32, i32, i32); @@ -44,13 +49,13 @@ fn G() { // CHECK:STDOUT: %.loc10_29.2: type = converted %.loc10_29.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %.loc10_50.1: (type, type, type) = tuple_literal (i32, i32, i32) // CHECK:STDOUT: %.loc10_50.2: type = converted %.loc10_50.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_51: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template = constants.%.3] +// CHECK:STDOUT: %.loc10_51: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template = constants.%.4] // CHECK:STDOUT: %v.var: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = var v // CHECK:STDOUT: %v: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10_61: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref.loc10_61: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_74.1: ref (i32, i32, i32) = struct_access %v.var, element0 // CHECK:STDOUT: %F.call.loc10_62: init (i32, i32, i32) = call %F.ref.loc10_61() to %.loc10_74.1 -// CHECK:STDOUT: %F.ref.loc10_71: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref.loc10_71: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_74.2: ref (i32, i32, i32) = struct_access %v.var, element1 // CHECK:STDOUT: %F.call.loc10_72: init (i32, i32, i32) = call %F.ref.loc10_71() to %.loc10_74.2 // CHECK:STDOUT: %.loc10_74.3: {.a: (i32, i32, i32), .b: (i32, i32, i32)} = struct_literal (%F.call.loc10_62, %F.call.loc10_72) diff --git a/toolchain/check/testdata/struct/reorder_fields.carbon b/toolchain/check/testdata/struct/reorder_fields.carbon index 7300250f9a1f..7faeb69ce1f5 100644 --- a/toolchain/check/testdata/struct/reorder_fields.carbon +++ b/toolchain/check/testdata/struct/reorder_fields.carbon @@ -16,28 +16,35 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: --- reorder_fields.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: f64} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: f64} [template] -// CHECK:STDOUT: %.3: type = struct_type {.b: f64, .a: i32} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.b: f64, .a: i32} [template] +// CHECK:STDOUT: %MakeI32: type = fn_type @MakeI32 [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: MakeI32 = struct_value () [template] +// CHECK:STDOUT: %MakeF64: type = fn_type @MakeF64 [template] +// CHECK:STDOUT: %struct.2: MakeF64 = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: f64} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.3: F = struct_value () [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: f64} [template] +// CHECK:STDOUT: %.4: type = struct_type {.b: f64, .a: i32} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.b: f64, .a: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .MakeI32 = %MakeI32 -// CHECK:STDOUT: .MakeF64 = %MakeF64 -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .MakeI32 = %MakeI32.decl +// CHECK:STDOUT: .MakeF64 = %MakeF64.decl +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %MakeI32: = fn_decl @MakeI32 [template] { +// CHECK:STDOUT: %MakeI32.decl: MakeI32 = fn_decl @MakeI32 [template = constants.%struct.1] { // CHECK:STDOUT: @MakeI32.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %MakeF64: = fn_decl @MakeF64 [template] { +// CHECK:STDOUT: %MakeF64.decl: MakeF64 = fn_decl @MakeF64 [template = constants.%struct.2] { // CHECK:STDOUT: @MakeF64.%return: ref f64 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] { -// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32, .b: f64} [template = constants.%.1] +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32, .b: f64} [template = constants.%.2] // CHECK:STDOUT: @F.%return: ref {.a: i32, .b: f64} = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -48,10 +55,10 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: {.a: i32, .b: f64} { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_27: type = struct_type {.a: i32, .b: f64} [template = constants.%.1] -// CHECK:STDOUT: %MakeF64.ref: = name_ref MakeF64, file.%MakeF64 [template = file.%MakeF64] +// CHECK:STDOUT: %.loc11_27: type = struct_type {.a: i32, .b: f64} [template = constants.%.2] +// CHECK:STDOUT: %MakeF64.ref: MakeF64 = name_ref MakeF64, file.%MakeF64.decl [template = constants.%struct.2] // CHECK:STDOUT: %MakeF64.call: init f64 = call %MakeF64.ref() -// CHECK:STDOUT: %MakeI32.ref: = name_ref MakeI32, file.%MakeI32 [template = file.%MakeI32] +// CHECK:STDOUT: %MakeI32.ref: MakeI32 = name_ref MakeI32, file.%MakeI32.decl [template = constants.%struct.1] // CHECK:STDOUT: %MakeI32.call: init i32 = call %MakeI32.ref() // CHECK:STDOUT: %.loc11_62.1: {.b: f64, .a: i32} = struct_literal (%MakeF64.call, %MakeI32.call) // CHECK:STDOUT: %.loc11_62.2: i32 = value_of_initializer %MakeI32.call @@ -61,7 +68,7 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: %struct.loc11: {.a: i32, .b: f64} = struct_value (%.loc11_62.3, %.loc11_62.5) // CHECK:STDOUT: %.loc11_63: {.a: i32, .b: f64} = converted %.loc11_62.1, %struct.loc11 // CHECK:STDOUT: %x: {.a: i32, .b: f64} = bind_name x, %.loc11_63 -// CHECK:STDOUT: %.loc12_27: type = struct_type {.b: f64, .a: i32} [template = constants.%.3] +// CHECK:STDOUT: %.loc12_27: type = struct_type {.b: f64, .a: i32} [template = constants.%.4] // CHECK:STDOUT: %x.ref: {.a: i32, .b: f64} = name_ref x, %x // CHECK:STDOUT: %.loc12_31.1: f64 = struct_access %x.ref, element1 // CHECK:STDOUT: %.loc12_31.2: i32 = struct_access %x.ref, element0 diff --git a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon index f0af2ed6e091..b5e6b9277892 100644 --- a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon +++ b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon @@ -19,34 +19,41 @@ fn H() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type (type, type, type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.3: type = tuple_type ((type, type, type), (type, type, type)) [template] -// CHECK:STDOUT: %.4: type = tuple_type ((i32, i32, i32), (i32, i32, i32)) [template] -// CHECK:STDOUT: %.5: type = ptr_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.6: type = tuple_type ((i32, i32, i32)*, (i32, i32, i32)*) [template] -// CHECK:STDOUT: %.7: type = ptr_type ((i32, i32, i32)*, (i32, i32, i32)*) [template] -// CHECK:STDOUT: %.8: type = tuple_type (type, (type, type, type), type) [template] -// CHECK:STDOUT: %.9: type = tuple_type (i32, (i32, i32, i32), i32) [template] -// CHECK:STDOUT: %.10: type = tuple_type (i32, (i32, i32, i32)*, i32) [template] -// CHECK:STDOUT: %.11: type = ptr_type (i32, (i32, i32, i32)*, i32) [template] -// CHECK:STDOUT: %.12: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.13: i32 = int_literal 2 [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.2: G = struct_value () [template] +// CHECK:STDOUT: %.4: type = tuple_type ((type, type, type), (type, type, type)) [template] +// CHECK:STDOUT: %.5: type = tuple_type ((i32, i32, i32), (i32, i32, i32)) [template] +// CHECK:STDOUT: %.6: type = ptr_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.7: type = tuple_type ((i32, i32, i32)*, (i32, i32, i32)*) [template] +// CHECK:STDOUT: %.8: type = ptr_type ((i32, i32, i32)*, (i32, i32, i32)*) [template] +// CHECK:STDOUT: %H: type = fn_type @H [template] +// CHECK:STDOUT: %struct.3: H = struct_value () [template] +// CHECK:STDOUT: %.9: type = tuple_type (type, (type, type, type), type) [template] +// CHECK:STDOUT: %.10: type = tuple_type (i32, (i32, i32, i32), i32) [template] +// CHECK:STDOUT: %.11: type = tuple_type (i32, (i32, i32, i32)*, i32) [template] +// CHECK:STDOUT: %.12: type = ptr_type (i32, (i32, i32, i32)*, i32) [template] +// CHECK:STDOUT: %.13: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.14: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .H = %H +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .H = %H.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { // 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: } -// CHECK:STDOUT: %G: = fn_decl @G [template] {} -// CHECK:STDOUT: %H: = fn_decl @H [template] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> (i32, i32, i32); @@ -58,13 +65,13 @@ fn H() { // CHECK:STDOUT: %.loc10_43.1: ((type, type, type), (type, type, type)) = tuple_literal (%.loc10_25, %.loc10_42) // CHECK:STDOUT: %.loc10_43.2: type = converted %.loc10_25, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %.loc10_43.3: type = converted %.loc10_42, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_43.4: type = converted %.loc10_43.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_43.4: type = converted %.loc10_43.1, constants.%.5 [template = constants.%.5] // CHECK:STDOUT: %v.var: ref ((i32, i32, i32), (i32, i32, i32)) = var v // CHECK:STDOUT: %v: ref ((i32, i32, i32), (i32, i32, i32)) = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10_48: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref.loc10_48: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_56.1: ref (i32, i32, i32) = tuple_access %v.var, element0 // CHECK:STDOUT: %F.call.loc10_49: init (i32, i32, i32) = call %F.ref.loc10_48() to %.loc10_56.1 -// CHECK:STDOUT: %F.ref.loc10_53: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref.loc10_53: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc10_56.2: ref (i32, i32, i32) = tuple_access %v.var, element1 // CHECK:STDOUT: %F.call.loc10_54: init (i32, i32, i32) = call %F.ref.loc10_53() to %.loc10_56.2 // CHECK:STDOUT: %.loc10_56.3: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%F.call.loc10_49, %F.call.loc10_54) @@ -79,19 +86,19 @@ fn H() { // CHECK:STDOUT: %.loc14_30: (type, type, type) = tuple_literal (i32, i32, i32) // CHECK:STDOUT: %.loc14_36.1: (type, (type, type, type), type) = tuple_literal (i32, %.loc14_30, i32) // CHECK:STDOUT: %.loc14_36.2: type = converted %.loc14_30, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc14_36.3: type = converted %.loc14_36.1, constants.%.9 [template = constants.%.9] +// CHECK:STDOUT: %.loc14_36.3: type = converted %.loc14_36.1, constants.%.10 [template = constants.%.10] // CHECK:STDOUT: %v.var: ref (i32, (i32, i32, i32), i32) = var v // CHECK:STDOUT: %v: ref (i32, (i32, i32, i32), i32) = bind_name v, %v.var -// CHECK:STDOUT: %.loc14_41: i32 = int_literal 1 [template = constants.%.12] -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %.loc14_41: i32 = int_literal 1 [template = constants.%.13] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %.loc14_50.1: ref (i32, i32, i32) = tuple_access %v.var, element1 // CHECK:STDOUT: %F.call: init (i32, i32, i32) = call %F.ref() to %.loc14_50.1 -// CHECK:STDOUT: %.loc14_49: i32 = int_literal 2 [template = constants.%.13] +// CHECK:STDOUT: %.loc14_49: i32 = int_literal 2 [template = constants.%.14] // CHECK:STDOUT: %.loc14_50.2: (i32, (i32, i32, i32), i32) = tuple_literal (%.loc14_41, %F.call, %.loc14_49) // CHECK:STDOUT: %.loc14_50.3: ref i32 = tuple_access %v.var, element0 -// CHECK:STDOUT: %.loc14_50.4: init i32 = initialize_from %.loc14_41 to %.loc14_50.3 [template = constants.%.12] +// CHECK:STDOUT: %.loc14_50.4: init i32 = initialize_from %.loc14_41 to %.loc14_50.3 [template = constants.%.13] // CHECK:STDOUT: %.loc14_50.5: ref i32 = tuple_access %v.var, element2 -// CHECK:STDOUT: %.loc14_50.6: init i32 = initialize_from %.loc14_49 to %.loc14_50.5 [template = constants.%.13] +// CHECK:STDOUT: %.loc14_50.6: init i32 = initialize_from %.loc14_49 to %.loc14_50.5 [template = constants.%.14] // CHECK:STDOUT: %.loc14_50.7: init (i32, (i32, i32, i32), i32) = tuple_init (%.loc14_50.4, %F.call, %.loc14_50.6) to %v.var // CHECK:STDOUT: %.loc14_51: init (i32, (i32, i32, i32), i32) = converted %.loc14_50.2, %.loc14_50.7 // CHECK:STDOUT: assign %v.var, %.loc14_51 diff --git a/toolchain/check/testdata/var/fail_not_copyable.carbon b/toolchain/check/testdata/var/fail_not_copyable.carbon index d96d1cffaf9c..01a70f706c75 100644 --- a/toolchain/check/testdata/var/fail_not_copyable.carbon +++ b/toolchain/check/testdata/var/fail_not_copyable.carbon @@ -28,7 +28,9 @@ fn F(x: X) { // CHECK:STDOUT: constants { // CHECK:STDOUT: %X: type = class_type @X [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %struct: F = struct_value () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] // CHECK:STDOUT: %.4: type = ptr_type String [template] // CHECK:STDOUT: %.5: String = string_literal "hello" [template] @@ -38,11 +40,11 @@ fn F(x: X) { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .X = %X.decl -// CHECK:STDOUT: .F = %F +// CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {} -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // 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 diff --git a/toolchain/check/testdata/var/fail_storage_is_literal.carbon b/toolchain/check/testdata/var/fail_storage_is_literal.carbon index 21ca11b139c0..30a990be2f3b 100644 --- a/toolchain/check/testdata/var/fail_storage_is_literal.carbon +++ b/toolchain/check/testdata/var/fail_storage_is_literal.carbon @@ -14,24 +14,27 @@ fn Main() { // CHECK:STDOUT: --- fail_storage_is_literal.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_10: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_10: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %x.var: ref = var x // CHECK:STDOUT: %x: ref = bind_name x, %x.var -// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/no_prelude/decl.carbon b/toolchain/check/testdata/var/no_prelude/decl.carbon index 3ac6fde1339f..fddbf8a16052 100644 --- a/toolchain/check/testdata/var/no_prelude/decl.carbon +++ b/toolchain/check/testdata/var/no_prelude/decl.carbon @@ -11,14 +11,16 @@ fn Main() { // CHECK:STDOUT: --- decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/no_prelude/decl_with_init.carbon b/toolchain/check/testdata/var/no_prelude/decl_with_init.carbon index dfbe6947fe80..6c3f7058b468 100644 --- a/toolchain/check/testdata/var/no_prelude/decl_with_init.carbon +++ b/toolchain/check/testdata/var/no_prelude/decl_with_init.carbon @@ -11,15 +11,17 @@ fn Main() { // CHECK:STDOUT: --- decl_with_init.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon b/toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon index 279c5f46f43e..d5ffd3133d03 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon @@ -19,15 +19,17 @@ fn Main() { // CHECK:STDOUT: --- fail_duplicate_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/no_prelude/fail_generic.carbon b/toolchain/check/testdata/var/no_prelude/fail_generic.carbon index d2ff01162094..fad353384a69 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_generic.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_generic.carbon @@ -14,16 +14,18 @@ fn Main() { // CHECK:STDOUT: --- fail_generic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] // CHECK:STDOUT: %x: () = bind_symbolic_name x 0 [symbolic] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/no_prelude/fail_init_type_mismatch.carbon b/toolchain/check/testdata/var/no_prelude/fail_init_type_mismatch.carbon index dc2babc5340c..2df9244f04f7 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_init_type_mismatch.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_init_type_mismatch.carbon @@ -14,21 +14,23 @@ fn Main() { // CHECK:STDOUT: --- fail_init_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc11_11.1: {} = struct_literal () -// CHECK:STDOUT: %.loc11_11.2: type = converted %.loc11_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_11.2: type = converted %.loc11_11.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {} = var x // CHECK:STDOUT: %x: ref {} = bind_name x, %x.var // CHECK:STDOUT: %.loc11_16: () = tuple_literal () diff --git a/toolchain/check/testdata/var/no_prelude/fail_init_with_self.carbon b/toolchain/check/testdata/var/no_prelude/fail_init_with_self.carbon index f2aa6467131e..39766f3b909a 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_init_with_self.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_init_with_self.carbon @@ -14,14 +14,16 @@ fn Main() { // CHECK:STDOUT: --- fail_init_with_self.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/no_prelude/fail_lookup_outside_scope.carbon b/toolchain/check/testdata/var/no_prelude/fail_lookup_outside_scope.carbon index e640f90bd820..ad27edc8ee85 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_lookup_outside_scope.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_lookup_outside_scope.carbon @@ -16,15 +16,17 @@ var y: () = x; // CHECK:STDOUT: --- fail_lookup_outside_scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: %.loc14_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc14_9.2: type = converted %.loc14_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %y.var: ref () = var y diff --git a/toolchain/check/testdata/var/no_prelude/global_lookup_in_scope.carbon b/toolchain/check/testdata/var/no_prelude/global_lookup_in_scope.carbon index 8d99acc8a814..729d5bcb6ed0 100644 --- a/toolchain/check/testdata/var/no_prelude/global_lookup_in_scope.carbon +++ b/toolchain/check/testdata/var/no_prelude/global_lookup_in_scope.carbon @@ -16,20 +16,22 @@ fn Main() { // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %.2: type = struct_type {.v: ()} [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] -// CHECK:STDOUT: %struct: {.v: ()} = struct_value (%tuple) [template] +// CHECK:STDOUT: %struct.1: {.v: ()} = struct_value (%tuple) [template] +// CHECK:STDOUT: %Main: type = fn_type @Main [template] +// CHECK:STDOUT: %struct.2: Main = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .x = %x -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %.loc7_14.1: () = tuple_literal () // CHECK:STDOUT: %.loc7_14.2: type = converted %.loc7_14.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %.loc7_15: type = struct_type {.v: ()} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.v: ()} = var x // CHECK:STDOUT: %x: ref {.v: ()} = bind_name x, %x.var -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { @@ -44,8 +46,8 @@ fn Main() { // CHECK:STDOUT: %.loc10_21.2: ref () = struct_access %y.var, element0 // CHECK:STDOUT: %.loc10_21.3: init () = tuple_init () to %.loc10_21.2 [template = constants.%tuple] // CHECK:STDOUT: %.loc10_21.4: init () = converted %.loc10_21.1, %.loc10_21.3 [template = constants.%tuple] -// CHECK:STDOUT: %.loc10_21.5: init {.v: ()} = struct_init (%.loc10_21.4) to %y.var [template = constants.%struct] -// CHECK:STDOUT: %.loc10_22: init {.v: ()} = converted %x.ref, %.loc10_21.5 [template = constants.%struct] +// CHECK:STDOUT: %.loc10_21.5: init {.v: ()} = struct_init (%.loc10_21.4) to %y.var [template = constants.%struct.1] +// CHECK:STDOUT: %.loc10_22: init {.v: ()} = converted %x.ref, %.loc10_21.5 [template = constants.%struct.1] // CHECK:STDOUT: assign %y.var, %.loc10_22 // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -57,8 +59,8 @@ fn Main() { // CHECK:STDOUT: %.loc7_27.2: ref () = struct_access file.%x.var, element0 // CHECK:STDOUT: %.loc7_26.2: init () = tuple_init () to %.loc7_27.2 [template = constants.%tuple] // CHECK:STDOUT: %.loc7_27.3: init () = converted %.loc7_26.1, %.loc7_26.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_27.4: init {.v: ()} = struct_init (%.loc7_27.3) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc7_28: init {.v: ()} = converted %.loc7_27.1, %.loc7_27.4 [template = constants.%struct] +// CHECK:STDOUT: %.loc7_27.4: init {.v: ()} = struct_init (%.loc7_27.3) to file.%x.var [template = constants.%struct.1] +// CHECK:STDOUT: %.loc7_28: init {.v: ()} = converted %.loc7_27.1, %.loc7_27.4 [template = constants.%struct.1] // CHECK:STDOUT: assign file.%x.var, %.loc7_28 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/no_prelude/lookup.carbon b/toolchain/check/testdata/var/no_prelude/lookup.carbon index 94b449fd2904..f74fab09b5e2 100644 --- a/toolchain/check/testdata/var/no_prelude/lookup.carbon +++ b/toolchain/check/testdata/var/no_prelude/lookup.carbon @@ -12,15 +12,17 @@ fn Main() { // CHECK:STDOUT: --- lookup.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/no_prelude/shadowing.carbon b/toolchain/check/testdata/var/no_prelude/shadowing.carbon index f28447e4fcb9..ca0735b4854d 100644 --- a/toolchain/check/testdata/var/no_prelude/shadowing.carbon +++ b/toolchain/check/testdata/var/no_prelude/shadowing.carbon @@ -22,7 +22,9 @@ fn Main() { // CHECK:STDOUT: --- shadowing.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Main: type = fn_type @Main [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: Main = struct_value () [template] // CHECK:STDOUT: %tuple: () = tuple_value () [template] // CHECK:STDOUT: %.2: bool = bool_literal true [template] // CHECK:STDOUT: } @@ -30,10 +32,10 @@ fn Main() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .NS = %NS -// CHECK:STDOUT: .Main = %Main +// CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %NS: = namespace [template] {} -// CHECK:STDOUT: %Main: = fn_decl @Main [template] {} +// CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} // 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 e8abd2e487ae..34027557cddc 100644 --- a/toolchain/check/testdata/while/break_continue.carbon +++ b/toolchain/check/testdata/while/break_continue.carbon @@ -28,45 +28,67 @@ fn While() { // CHECK:STDOUT: --- break_continue.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = fn_type @A [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: A = struct_value () [template] +// CHECK:STDOUT: %B: type = fn_type @B [template] +// CHECK:STDOUT: %struct.2: B = struct_value () [template] +// CHECK:STDOUT: %C: type = fn_type @C [template] +// CHECK:STDOUT: %struct.3: C = struct_value () [template] +// CHECK:STDOUT: %D: type = fn_type @D [template] +// CHECK:STDOUT: %struct.4: D = struct_value () [template] +// CHECK:STDOUT: %E: type = fn_type @E [template] +// CHECK:STDOUT: %struct.5: E = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.6: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.7: G = struct_value () [template] +// CHECK:STDOUT: %H: type = fn_type @H [template] +// CHECK:STDOUT: %struct.8: H = struct_value () [template] +// CHECK:STDOUT: %While: type = fn_type @While [template] +// CHECK:STDOUT: %struct.9: While = struct_value () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .B = %B -// CHECK:STDOUT: .C = %C -// CHECK:STDOUT: .D = %D -// CHECK:STDOUT: .E = %E -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .H = %H -// CHECK:STDOUT: .While = %While +// CHECK:STDOUT: .A = %A.decl +// CHECK:STDOUT: .B = %B.decl +// CHECK:STDOUT: .C = %C.decl +// CHECK:STDOUT: .D = %D.decl +// CHECK:STDOUT: .E = %E.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .H = %H.decl +// CHECK:STDOUT: .While = %While.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A: = fn_decl @A [template] { +// CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { // CHECK:STDOUT: @A.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %B: = fn_decl @B [template] { +// CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { // CHECK:STDOUT: @B.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %C: = fn_decl @C [template] { +// CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { // CHECK:STDOUT: @C.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %D: = fn_decl @D [template] { +// CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] { // CHECK:STDOUT: @D.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %E: = fn_decl @E [template] { +// CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.5] { // CHECK:STDOUT: @E.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %F: = fn_decl @F [template] { +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.6] { // CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %G: = fn_decl @G [template] { +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.7] { // CHECK:STDOUT: @G.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %H: = fn_decl @H [template] { +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.8] { // CHECK:STDOUT: @H.%return: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %While: = fn_decl @While [template] {} +// CHECK:STDOUT: %While.decl: While = fn_decl @While [template = constants.%struct.9] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> bool; @@ -90,14 +112,14 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !while.cond.loc17: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.1] // CHECK:STDOUT: %A.call: init bool = call %A.ref() // CHECK:STDOUT: %.loc17_13.1: bool = value_of_initializer %A.call // CHECK:STDOUT: %.loc17_13.2: bool = converted %A.call, %.loc17_13.1 // CHECK:STDOUT: if %.loc17_13.2 br !while.body.loc17 else br !while.done.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !while.body.loc17: -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B [template = file.%B] +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.2] // CHECK:STDOUT: %B.call: init bool = call %B.ref() // CHECK:STDOUT: %.loc18_12.1: bool = value_of_initializer %B.call // CHECK:STDOUT: %.loc18_12.2: bool = converted %B.call, %.loc18_12.1 @@ -107,7 +129,7 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc18: -// CHECK:STDOUT: %C.ref: = name_ref C, file.%C [template = file.%C] +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.3] // CHECK:STDOUT: %C.call: init bool = call %C.ref() // CHECK:STDOUT: %.loc19_12.1: bool = value_of_initializer %C.call // CHECK:STDOUT: %.loc19_12.2: bool = converted %C.call, %.loc19_12.1 @@ -120,14 +142,14 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !while.cond.loc20: -// CHECK:STDOUT: %D.ref: = name_ref D, file.%D [template = file.%D] +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.4] // CHECK:STDOUT: %D.call: init bool = call %D.ref() // CHECK:STDOUT: %.loc20_15.1: bool = value_of_initializer %D.call // CHECK:STDOUT: %.loc20_15.2: bool = converted %D.call, %.loc20_15.1 // CHECK:STDOUT: if %.loc20_15.2 br !while.body.loc20 else br !while.done.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !while.body.loc20: -// CHECK:STDOUT: %E.ref: = name_ref E, file.%E [template = file.%E] +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.5] // CHECK:STDOUT: %E.call: init bool = call %E.ref() // CHECK:STDOUT: %.loc21_14.1: bool = value_of_initializer %E.call // CHECK:STDOUT: %.loc21_14.2: bool = converted %E.call, %.loc21_14.1 @@ -137,7 +159,7 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc21: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.6] // CHECK:STDOUT: %F.call: init bool = call %F.ref() // CHECK:STDOUT: %.loc22_14.1: bool = value_of_initializer %F.call // CHECK:STDOUT: %.loc22_14.2: bool = converted %F.call, %.loc22_14.1 @@ -150,7 +172,7 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !while.done.loc20: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.7] // CHECK:STDOUT: %G.call: init bool = call %G.ref() // CHECK:STDOUT: %.loc24_12.1: bool = value_of_initializer %G.call // CHECK:STDOUT: %.loc24_12.2: bool = converted %G.call, %.loc24_12.1 @@ -160,7 +182,7 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc24: -// CHECK:STDOUT: %H.ref: = name_ref H, file.%H [template = file.%H] +// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.8] // CHECK:STDOUT: %H.call: init bool = call %H.ref() // CHECK:STDOUT: %.loc25_12.1: bool = value_of_initializer %H.call // CHECK:STDOUT: %.loc25_12.2: bool = converted %H.call, %.loc25_12.1 diff --git a/toolchain/check/testdata/while/fail_bad_condition.carbon b/toolchain/check/testdata/while/fail_bad_condition.carbon index 840579d4da66..8603a59a1fa5 100644 --- a/toolchain/check/testdata/while/fail_bad_condition.carbon +++ b/toolchain/check/testdata/while/fail_bad_condition.carbon @@ -14,17 +14,20 @@ fn While() { // CHECK:STDOUT: --- fail_bad_condition.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type String [template] -// CHECK:STDOUT: %.2: String = string_literal "Hello" [template] +// CHECK:STDOUT: %While: type = fn_type @While [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: While = struct_value () [template] +// CHECK:STDOUT: %.2: type = ptr_type String [template] +// CHECK:STDOUT: %.3: String = string_literal "Hello" [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .While = %While +// CHECK:STDOUT: .While = %While.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %While: = fn_decl @While [template] {} +// CHECK:STDOUT: %While.decl: While = fn_decl @While [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @While() { @@ -32,7 +35,7 @@ fn While() { // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.cond: -// CHECK:STDOUT: %.loc11: String = string_literal "Hello" [template = constants.%.2] +// CHECK:STDOUT: %.loc11: String = string_literal "Hello" [template = constants.%.3] // CHECK:STDOUT: if br !while.body else br !while.done // CHECK:STDOUT: // CHECK:STDOUT: !while.body: diff --git a/toolchain/check/testdata/while/fail_break_continue.carbon b/toolchain/check/testdata/while/fail_break_continue.carbon index db85558116af..d6b13ad8bb9e 100644 --- a/toolchain/check/testdata/while/fail_break_continue.carbon +++ b/toolchain/check/testdata/while/fail_break_continue.carbon @@ -33,16 +33,19 @@ fn While() { // CHECK:STDOUT: --- fail_break_continue.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal false [template] +// CHECK:STDOUT: %While: type = fn_type @While [template] +// CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct: While = struct_value () [template] +// CHECK:STDOUT: %.2: bool = bool_literal false [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .While = %While +// CHECK:STDOUT: .While = %While.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %While: = fn_decl @While [template] {} +// CHECK:STDOUT: %While.decl: While = fn_decl @While [template = constants.%struct] {} // 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 faf660897c0a..66c0057040c2 100644 --- a/toolchain/check/testdata/while/unreachable_end.carbon +++ b/toolchain/check/testdata/while/unreachable_end.carbon @@ -22,26 +22,36 @@ fn While() { // CHECK:STDOUT: --- unreachable_end.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Cond: type = fn_type @Cond [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Cond = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.3: G = struct_value () [template] +// CHECK:STDOUT: %H: type = fn_type @H [template] +// CHECK:STDOUT: %struct.4: H = struct_value () [template] +// CHECK:STDOUT: %While: type = fn_type @While [template] +// CHECK:STDOUT: %struct.5: While = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Cond = %Cond -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .H = %H -// CHECK:STDOUT: .While = %While +// CHECK:STDOUT: .Cond = %Cond.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .H = %H.decl +// CHECK:STDOUT: .While = %While.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Cond: = fn_decl @Cond [template] { +// CHECK:STDOUT: %Cond.decl: Cond = fn_decl @Cond [template = constants.%struct.1] { // CHECK:STDOUT: @Cond.%return: ref bool = var // CHECK:STDOUT: } -// 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: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.4] {} +// CHECK:STDOUT: %While.decl: While = fn_decl @While [template = constants.%struct.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Cond() -> bool; @@ -54,24 +64,24 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: fn @While() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.cond: -// CHECK:STDOUT: %Cond.ref: = name_ref Cond, file.%Cond [template = file.%Cond] +// CHECK:STDOUT: %Cond.ref: Cond = name_ref Cond, file.%Cond.decl [template = constants.%struct.1] // CHECK:STDOUT: %Cond.call: init bool = call %Cond.ref() // CHECK:STDOUT: %.loc15_16.1: bool = value_of_initializer %Cond.call // CHECK:STDOUT: %.loc15_16.2: bool = converted %Cond.call, %.loc15_16.1 // CHECK:STDOUT: if %.loc15_16.2 br !while.body else br !while.done // CHECK:STDOUT: // CHECK:STDOUT: !while.body: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %G.call: init () = call %G.ref() // CHECK:STDOUT: return // CHECK:STDOUT: // CHECK:STDOUT: !while.done: -// CHECK:STDOUT: %H.ref: = name_ref H, file.%H [template = file.%H] +// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.4] // CHECK:STDOUT: %H.call: init () = call %H.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/while/while.carbon b/toolchain/check/testdata/while/while.carbon index 45182af69e4b..a8dfa40bc675 100644 --- a/toolchain/check/testdata/while/while.carbon +++ b/toolchain/check/testdata/while/while.carbon @@ -21,26 +21,36 @@ fn While() { // CHECK:STDOUT: --- while.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Cond: type = fn_type @Cond [template] // CHECK:STDOUT: %.1: type = tuple_type () [template] +// CHECK:STDOUT: %struct.1: Cond = struct_value () [template] +// CHECK:STDOUT: %F: type = fn_type @F [template] +// CHECK:STDOUT: %struct.2: F = struct_value () [template] +// CHECK:STDOUT: %G: type = fn_type @G [template] +// CHECK:STDOUT: %struct.3: G = struct_value () [template] +// CHECK:STDOUT: %H: type = fn_type @H [template] +// CHECK:STDOUT: %struct.4: H = struct_value () [template] +// CHECK:STDOUT: %While: type = fn_type @While [template] +// CHECK:STDOUT: %struct.5: While = struct_value () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Cond = %Cond -// CHECK:STDOUT: .F = %F -// CHECK:STDOUT: .G = %G -// CHECK:STDOUT: .H = %H -// CHECK:STDOUT: .While = %While +// CHECK:STDOUT: .Cond = %Cond.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: .G = %G.decl +// CHECK:STDOUT: .H = %H.decl +// CHECK:STDOUT: .While = %While.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Cond: = fn_decl @Cond [template] { +// CHECK:STDOUT: %Cond.decl: Cond = fn_decl @Cond [template = constants.%struct.1] { // CHECK:STDOUT: @Cond.%return: ref bool = var // CHECK:STDOUT: } -// 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: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] {} +// CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.4] {} +// CHECK:STDOUT: %While.decl: While = fn_decl @While [template = constants.%struct.5] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Cond() -> bool; @@ -53,24 +63,24 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: fn @While() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init () = call %F.ref() // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.cond: -// CHECK:STDOUT: %Cond.ref: = name_ref Cond, file.%Cond [template = file.%Cond] +// CHECK:STDOUT: %Cond.ref: Cond = name_ref Cond, file.%Cond.decl [template = constants.%struct.1] // CHECK:STDOUT: %Cond.call: init bool = call %Cond.ref() // CHECK:STDOUT: %.loc15_16.1: bool = value_of_initializer %Cond.call // CHECK:STDOUT: %.loc15_16.2: bool = converted %Cond.call, %.loc15_16.1 // CHECK:STDOUT: if %.loc15_16.2 br !while.body else br !while.done // CHECK:STDOUT: // CHECK:STDOUT: !while.body: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %G.call: init () = call %G.ref() // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.done: -// CHECK:STDOUT: %H.ref: = name_ref H, file.%H [template = file.%H] +// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.4] // CHECK:STDOUT: %H.call: init () = call %H.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/lower/constant.cpp b/toolchain/lower/constant.cpp index 179152946905..cf134a611b98 100644 --- a/toolchain/lower/constant.cpp +++ b/toolchain/lower/constant.cpp @@ -179,13 +179,6 @@ static auto EmitFloatLiteralAsConstant(ConstantContext& context, return llvm::ConstantFP::get(context.GetType(inst.type_id), value); } -static auto EmitFunctionDeclAsConstant(ConstantContext& context, - SemIR::FunctionDecl inst) - -> llvm::Constant* { - // TODO: Add a FunctionValue that FunctionDecl evaluates to, and remove this. - return context.GetFunction(inst.function_id); -} - static auto EmitInterfaceWitnessAsConstant(ConstantContext& context, SemIR::InterfaceWitness inst) -> llvm::Constant* { diff --git a/toolchain/lower/file_context.cpp b/toolchain/lower/file_context.cpp index b07e08e507eb..96d599e10c03 100644 --- a/toolchain/lower/file_context.cpp +++ b/toolchain/lower/file_context.cpp @@ -331,7 +331,6 @@ auto FileContext::BuildType(SemIR::InstId inst_id) -> llvm::Type* { // TODO: Decide how we want to represent `StringType`. return llvm::PointerType::get(*llvm_context_, 0); case SemIR::BuiltinKind::BoundMethodType: - case SemIR::BuiltinKind::FunctionType: case SemIR::BuiltinKind::NamespaceType: case SemIR::BuiltinKind::WitnessType: // Return an empty struct as a placeholder. @@ -385,6 +384,7 @@ auto FileContext::BuildType(SemIR::InstId inst_id) -> llvm::Type* { } case SemIR::AssociatedEntityType::Kind: case SemIR::InterfaceType::Kind: + case SemIR::FunctionType::Kind: case SemIR::UnboundElementType::Kind: { // Return an empty struct as a placeholder. // TODO: Should we model an interface as a witness table, or an associated diff --git a/toolchain/lower/handle.cpp b/toolchain/lower/handle.cpp index 4019922964c5..5e78d9aaacdd 100644 --- a/toolchain/lower/handle.cpp +++ b/toolchain/lower/handle.cpp @@ -12,6 +12,7 @@ #include "llvm/Support/Casting.h" #include "toolchain/lower/function_context.h" #include "toolchain/sem_ir/builtin_function_kind.h" +#include "toolchain/sem_ir/function.h" #include "toolchain/sem_ir/inst.h" #include "toolchain/sem_ir/typed_insts.h" @@ -426,17 +427,20 @@ auto HandleCall(FunctionContext& context, SemIR::InstId inst_id, llvm::ArrayRef arg_ids = context.sem_ir().inst_blocks().Get(inst.args_id); - auto* callee_value = context.GetValue(inst.callee_id); + auto callee_function = + SemIR::GetCalleeFunction(context.sem_ir(), inst.callee_id); + CARBON_CHECK(callee_function.function_id.is_valid()); - // A null callee pointer value indicates this isn't a real function. - if (!callee_value) { - auto builtin_kind = - SemIR::BuiltinFunctionKind::ForCallee(context.sem_ir(), inst.callee_id); + if (auto builtin_kind = context.sem_ir() + .functions() + .Get(callee_function.function_id) + .builtin_kind; + builtin_kind != SemIR::BuiltinFunctionKind::None) { HandleBuiltinCall(context, inst_id, builtin_kind, arg_ids); return; } - auto* callee = llvm::cast(callee_value); + auto* callee = context.GetFunction(callee_function.function_id); std::vector args; @@ -466,6 +470,11 @@ auto HandleDeref(FunctionContext& context, SemIR::InstId inst_id, context.SetLocal(inst_id, context.GetValue(inst.pointer_id)); } +auto HandleFunctionDecl(FunctionContext& /*context*/, SemIR::InstId /*inst_id*/, + SemIR::FunctionDecl inst) -> void { + FatalErrorIfEncountered(inst); +} + auto HandleImplDecl(FunctionContext& /*context*/, SemIR::InstId /*inst_id*/, SemIR::ImplDecl inst) -> void { FatalErrorIfEncountered(inst); diff --git a/toolchain/lower/handle_aggregates.cpp b/toolchain/lower/handle_aggregates.cpp index 26800f309f8e..6577ccdcdb0b 100644 --- a/toolchain/lower/handle_aggregates.cpp +++ b/toolchain/lower/handle_aggregates.cpp @@ -9,6 +9,7 @@ #include "llvm/IR/Value.h" #include "toolchain/lower/function_context.h" #include "toolchain/sem_ir/inst.h" +#include "toolchain/sem_ir/typed_insts.h" namespace Carbon::Lower { @@ -219,6 +220,12 @@ auto HandleStructInit(FunctionContext& context, SemIR::InstId inst_id, auto HandleStructValue(FunctionContext& context, SemIR::InstId inst_id, SemIR::StructValue inst) -> void { + if (auto fn_type = context.sem_ir().types().TryGetAs( + inst.type_id)) { + context.SetLocal(inst_id, context.GetFunction(fn_type->function_id)); + return; + } + context.SetLocal( inst_id, EmitAggregateValueRepr(context, inst.type_id, inst.elements_id)); } diff --git a/toolchain/lower/testdata/class/adapt.carbon b/toolchain/lower/testdata/class/adapt.carbon index 5e8ec8f7713d..f18f90ea0dc8 100644 --- a/toolchain/lower/testdata/class/adapt.carbon +++ b/toolchain/lower/testdata/class/adapt.carbon @@ -50,13 +50,13 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: ; ModuleID = 'adapt_class.carbon' // CHECK:STDOUT: source_filename = "adapt_class.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.loc9_28 = internal constant { i32, i32 } { i32 1, i32 2 } +// CHECK:STDOUT: @struct.2.loc9_28 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: // CHECK:STDOUT: define void @Make(ptr sret({ i32, i32 }) %return) { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_27.2.a = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 // CHECK:STDOUT: %.loc9_27.4.b = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.loc9_28, i64 8, i1 false) +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.2.loc9_28, i64 8, i1 false) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: @@ -77,8 +77,8 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: entry: // CHECK:STDOUT: %pa.var = alloca { i32, i32 }, align 8 // CHECK:STDOUT: call void @Make.1(ptr %pa.var) -// CHECK:STDOUT: %.loc28_17 = call i32 @GetB(ptr %pa.var) -// CHECK:STDOUT: ret i32 %.loc28_17 +// CHECK:STDOUT: %GetB.call = call i32 @GetB(ptr %pa.var) +// CHECK:STDOUT: ret i32 %GetB.call // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) diff --git a/toolchain/lower/testdata/class/base.carbon b/toolchain/lower/testdata/class/base.carbon index 42b290471457..46fd8c3053ac 100644 --- a/toolchain/lower/testdata/class/base.carbon +++ b/toolchain/lower/testdata/class/base.carbon @@ -29,14 +29,14 @@ fn Convert(p: Derived*) -> Base* { // CHECK:STDOUT: ; ModuleID = 'base.carbon' // CHECK:STDOUT: source_filename = "base.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.2.loc18_36 = internal constant { { i32 }, i32 } { { i32 } { i32 4 }, i32 7 } +// CHECK:STDOUT: @struct.3.loc18_36 = internal constant { { i32 }, i32 } { { i32 } { i32 4 }, i32 7 } // CHECK:STDOUT: // CHECK:STDOUT: define void @Make(ptr sret({ { i32 }, i32 }) %return) { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc18_35.2.base = getelementptr inbounds { { i32 }, i32 }, ptr %return, i32 0, i32 0 // CHECK:STDOUT: %.loc18_26.2.b = getelementptr inbounds { i32 }, ptr %.loc18_35.2.base, i32 0, i32 0 // CHECK:STDOUT: %.loc18_35.4.d = getelementptr inbounds { { i32 }, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.2.loc18_36, i64 8, i1 false) +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.3.loc18_36, i64 8, i1 false) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/method.carbon b/toolchain/lower/testdata/class/method.carbon index 2ee3e104555e..9a0af81a8b49 100644 --- a/toolchain/lower/testdata/class/method.carbon +++ b/toolchain/lower/testdata/class/method.carbon @@ -25,7 +25,7 @@ fn F(p: C*) { // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr %p) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc15_24 = call i32 @Get(ptr %p) -// CHECK:STDOUT: call void @Set(ptr %p, i32 %.loc15_24) +// CHECK:STDOUT: %Get.call = call i32 @Get(ptr %p) +// CHECK:STDOUT: call void @Set(ptr %p, i32 %Get.call) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/struct_param.carbon b/toolchain/lower/testdata/function/call/struct_param.carbon index 7d7191972788..0a76c17f27d3 100644 --- a/toolchain/lower/testdata/function/call/struct_param.carbon +++ b/toolchain/lower/testdata/function/call/struct_param.carbon @@ -13,7 +13,7 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'struct_param.carbon' // CHECK:STDOUT: source_filename = "struct_param.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.3.loc10_4.3 = internal constant { i32, i32 } { i32 2, i32 3 } +// CHECK:STDOUT: @struct.5.loc10_4.3 = internal constant { i32, i32 } { i32 2, i32 3 } // CHECK:STDOUT: // CHECK:STDOUT: define void @F({ i32 } %b, ptr %c) { // CHECK:STDOUT: entry: @@ -22,6 +22,6 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr @struct.3.loc10_4.3) +// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr @struct.5.loc10_4.3) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/impl/assoc_fn_alias.carbon b/toolchain/lower/testdata/impl/assoc_fn_alias.carbon index 75029e07a2d5..cdf524403014 100644 --- a/toolchain/lower/testdata/impl/assoc_fn_alias.carbon +++ b/toolchain/lower/testdata/impl/assoc_fn_alias.carbon @@ -35,6 +35,6 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Call(ptr %a) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc23_13 = call i32 @F(ptr %a) -// CHECK:STDOUT: ret i32 %.loc23_13 +// CHECK:STDOUT: %F.call = call i32 @F(ptr %a) +// CHECK:STDOUT: ret i32 %F.call // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/impl/impl.carbon b/toolchain/lower/testdata/impl/impl.carbon index 1f402b6c22a0..8532b25a9e21 100644 --- a/toolchain/lower/testdata/impl/impl.carbon +++ b/toolchain/lower/testdata/impl/impl.carbon @@ -34,6 +34,6 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Call(ptr %a) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc22_17 = call i32 @F(ptr %a) -// CHECK:STDOUT: ret i32 %.loc22_17 +// CHECK:STDOUT: %F.call = call i32 @F(ptr %a) +// CHECK:STDOUT: ret i32 %F.call // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/impl/instance_method.carbon b/toolchain/lower/testdata/impl/instance_method.carbon index 411a89701c41..a36bd9763173 100644 --- a/toolchain/lower/testdata/impl/instance_method.carbon +++ b/toolchain/lower/testdata/impl/instance_method.carbon @@ -32,6 +32,6 @@ fn Call(a: A*) -> A* { // CHECK:STDOUT: // CHECK:STDOUT: define ptr @Call(ptr %a) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc22_18 = call ptr @Get(ptr %a) -// CHECK:STDOUT: ret ptr %.loc22_18 +// CHECK:STDOUT: %Get.call = call ptr @Get(ptr %a) +// CHECK:STDOUT: ret ptr %Get.call // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/pointer/address_of_field.carbon b/toolchain/lower/testdata/pointer/address_of_field.carbon index 03813b94cfad..8475a6ce94b2 100644 --- a/toolchain/lower/testdata/pointer/address_of_field.carbon +++ b/toolchain/lower/testdata/pointer/address_of_field.carbon @@ -14,7 +14,7 @@ fn F() { // CHECK:STDOUT: ; ModuleID = 'address_of_field.carbon' // CHECK:STDOUT: source_filename = "address_of_field.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.loc10_47 = internal constant { i32, i32 } { i32 1, i32 2 } +// CHECK:STDOUT: @struct.3.loc10_47 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: // CHECK:STDOUT: declare void @G(ptr) // CHECK:STDOUT: @@ -23,7 +23,7 @@ fn F() { // CHECK:STDOUT: %s.var = alloca { i32, i32 }, align 8 // CHECK:STDOUT: %.loc10_46.2.a = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 0 // CHECK:STDOUT: %.loc10_46.4.b = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.loc10_47, i64 8, i1 false) +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.3.loc10_47, i64 8, i1 false) // CHECK:STDOUT: %.loc11_7.b = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 1 // CHECK:STDOUT: call void @G(ptr %.loc11_7.b) // CHECK:STDOUT: ret void diff --git a/toolchain/lower/testdata/struct/member_access.carbon b/toolchain/lower/testdata/struct/member_access.carbon index 8ca413398b8c..ecd165bd708e 100644 --- a/toolchain/lower/testdata/struct/member_access.carbon +++ b/toolchain/lower/testdata/struct/member_access.carbon @@ -14,14 +14,14 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'member_access.carbon' // CHECK:STDOUT: source_filename = "member_access.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.loc8_49 = internal constant { double, i32 } { double 0.000000e+00, i32 1 } +// CHECK:STDOUT: @struct.2.loc8_49 = internal constant { double, i32 } { double 0.000000e+00, i32 1 } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { double, i32 }, align 8 // CHECK:STDOUT: %.loc8_48.2.a = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 0 // CHECK:STDOUT: %.loc8_48.4.b = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %x.var, ptr align 8 @struct.loc8_49, i64 16, i1 false) +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %x.var, ptr align 8 @struct.2.loc8_49, i64 16, i1 false) // CHECK:STDOUT: %y.var = alloca i32, align 4 // CHECK:STDOUT: %.loc9_17.1.b = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 1 // CHECK:STDOUT: %.loc9_17.2 = load i32, ptr %.loc9_17.1.b, align 4 diff --git a/toolchain/lower/testdata/struct/two_entries.carbon b/toolchain/lower/testdata/struct/two_entries.carbon index 376be8b05ee2..780fb806a9ed 100644 --- a/toolchain/lower/testdata/struct/two_entries.carbon +++ b/toolchain/lower/testdata/struct/two_entries.carbon @@ -13,14 +13,14 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'two_entries.carbon' // CHECK:STDOUT: source_filename = "two_entries.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.loc8_47 = internal constant { i32, i32 } { i32 1, i32 2 } +// CHECK:STDOUT: @struct.2.loc8_47 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8 // CHECK:STDOUT: %.loc8_46.2.a = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 // CHECK:STDOUT: %.loc8_46.4.b = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @struct.loc8_47, i64 8, i1 false) +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @struct.2.loc8_47, i64 8, i1 false) // CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8 // CHECK:STDOUT: %.loc9_31.1.a = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 // CHECK:STDOUT: %.loc9_31.2 = load i32, ptr %.loc9_31.1.a, align 4 diff --git a/toolchain/sem_ir/BUILD b/toolchain/sem_ir/BUILD index 9877bf720c47..288a5c4e1ff5 100644 --- a/toolchain/sem_ir/BUILD +++ b/toolchain/sem_ir/BUILD @@ -81,6 +81,7 @@ cc_library( "builtin_function_kind.cpp", "constant.cpp", "file.cpp", + "function.cpp", "inst_profile.cpp", "inst_profile.h", "name.cpp", diff --git a/toolchain/sem_ir/builtin_function_kind.cpp b/toolchain/sem_ir/builtin_function_kind.cpp index 7bf3c3209f10..cc4203196226 100644 --- a/toolchain/sem_ir/builtin_function_kind.cpp +++ b/toolchain/sem_ir/builtin_function_kind.cpp @@ -339,24 +339,6 @@ auto BuiltinFunctionKind::ForBuiltinName(llvm::StringRef name) return BuiltinFunctionKind::None; } -// Returns the builtin function kind corresponding to the given function -// callee, or None if the callee is not known to be a builtin. -auto BuiltinFunctionKind::ForCallee(const File& sem_ir, InstId callee_id) - -> BuiltinFunctionKind { - if (auto bound_method = - sem_ir.insts().TryGetAs(callee_id)) { - callee_id = bound_method->function_id; - } - callee_id = sem_ir.constant_values().Get(callee_id).inst_id(); - if (!callee_id.is_valid()) { - return SemIR::BuiltinFunctionKind::None; - } - if (auto callee = sem_ir.insts().TryGetAs(callee_id)) { - return sem_ir.functions().Get(callee->function_id).builtin_kind; - } - return SemIR::BuiltinFunctionKind::None; -} - auto BuiltinFunctionKind::IsValidType(const File& sem_ir, llvm::ArrayRef arg_types, TypeId return_type) const -> bool { diff --git a/toolchain/sem_ir/builtin_function_kind.h b/toolchain/sem_ir/builtin_function_kind.h index c7515fcc223f..b6b230d1f943 100644 --- a/toolchain/sem_ir/builtin_function_kind.h +++ b/toolchain/sem_ir/builtin_function_kind.h @@ -31,11 +31,6 @@ class BuiltinFunctionKind : public CARBON_ENUM_BASE(BuiltinFunctionKind) { // is unknown. static auto ForBuiltinName(llvm::StringRef name) -> BuiltinFunctionKind; - // Returns the builtin function kind corresponding to the given function - // callee, or None if the callee is not known to be a builtin. - static auto ForCallee(const File& sem_ir, InstId callee_id) - -> BuiltinFunctionKind; - // Determines whether this builtin function kind can have the specified // function type. auto IsValidType(const File& sem_ir, llvm::ArrayRef arg_types, diff --git a/toolchain/sem_ir/builtin_kind.def b/toolchain/sem_ir/builtin_kind.def index 2c57f0a1fe23..439bb17da151 100644 --- a/toolchain/sem_ir/builtin_kind.def +++ b/toolchain/sem_ir/builtin_kind.def @@ -64,9 +64,6 @@ CARBON_SEM_IR_BUILTIN_KIND(FloatType, "f64") // The type of string values and String literals. CARBON_SEM_IR_BUILTIN_KIND(StringType, "String") -// The type of function values. -CARBON_SEM_IR_BUILTIN_KIND(FunctionType, "") - // The type of bound method values. CARBON_SEM_IR_BUILTIN_KIND(BoundMethodType, "") diff --git a/toolchain/sem_ir/file.cpp b/toolchain/sem_ir/file.cpp index 99535018aee1..b35408eca31b 100644 --- a/toolchain/sem_ir/file.cpp +++ b/toolchain/sem_ir/file.cpp @@ -177,6 +177,7 @@ static auto GetTypePrecedence(InstKind kind) -> int { case Builtin::Kind: case ClassType::Kind: case FloatType::Kind: + case FunctionType::Kind: case InterfaceType::Kind: case InterfaceWitnessAccess::Kind: case IntType::Kind: @@ -313,6 +314,11 @@ static auto StringifyTypeExprImpl(const SemIR::File& outer_sem_ir, } break; } + case CARBON_KIND(FunctionType inst): { + auto fn_name_id = sem_ir.functions().Get(inst.function_id).name_id; + out << sem_ir.names().GetFormatted(fn_name_id); + break; + } case CARBON_KIND(InterfaceType inst): { auto interface_name_id = sem_ir.interfaces().Get(inst.interface_id).name_id; @@ -550,6 +556,7 @@ auto GetExprCategory(const File& file, InstId inst_id) -> ExprCategory { case FacetTypeAccess::Kind: case FloatLiteral::Kind: case FloatType::Kind: + case FunctionType::Kind: case InterfaceDecl::Kind: case InterfaceType::Kind: case InterfaceWitness::Kind: diff --git a/toolchain/sem_ir/function.cpp b/toolchain/sem_ir/function.cpp new file mode 100644 index 000000000000..51b582a8f0c2 --- /dev/null +++ b/toolchain/sem_ir/function.cpp @@ -0,0 +1,41 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include "toolchain/sem_ir/function.h" + +#include "toolchain/sem_ir/file.h" + +namespace Carbon::SemIR { + +auto GetCalleeFunction(const File& sem_ir, InstId callee_id) -> CalleeFunction { + CalleeFunction result = {.function_id = FunctionId::Invalid, + .self_id = InstId::Invalid, + .is_error = false}; + + if (auto bound_method = sem_ir.insts().TryGetAs(callee_id)) { + result.self_id = bound_method->object_id; + callee_id = bound_method->function_id; + } + + // Identify the function we're calling. + auto val_id = sem_ir.constant_values().Get(callee_id); + if (!val_id.is_constant()) { + return result; + } + auto val_inst = sem_ir.insts().Get(val_id.inst_id()); + auto struct_val = val_inst.TryAs(); + if (!struct_val) { + result.is_error = val_inst.type_id() == SemIR::TypeId::Error; + return result; + } + auto fn_type = sem_ir.types().TryGetAs(struct_val->type_id); + if (!fn_type) { + return result; + } + + result.function_id = fn_type->function_id; + return result; +} + +} // namespace Carbon::SemIR diff --git a/toolchain/sem_ir/function.h b/toolchain/sem_ir/function.h index 52688d5f32ac..471691566fa8 100644 --- a/toolchain/sem_ir/function.h +++ b/toolchain/sem_ir/function.h @@ -121,6 +121,20 @@ struct Function : public Printable { llvm::SmallVector body_block_ids = {}; }; +class File; + +struct CalleeFunction { + // The function. Invalid if not a function. + SemIR::FunctionId function_id; + // The bound `self` parameter. Invalid if not a method. + SemIR::InstId self_id; + // True if an error instruction was found. + bool is_error; +}; + +// Returns information for the function corresponding to callee_id. +auto GetCalleeFunction(const File& sem_ir, InstId callee_id) -> CalleeFunction; + } // namespace Carbon::SemIR #endif // CARBON_TOOLCHAIN_SEM_IR_FUNCTION_H_ diff --git a/toolchain/sem_ir/inst_kind.def b/toolchain/sem_ir/inst_kind.def index 8297ff202033..e13b55bf2ac0 100644 --- a/toolchain/sem_ir/inst_kind.def +++ b/toolchain/sem_ir/inst_kind.def @@ -108,7 +108,8 @@ CARBON_SEM_IR_INST_KIND_IMPL(FacetTypeAccess, TYPE_NEVER, CONSTANT_NEVER) CARBON_SEM_IR_INST_KIND_IMPL(FieldDecl, TYPE_NEVER, CONSTANT_ALWAYS) CARBON_SEM_IR_INST_KIND_IMPL(FloatLiteral, TYPE_NEVER, CONSTANT_ALWAYS) CARBON_SEM_IR_INST_KIND_IMPL(FloatType, TYPE_ALWAYS, CONSTANT_CONDITIONAL) -CARBON_SEM_IR_INST_KIND_IMPL(FunctionDecl, TYPE_NEVER, CONSTANT_ALWAYS) +CARBON_SEM_IR_INST_KIND_IMPL(FunctionDecl, TYPE_NEVER, CONSTANT_NEVER) +CARBON_SEM_IR_INST_KIND_IMPL(FunctionType, TYPE_ALWAYS, CONSTANT_CONDITIONAL) CARBON_SEM_IR_INST_KIND_IMPL(ImplDecl, TYPE_NEVER, CONSTANT_NEVER) CARBON_SEM_IR_INST_KIND_IMPL(ImportRefUnloaded, TYPE_NEVER, CONSTANT_NEVER) CARBON_SEM_IR_INST_KIND_IMPL(ImportRefLoaded, TYPE_NEVER, CONSTANT_NEVER) diff --git a/toolchain/sem_ir/inst_namer.cpp b/toolchain/sem_ir/inst_namer.cpp index c92173db2b19..ea3e18183a39 100644 --- a/toolchain/sem_ir/inst_namer.cpp +++ b/toolchain/sem_ir/inst_namer.cpp @@ -398,27 +398,23 @@ auto InstNamer::CollectNamesInBlock(ScopeId scope_id, continue; } case CARBON_KIND(Call inst): { + auto callee_function = + SemIR::GetCalleeFunction(sem_ir_, inst.callee_id); + if (!callee_function.function_id.is_valid()) { + break; + } + const auto& function = + sem_ir_.functions().Get(callee_function.function_id); // Name the call's result based on the callee. - if (auto builtin_kind = - SemIR::BuiltinFunctionKind::ForCallee(sem_ir_, inst.callee_id); - builtin_kind != SemIR::BuiltinFunctionKind::None) { + if (function.builtin_kind != SemIR::BuiltinFunctionKind::None) { // For a builtin, use the builtin name. Otherwise, we'd typically pick // the name `Op` below, which is probably not very useful. - add_inst_name(builtin_kind.name().str()); + add_inst_name(function.builtin_kind.name().str()); continue; - } else if (auto const_callee_id = - sem_ir_.constant_values().Get(inst.callee_id); - const_callee_id.is_constant()) { - // For a direct function call, use the leaf function name. - if (auto callee_fn = sem_ir_.insts().TryGetAs( - const_callee_id.inst_id())) { - add_inst_name_id( - sem_ir_.functions().Get(callee_fn->function_id).name_id, - ".call"); - continue; - } } - break; + + add_inst_name_id(function.name_id, ".call"); + continue; } case CARBON_KIND(ClassDecl inst): { add_inst_name_id(sem_ir_.classes().Get(inst.class_id).name_id, ".decl"); @@ -430,10 +426,15 @@ auto InstNamer::CollectNamesInBlock(ScopeId scope_id, continue; } case CARBON_KIND(FunctionDecl inst): { - add_inst_name_id(sem_ir_.functions().Get(inst.function_id).name_id); + add_inst_name_id(sem_ir_.functions().Get(inst.function_id).name_id, + ".decl"); CollectNamesInBlock(scope_id, inst.decl_block_id); continue; } + case CARBON_KIND(FunctionType inst): { + add_inst_name_id(sem_ir_.functions().Get(inst.function_id).name_id); + continue; + } case CARBON_KIND(ImplDecl inst): { CollectNamesInBlock(scope_id, inst.decl_block_id); break; diff --git a/toolchain/sem_ir/typed_insts.h b/toolchain/sem_ir/typed_insts.h index d0947062e496..4cae44b2c5b2 100644 --- a/toolchain/sem_ir/typed_insts.h +++ b/toolchain/sem_ir/typed_insts.h @@ -484,6 +484,14 @@ struct FunctionDecl { InstBlockId decl_block_id; }; +struct FunctionType { + static constexpr auto Kind = + InstKind::FunctionType.Define("fn_type"); + + TypeId type_id; + FunctionId function_id; +}; + struct ImplDecl { static constexpr auto Kind = InstKind::ImplDecl.Define("impl_decl");