From 364ea5d3f2687f0870aee00e6f35046894cabda9 Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Fri, 23 Feb 2024 16:00:18 -0800 Subject: [PATCH] Assign a constant to ClassDecl/InterfaceDecl for name references. (#3722) By adding a constant to ClassDecl/InterfaceDecl, we're able to remove name reference special-casing. Use TryEvalInst on the Decl to generate the Type. For ClassDecl, then use the generated constant for self_type_id. --- toolchain/check/context.cpp | 4 -- toolchain/check/context.h | 4 -- toolchain/check/eval.cpp | 26 +++++++++-- toolchain/check/handle_class.cpp | 19 +++++--- toolchain/check/handle_interface.cpp | 4 +- toolchain/check/handle_name.cpp | 46 ------------------- toolchain/check/import_ref.cpp | 23 ++++------ .../array/fail_incomplete_element.carbon | 6 +-- toolchain/check/testdata/as/identity.carbon | 14 +++--- toolchain/check/testdata/as/tuple.carbon | 18 ++++---- toolchain/check/testdata/class/base.carbon | 6 +-- .../check/testdata/class/base_field.carbon | 6 +-- .../class/base_function_unqualified.carbon | 6 +-- .../check/testdata/class/base_method.carbon | 6 +-- .../testdata/class/base_method_shadow.carbon | 14 +++--- toolchain/check/testdata/class/basic.carbon | 4 +- .../testdata/class/derived_to_base.carbon | 18 ++++---- .../check/testdata/class/fail_abstract.carbon | 6 +-- .../testdata/class/fail_addr_not_self.carbon | 2 +- .../testdata/class/fail_addr_self.carbon | 2 +- .../testdata/class/fail_base_bad_type.carbon | 26 +++++------ .../class/fail_base_method_define.carbon | 8 ++-- .../testdata/class/fail_base_modifiers.carbon | 18 ++++---- .../testdata/class/fail_base_no_extend.carbon | 6 +-- .../testdata/class/fail_base_repeated.carbon | 16 +++---- .../testdata/class/fail_base_unbound.carbon | 10 ++-- .../class/fail_convert_to_invalid.carbon | 2 +- .../class/fail_derived_to_base.carbon | 10 ++-- .../class/fail_field_modifiers.carbon | 2 +- .../testdata/class/fail_import_misuses.carbon | 14 +++--- .../testdata/class/fail_incomplete.carbon | 8 ++-- .../check/testdata/class/fail_init.carbon | 8 ++-- .../class/fail_init_as_inplace.carbon | 6 +-- .../class/fail_memaccess_category.carbon | 6 +-- .../testdata/class/fail_member_of_let.carbon | 4 +- .../check/testdata/class/fail_method.carbon | 10 ++-- .../class/fail_method_modifiers.carbon | 6 +-- .../testdata/class/fail_modifiers.carbon | 12 ++--- .../class/fail_out_of_line_decl.carbon | 2 +- .../fail_redeclaration_introducer.carbon | 30 ++++++------ .../class/fail_redeclaration_scope.carbon | 18 ++++---- .../testdata/class/fail_redefinition.carbon | 4 +- .../check/testdata/class/fail_reorder.carbon | 4 +- .../check/testdata/class/fail_scope.carbon | 2 +- .../check/testdata/class/fail_self.carbon | 6 +-- .../testdata/class/fail_todo_generic.carbon | 2 +- .../class/fail_todo_generic_method.carbon | 2 +- .../fail_todo_import_forward_decl.carbon | 6 +-- .../testdata/class/fail_todo_modifiers.carbon | 6 +-- .../testdata/class/fail_unbound_field.carbon | 4 +- .../testdata/class/fail_unknown_member.carbon | 2 +- .../check/testdata/class/field_access.carbon | 4 +- .../class/field_access_in_value.carbon | 6 +-- .../testdata/class/forward_declared.carbon | 2 +- toolchain/check/testdata/class/import.carbon | 36 +++++++-------- .../check/testdata/class/import_base.carbon | 14 +++--- .../testdata/class/import_member_cycle.carbon | 10 ++-- .../testdata/class/import_struct_cyle.carbon | 10 ++-- toolchain/check/testdata/class/init.carbon | 4 +- toolchain/check/testdata/class/init_as.carbon | 4 +- .../check/testdata/class/init_nested.carbon | 8 ++-- toolchain/check/testdata/class/method.carbon | 6 +-- toolchain/check/testdata/class/nested.carbon | 12 ++--- .../check/testdata/class/nested_name.carbon | 6 +-- .../check/testdata/class/raw_self.carbon | 2 +- .../check/testdata/class/raw_self_type.carbon | 2 +- .../check/testdata/class/redeclaration.carbon | 4 +- .../class/redeclaration_introducer.carbon | 12 ++--- .../check/testdata/class/reenter_scope.carbon | 2 +- toolchain/check/testdata/class/scope.carbon | 4 +- toolchain/check/testdata/class/self.carbon | 2 +- .../testdata/class/self_conversion.carbon | 6 +-- .../check/testdata/class/self_type.carbon | 2 +- .../check/testdata/class/static_method.carbon | 4 +- .../check/testdata/global/class_obj.carbon | 4 +- .../testdata/global/class_with_fun.carbon | 4 +- .../if_expr/fail_not_in_function.carbon | 2 +- toolchain/check/testdata/impl/basic.carbon | 2 +- .../check/testdata/impl/declaration.carbon | 2 +- toolchain/check/testdata/impl/empty.carbon | 2 +- .../check/testdata/impl/extend_impl.carbon | 8 ++-- .../impl/fail_extend_impl_forall.carbon | 8 ++-- .../impl/fail_extend_impl_scope.carbon | 2 +- .../impl/fail_extend_impl_type_as.carbon | 10 ++-- .../impl/fail_extend_non_interface.carbon | 2 +- ..._extend_partially_defined_interface.carbon | 6 +-- .../fail_extend_undefined_interface.carbon | 6 +-- .../testdata/impl/fail_impl_as_scope.carbon | 2 +- .../testdata/impl/fail_impl_bad_type.carbon | 8 ++-- .../testdata/impl/fail_redefinition.carbon | 2 +- toolchain/check/testdata/impl/impl_as.carbon | 6 +-- .../check/testdata/impl/impl_forall.carbon | 4 +- .../check/testdata/impl/redeclaration.carbon | 4 +- .../check/testdata/interface/as_type.carbon | 2 +- .../check/testdata/interface/basic.carbon | 11 +++-- .../interface/fail_as_type_of_type.carbon | 2 +- .../testdata/interface/fail_duplicate.carbon | 13 ++++-- .../testdata/interface/fail_modifiers.carbon | 15 ++++-- .../interface/fail_todo_generic.carbon | 6 ++- .../interface/fail_todo_modifiers.carbon | 9 +++- .../check/testdata/interface/import.carbon | 13 ++++-- .../check/testdata/package_expr/syntax.carbon | 4 +- .../fail_return_with_returned_var.carbon | 4 +- .../check/testdata/return/returned_var.carbon | 4 +- .../struct/fail_nested_incomplete.carbon | 6 +-- .../tuples/fail_nested_incomplete.carbon | 6 +-- .../testdata/var/fail_not_copyable.carbon | 4 +- toolchain/sem_ir/file.cpp | 4 +- toolchain/sem_ir/typed_insts.h | 6 +-- 109 files changed, 420 insertions(+), 429 deletions(-) diff --git a/toolchain/check/context.cpp b/toolchain/check/context.cpp index 3b986b3ff237..a8fa25bfc5cf 100644 --- a/toolchain/check/context.cpp +++ b/toolchain/check/context.cpp @@ -1015,10 +1015,6 @@ auto Context::GetBuiltinType(SemIR::BuiltinKind kind) -> SemIR::TypeId { return type_id; } -auto Context::GetClassType(SemIR::ClassId class_id) -> SemIR::TypeId { - return GetTypeImpl(*this, class_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 a00268b2cb56..f0da1f5def24 100644 --- a/toolchain/check/context.h +++ b/toolchain/check/context.h @@ -237,10 +237,6 @@ class Context { // Gets a builtin type. The returned type will be complete. auto GetBuiltinType(SemIR::BuiltinKind kind) -> SemIR::TypeId; - // Returns a class type for the class described by `class_id`. - // TODO: Support generic arguments. - auto GetClassType(SemIR::ClassId class_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 301b28c1d8d5..1a21c2ad9cae 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -364,12 +364,30 @@ auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst) case SemIR::TupleInit::Kind: return RebuildInitAsValue(context, inst, SemIR::TupleValue::Kind); - // These cases are always template constants. case SemIR::Builtin::Kind: + // Builtins are always template constants. + return MakeConstantResult(context, inst, Phase::Template); + + case SemIR::ClassDecl::Kind: + // TODO: Once classes have generic arguments, handle them. + return MakeConstantResult( + context, + SemIR::ClassType{SemIR::TypeId::TypeType, + inst.As().class_id}, + Phase::Template); + + case SemIR::InterfaceDecl::Kind: + // TODO: Once interfaces have generic arguments, handle them. + return MakeConstantResult( + context, + SemIR::InterfaceType{SemIR::TypeId::TypeType, + inst.As().interface_id}, + Phase::Template); + case SemIR::ClassType::Kind: case SemIR::InterfaceType::Kind: - // TODO: Once classes and interfaces have generic arguments, handle them. - return MakeConstantResult(context, inst, Phase::Template); + CARBON_FATAL() << inst.kind() + << " is only created during corresponding Decl handling."; // These cases are treated as being the unique canonical definition of the // corresponding constant value. @@ -475,10 +493,8 @@ auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst) case SemIR::Branch::Kind: case SemIR::BranchIf::Kind: case SemIR::BranchWithArg::Kind: - case SemIR::ClassDecl::Kind: case SemIR::ImplDecl::Kind: case SemIR::Import::Kind: - case SemIR::InterfaceDecl::Kind: case SemIR::Param::Kind: case SemIR::ReturnExpr::Kind: case SemIR::Return::Kind: diff --git a/toolchain/check/handle_class.cpp b/toolchain/check/handle_class.cpp index c06b4f1da2f3..fb28fe634a88 100644 --- a/toolchain/check/handle_class.cpp +++ b/toolchain/check/handle_class.cpp @@ -56,7 +56,8 @@ static auto BuildClassDecl(Context& context, Parse::AnyClassDeclId parse_node) auto decl_block_id = context.inst_block_stack().Pop(); // Add the class declaration. - auto class_decl = SemIR::ClassDecl{SemIR::ClassId::Invalid, decl_block_id}; + auto class_decl = SemIR::ClassDecl{SemIR::TypeId::TypeType, + SemIR::ClassId::Invalid, decl_block_id}; auto class_decl_id = context.AddPlaceholderInst({parse_node, class_decl}); // Check whether this is a redeclaration. @@ -91,26 +92,30 @@ static auto BuildClassDecl(Context& context, Parse::AnyClassDeclId parse_node) } // Create a new class if this isn't a valid redeclaration. - if (!class_decl.class_id.is_valid()) { + bool is_new_class = !class_decl.class_id.is_valid(); + if (is_new_class) { // TODO: If this is an invalid redeclaration of a non-class entity or there // was an error in the qualifier, we will have lost track of the class name // here. We should keep track of it even if the name is invalid. class_decl.class_id = context.classes().Add( {.name_id = name_context.name_id_for_new_inst(), .enclosing_scope_id = name_context.enclosing_scope_id_for_new_inst(), - // `.self_type_id` depends on `class_id`, so is set below. + // `.self_type_id` depends on the ClassType, so is set below. .self_type_id = SemIR::TypeId::Invalid, .decl_id = class_decl_id, .inheritance_kind = inheritance_kind}); - - // Build the `Self` type. - auto& class_info = context.classes().Get(class_decl.class_id); - class_info.self_type_id = context.GetClassType(class_decl.class_id); } // Write the class ID into the ClassDecl. context.ReplaceInstBeforeConstantUse(class_decl_id, {parse_node, class_decl}); + if (is_new_class) { + // Build the `Self` type using the resulting type constant. + auto& class_info = context.classes().Get(class_decl.class_id); + class_info.self_type_id = context.GetTypeIdForTypeConstant( + context.constant_values().Get(class_decl_id)); + } + return {class_decl.class_id, class_decl_id}; } diff --git a/toolchain/check/handle_interface.cpp b/toolchain/check/handle_interface.cpp index 9a916c12942f..26b381645a2e 100644 --- a/toolchain/check/handle_interface.cpp +++ b/toolchain/check/handle_interface.cpp @@ -51,8 +51,8 @@ static auto BuildInterfaceDecl(Context& context, auto decl_block_id = context.inst_block_stack().Pop(); // Add the interface declaration. - auto interface_decl = - SemIR::InterfaceDecl{SemIR::InterfaceId::Invalid, decl_block_id}; + auto interface_decl = SemIR::InterfaceDecl{ + SemIR::TypeId::TypeType, SemIR::InterfaceId::Invalid, decl_block_id}; auto interface_decl_id = context.AddPlaceholderInst({parse_node, interface_decl}); diff --git a/toolchain/check/handle_name.cpp b/toolchain/check/handle_name.cpp index 85b3a651d5f5..bb82d9adda68 100644 --- a/toolchain/check/handle_name.cpp +++ b/toolchain/check/handle_name.cpp @@ -42,49 +42,6 @@ static auto GetAsNameScope(Context& context, SemIR::InstId base_id) return std::nullopt; } -// Given an instruction produced by a name lookup, get the value to use for that -// result in an expression. -static auto GetExprValueForLookupResult(Context& context, - SemIR::InstId lookup_result_id) - -> SemIR::InstId { - // If lookup finds a class declaration, the value is its `Self` type. - auto lookup_result = context.insts().Get(lookup_result_id); - switch (lookup_result.kind()) { - case SemIR::ClassDecl::Kind: { - auto class_decl = lookup_result.As(); - return context.types().GetInstId( - context.classes().Get(class_decl.class_id).self_type_id); - } - case SemIR::InterfaceDecl::Kind: { - auto interface_decl = lookup_result.As(); - return TryEvalInst(context, SemIR::InstId::Invalid, - SemIR::InterfaceType{SemIR::TypeId::TypeType, - interface_decl.interface_id}) - .inst_id(); - } - case SemIR::ImportRefUsed::Kind: { - auto import_ref = lookup_result.As(); - const auto* import_ir = context.import_irs().Get(import_ref.ir_id); - auto import_kind = import_ir->insts().Get(import_ref.inst_id).kind(); - // For a declared type, recurse to get the appropriate type value. - // Otherwise, the ImportRefUsed is sufficient. - if (import_kind == SemIR::ClassDecl::Kind || - import_kind == SemIR::InterfaceDecl::Kind) { - return GetExprValueForLookupResult( - context, context.constant_values().Get(lookup_result_id).inst_id()); - } else { - return lookup_result_id; - } - } - default: - // Anything else should be a typed value already. - CARBON_CHECK(lookup_result.kind().value_kind() == - SemIR::InstValueKind::Typed) - << "Unexpected kind for lookup result, " << lookup_result; - return lookup_result_id; - } -} - static auto GetClassElementIndex(Context& context, SemIR::InstId element_id) -> SemIR::ElementIndex { auto element_inst = context.insts().Get(element_id); @@ -127,7 +84,6 @@ auto HandleMemberAccessExpr(Context& context, name_scope_id->is_valid() ? context.LookupQualifiedName(parse_node, name_id, *name_scope_id) : SemIR::InstId::BuiltinError; - inst_id = GetExprValueForLookupResult(context, inst_id); auto inst = context.insts().Get(inst_id); // TODO: Track that this instruction was named within `base_id`. context.AddInstAndPush( @@ -161,7 +117,6 @@ auto HandleMemberAccessExpr(Context& context, .scope_id; auto member_id = context.LookupQualifiedName(parse_node, name_id, class_scope_id); - member_id = GetExprValueForLookupResult(context, member_id); // Perform instance binding if we found an instance member. auto member_type_id = context.insts().Get(member_id).type_id(); @@ -288,7 +243,6 @@ static auto GetIdentifierAsName(Context& context, Parse::NodeId parse_node) static auto HandleNameAsExpr(Context& context, Parse::NodeId parse_node, SemIR::NameId name_id) -> bool { auto value_id = context.LookupUnqualifiedName(parse_node, name_id); - value_id = GetExprValueForLookupResult(context, value_id); auto value = context.insts().Get(value_id); context.AddInstAndPush( {parse_node, SemIR::NameRef{value.type_id(), name_id, value_id}}); diff --git a/toolchain/check/import_ref.cpp b/toolchain/check/import_ref.cpp index 8c2a23104c98..a65f502ad0f4 100644 --- a/toolchain/check/import_ref.cpp +++ b/toolchain/check/import_ref.cpp @@ -344,7 +344,8 @@ class ImportRefResolver { const SemIR::Class& import_class) -> SemIR::ConstantId { auto class_decl = - SemIR::ClassDecl{SemIR::ClassId::Invalid, SemIR::InstBlockId::Empty}; + SemIR::ClassDecl{SemIR::TypeId::Invalid, SemIR::ClassId::Invalid, + SemIR::InstBlockId::Empty}; auto class_decl_id = context_.AddPlaceholderInst({Parse::NodeId::Invalid, class_decl}); // Regardless of whether ClassDecl is a complete type, we first need an @@ -352,28 +353,24 @@ class ImportRefResolver { class_decl.class_id = context_.classes().Add({ .name_id = GetLocalNameId(import_class.name_id), .enclosing_scope_id = NoEnclosingScopeForImports, - // `.self_type_id` depends on `class_id`, so is set below. + // `.self_type_id` depends on the ClassType, so is set below. .self_type_id = SemIR::TypeId::Invalid, .decl_id = class_decl_id, .inheritance_kind = import_class.inheritance_kind, }); + // Write the function ID into the ClassDecl. context_.ReplaceInstBeforeConstantUse(class_decl_id, {Parse::NodeId::Invalid, class_decl}); + auto self_const_id = context_.constant_values().Get(class_decl_id); - // Build the `Self` type. - auto type_id = context_.GetClassType(class_decl.class_id); - context_.classes().Get(class_decl.class_id).self_type_id = type_id; + // Build the `Self` type using the resulting type constant. + auto& class_info = context_.classes().Get(class_decl.class_id); + class_info.self_type_id = context_.GetTypeIdForTypeConstant(self_const_id); // Set a constant corresponding to the incomplete class. - // TODO: This uses the self type's constant, but the underlying instruction - // is NotConstant. Need to discuss whether we want to add a type_id to - // ClassDecl/InterfaceDecl and change behavior, which would also help - // consistency with other types. See also GetExprValueForLookupResult in - // handle_name.cpp. - auto const_id = context_.types().GetConstantId(type_id); - import_ir_constant_values_.Set(inst_id, const_id); - return const_id; + import_ir_constant_values_.Set(inst_id, self_const_id); + return self_const_id; } // Fills out the class definition for an incomplete class. diff --git a/toolchain/check/testdata/array/fail_incomplete_element.carbon b/toolchain/check/testdata/array/fail_incomplete_element.carbon index 5558bee733f8..7cb254e4d41c 100644 --- a/toolchain/check/testdata/array/fail_incomplete_element.carbon +++ b/toolchain/check/testdata/array/fail_incomplete_element.carbon @@ -28,13 +28,13 @@ var p: Incomplete* = &a[0]; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Incomplete = %Incomplete.decl, .a = %a, .p = %p} [template] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] // CHECK:STDOUT: %.loc15_21: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc15_22: type = array_type %.loc15_21, Incomplete [template = constants.%.2] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var -// CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] // CHECK:STDOUT: %.loc17: type = ptr_type Incomplete [template = constants.%.3] // CHECK:STDOUT: %p.var: ref Incomplete* = var p // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var diff --git a/toolchain/check/testdata/as/identity.carbon b/toolchain/check/testdata/as/identity.carbon index 871041e664cd..7d645b8e9089 100644 --- a/toolchain/check/testdata/as/identity.carbon +++ b/toolchain/check/testdata/as/identity.carbon @@ -36,7 +36,7 @@ fn Initializing() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.X = %X.decl, .Value = %Value, .Reference = %Reference, .Make = %Make, .Initializing = %Initializing} [template] -// CHECK:STDOUT: %X.decl = class_decl @X, () +// CHECK:STDOUT: %X.decl = class_decl @X, () [template = constants.%X] // CHECK:STDOUT: %Value: = fn_decl @Value [template] // CHECK:STDOUT: %Reference: = fn_decl @Reference [template] // CHECK:STDOUT: %Make: = fn_decl @Make [template] @@ -50,20 +50,20 @@ fn Initializing() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Value(%n: X) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc14_10: type = name_ref X, constants.%X [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc14_10: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %n.ref: X = name_ref n, %n -// CHECK:STDOUT: %X.ref.loc14_19: type = name_ref X, constants.%X [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc14_19: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %m: X = bind_name m, %n.ref // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Reference(%p: X*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc18_10: type = name_ref X, constants.%X [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc18_10: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc18_11: type = ptr_type X [template = constants.%.4] // CHECK:STDOUT: %p.ref: X* = name_ref p, %p // CHECK:STDOUT: %.loc18_17: ref X = deref %p.ref -// CHECK:STDOUT: %X.ref.loc18_23: type = name_ref X, constants.%X [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc18_23: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %.loc18_15: X* = addr_of %.loc18_17 // CHECK:STDOUT: %q: X* = bind_name q, %.loc18_15 // CHECK:STDOUT: return @@ -73,13 +73,13 @@ fn Initializing() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Initializing() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc24_10: type = name_ref X, constants.%X [template = constants.%X] +// 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: %.loc24_7: ref X = splice_block %x.var {} // CHECK:STDOUT: %.loc24_19: init X = call %Make.ref() to %.loc24_7 -// CHECK:STDOUT: %X.ref.loc24_25: type = name_ref X, constants.%X [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc24_25: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: assign %x.var, %.loc24_19 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/as/tuple.carbon b/toolchain/check/testdata/as/tuple.carbon index 388d4bf7b815..c7d5d1ac59ee 100644 --- a/toolchain/check/testdata/as/tuple.carbon +++ b/toolchain/check/testdata/as/tuple.carbon @@ -35,7 +35,7 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.X = %X.decl, .Make = %Make, .Let = %Let, .Var = %Var} [template] -// CHECK:STDOUT: %X.decl = class_decl @X, () +// CHECK:STDOUT: %X.decl = class_decl @X, () [template = constants.%X] // CHECK:STDOUT: %Make: = fn_decl @Make [template] // CHECK:STDOUT: %Let: = fn_decl @Let [template] // CHECK:STDOUT: %Var: = fn_decl @Var [template] @@ -50,8 +50,8 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Let() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc15_11: type = name_ref X, constants.%X [template = constants.%X] -// CHECK:STDOUT: %X.ref.loc15_14: type = name_ref X, constants.%X [template = constants.%X] +// 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.%.5 [template = constants.%.5] // CHECK:STDOUT: %Make.ref.loc15_20: = name_ref Make, file.%Make [template = file.%Make] @@ -61,8 +61,8 @@ fn Var() { // CHECK:STDOUT: %.loc15_32.1: ref X = temporary_storage // CHECK:STDOUT: %.loc15_32.2: init X = call %Make.ref.loc15_28() to %.loc15_32.1 // CHECK:STDOUT: %.loc15_34.1: (X, X) = tuple_literal (%.loc15_24.2, %.loc15_32.2) -// CHECK:STDOUT: %X.ref.loc15_40: type = name_ref X, constants.%X [template = constants.%X] -// CHECK:STDOUT: %X.ref.loc15_43: type = name_ref X, constants.%X [template = constants.%X] +// 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.%.5 [template = constants.%.5] // CHECK:STDOUT: %.loc15_24.3: ref X = temporary %.loc15_24.1, %.loc15_24.2 @@ -77,8 +77,8 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Var() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc20_11: type = name_ref X, constants.%X [template = constants.%X] -// CHECK:STDOUT: %X.ref.loc20_14: type = name_ref X, constants.%X [template = constants.%X] +// 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.%.5 [template = constants.%.5] // CHECK:STDOUT: %b.var: ref (X, X) = var b @@ -90,8 +90,8 @@ fn Var() { // CHECK:STDOUT: %.loc20_34.2: ref X = tuple_access %b.var, element1 // CHECK:STDOUT: %.loc20_32: init X = call %Make.ref.loc20_28() to %.loc20_34.2 // CHECK:STDOUT: %.loc20_34.3: (X, X) = tuple_literal (%.loc20_24, %.loc20_32) -// CHECK:STDOUT: %X.ref.loc20_40: type = name_ref X, constants.%X [template = constants.%X] -// CHECK:STDOUT: %X.ref.loc20_43: type = name_ref X, constants.%X [template = constants.%X] +// 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.%.5 [template = constants.%.5] // CHECK:STDOUT: %.loc20_34.4: init (X, X) = tuple_init (%.loc20_24, %.loc20_32) to %b.var diff --git a/toolchain/check/testdata/class/base.carbon b/toolchain/check/testdata/class/base.carbon index 36d89dc7fab6..62b1bf65dd9a 100644 --- a/toolchain/check/testdata/class/base.carbon +++ b/toolchain/check/testdata/class/base.carbon @@ -48,8 +48,8 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Derived = %Derived.decl, .Make = %Make, .Access = %Access} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () +// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] +// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () [template = constants.%Derived] // CHECK:STDOUT: %Make: = fn_decl @Make [template] // CHECK:STDOUT: %Access: = fn_decl @Access [template] // CHECK:STDOUT: } @@ -62,7 +62,7 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, constants.%Base [template = constants.%Base] +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc12: = base_decl Base, element0 [template] // CHECK:STDOUT: %.loc14: = field_decl d, element1 [template] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_field.carbon b/toolchain/check/testdata/class/base_field.carbon index c1d8657534a3..5924710754e5 100644 --- a/toolchain/check/testdata/class/base_field.carbon +++ b/toolchain/check/testdata/class/base_field.carbon @@ -41,8 +41,8 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Derived = %Derived.decl, .Access = %Access} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () +// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] +// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () [template = constants.%Derived] // CHECK:STDOUT: %Access: = fn_decl @Access [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -58,7 +58,7 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, constants.%Base [template = constants.%Base] +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc14: = base_decl Base, element0 [template] // CHECK:STDOUT: %.loc16: = field_decl d, element1 [template] // CHECK:STDOUT: %.loc17: = field_decl e, element2 [template] diff --git a/toolchain/check/testdata/class/base_function_unqualified.carbon b/toolchain/check/testdata/class/base_function_unqualified.carbon index 9b18975aa252..53dc010f32e8 100644 --- a/toolchain/check/testdata/class/base_function_unqualified.carbon +++ b/toolchain/check/testdata/class/base_function_unqualified.carbon @@ -33,8 +33,8 @@ fn Derived.H() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Derived = %Derived.decl} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () +// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] +// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () [template = constants.%Derived] // CHECK:STDOUT: %H: = fn_decl @H [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -46,7 +46,7 @@ fn Derived.H() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, constants.%Base [template = constants.%Base] +// 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] diff --git a/toolchain/check/testdata/class/base_method.carbon b/toolchain/check/testdata/class/base_method.carbon index 8aeba55b81ec..72fa2dc7d917 100644 --- a/toolchain/check/testdata/class/base_method.carbon +++ b/toolchain/check/testdata/class/base_method.carbon @@ -42,9 +42,9 @@ fn Call(p: Derived*) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Derived = %Derived.decl, .Call = %Call} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () +// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] // CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () +// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () [template = constants.%Derived] // CHECK:STDOUT: %Call: = fn_decl @Call [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -58,7 +58,7 @@ fn Call(p: Derived*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, constants.%Base [template = constants.%Base] +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc18: = base_decl Base, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/base_method_shadow.carbon b/toolchain/check/testdata/class/base_method_shadow.carbon index 4cbd97689e0b..0be606e2e63e 100644 --- a/toolchain/check/testdata/class/base_method_shadow.carbon +++ b/toolchain/check/testdata/class/base_method_shadow.carbon @@ -56,10 +56,10 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl, .B = %B.decl, .C = %C.decl, .D = %D.decl, .Call = %Call} [template] -// CHECK:STDOUT: %A.decl = class_decl @A, () -// CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %D.decl = class_decl @D, () +// CHECK:STDOUT: %A.decl = class_decl @A, () [template = constants.%A] +// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %D.decl = class_decl @D, () [template = constants.%D] // CHECK:STDOUT: %Call: = fn_decl @Call [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -71,7 +71,7 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %A.ref: type = name_ref A, constants.%A [template = constants.%A] +// 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: @@ -82,7 +82,7 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B.ref: type = name_ref B, constants.%B [template = constants.%B] +// 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: @@ -93,7 +93,7 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { -// CHECK:STDOUT: %B.ref: type = name_ref B, constants.%B [template = constants.%B] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc22: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/basic.carbon b/toolchain/check/testdata/class/basic.carbon index 2d20cd6636ca..812330792c78 100644 --- a/toolchain/check/testdata/class/basic.carbon +++ b/toolchain/check/testdata/class/basic.carbon @@ -33,7 +33,7 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .Run = %Run} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: %Run: = fn_decl @Run [template] // CHECK:STDOUT: } @@ -63,7 +63,7 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// 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: %.loc22_17.1: init i32 = call %F.ref(%.loc22_18) diff --git a/toolchain/check/testdata/class/derived_to_base.carbon b/toolchain/check/testdata/class/derived_to_base.carbon index 7cea89eb5422..83a57362f888 100644 --- a/toolchain/check/testdata/class/derived_to_base.carbon +++ b/toolchain/check/testdata/class/derived_to_base.carbon @@ -70,9 +70,9 @@ fn ConvertInit() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl, .B = %B.decl, .C = %C.decl, .ConvertCToB = %ConvertCToB, .ConvertBToA = %ConvertBToA, .ConvertCToA = %ConvertCToA, .ConvertValue = %ConvertValue, .ConvertRef = %ConvertRef, .ConvertInit = %ConvertInit} [template] -// CHECK:STDOUT: %A.decl = class_decl @A, () -// CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %A.decl = class_decl @A, () [template = constants.%A] +// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: %ConvertCToB: = fn_decl @ConvertCToB [template] // CHECK:STDOUT: %ConvertBToA: = fn_decl @ConvertBToA [template] // CHECK:STDOUT: %ConvertCToA: = fn_decl @ConvertCToA [template] @@ -89,7 +89,7 @@ fn ConvertInit() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %A.ref: type = name_ref A, constants.%A [template = constants.%A] +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %.loc12: = base_decl A, element0 [template] // CHECK:STDOUT: %.loc13: = field_decl b, element1 [template] // CHECK:STDOUT: @@ -100,7 +100,7 @@ fn ConvertInit() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B.ref: type = name_ref B, constants.%B [template = constants.%B] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc17: = base_decl B, element0 [template] // CHECK:STDOUT: %.loc18: = field_decl c, element1 [template] // CHECK:STDOUT: @@ -143,7 +143,7 @@ fn ConvertInit() { // CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertValue(%c: C) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: type = name_ref A, constants.%A [template = constants.%A] +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %c.ref: C = name_ref c, %c // CHECK:STDOUT: %.loc26_15.1: ref B = class_element_access %c.ref, element0 // CHECK:STDOUT: %.loc26_15.2: ref A = class_element_access %.loc26_15.1, element0 @@ -157,7 +157,7 @@ fn ConvertInit() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: C* = name_ref c, %c // CHECK:STDOUT: %.loc30_12.1: ref C = deref %c.ref -// CHECK:STDOUT: %A.ref: type = name_ref A, constants.%A [template = constants.%A] +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %.loc30_15.1: ref B = class_element_access %.loc30_12.1, element0 // CHECK:STDOUT: %.loc30_15.2: ref A = class_element_access %.loc30_15.1, element0 // CHECK:STDOUT: %.loc30_12.2: ref A = converted %.loc30_12.1, %.loc30_15.2 @@ -167,14 +167,14 @@ fn ConvertInit() { // CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertInit() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: type = name_ref A, constants.%A [template = constants.%A] +// 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_39.1: {.a: i32} = struct_literal (%.loc34_38) // CHECK:STDOUT: %.loc34_47: i32 = int_literal 2 [template = constants.%.20] // 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_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, constants.%C [template = constants.%C] +// 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 diff --git a/toolchain/check/testdata/class/fail_abstract.carbon b/toolchain/check/testdata/class/fail_abstract.carbon index bfef274dc1e4..cd8910386fea 100644 --- a/toolchain/check/testdata/class/fail_abstract.carbon +++ b/toolchain/check/testdata/class/fail_abstract.carbon @@ -50,8 +50,8 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Abstract = %Abstract.decl, .Derived = %Derived.decl, .Make = %Make, .Access = %Access} [template] -// CHECK:STDOUT: %Abstract.decl = class_decl @Abstract, () -// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () +// CHECK:STDOUT: %Abstract.decl = class_decl @Abstract, () [template = constants.%Abstract] +// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () [template = constants.%Derived] // CHECK:STDOUT: %Make: = fn_decl @Make [template] // CHECK:STDOUT: %Access: = fn_decl @Access [template] // CHECK:STDOUT: } @@ -64,7 +64,7 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, constants.%Abstract [template = constants.%Abstract] +// CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract] // CHECK:STDOUT: %.loc12: = base_decl Abstract, element0 [template] // CHECK:STDOUT: %.loc14: = field_decl d, element1 [template] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_addr_not_self.carbon b/toolchain/check/testdata/class/fail_addr_not_self.carbon index bb15eff187ef..e9eef43010ad 100644 --- a/toolchain/check/testdata/class/fail_addr_not_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_not_self.carbon @@ -26,7 +26,7 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { diff --git a/toolchain/check/testdata/class/fail_addr_self.carbon b/toolchain/check/testdata/class/fail_addr_self.carbon index b37889616877..efe666eedc8f 100644 --- a/toolchain/check/testdata/class/fail_addr_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_self.carbon @@ -50,7 +50,7 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .F = %F} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F.2 [template] // 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 3545ee31fcf3..9b7dffdb0ea4 100644 --- a/toolchain/check/testdata/class/fail_base_bad_type.carbon +++ b/toolchain/check/testdata/class/fail_base_bad_type.carbon @@ -161,26 +161,26 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Final = %Final.decl, .DeriveFromError = %DeriveFromError.decl, .AccessMemberWithInvalidBaseError = %AccessMemberWithInvalidBaseError, .DeriveFromNonType = %DeriveFromNonType.decl, .AccessMemberWithInvalidBasNonType = %AccessMemberWithInvalidBasNonType, .DeriveFromi32 = %DeriveFromi32.decl, .ConvertToBadBasei32 = %ConvertToBadBasei32, .AccessMemberWithInvalidBasei32 = %AccessMemberWithInvalidBasei32, .DeriveFromTuple = %DeriveFromTuple.decl, .ConvertToBadBaseTuple = %ConvertToBadBaseTuple, .AccessMemberWithInvalidBaseTuple = %AccessMemberWithInvalidBaseTuple, .DeriveFromStruct = %DeriveFromStruct.decl, .ConvertToBadBaseStruct = %ConvertToBadBaseStruct, .AccessMemberWithInvalidBaseStruct = %AccessMemberWithInvalidBaseStruct, .Incomplete = %Incomplete.decl, .DeriveFromIncomplete = %DeriveFromIncomplete.decl, .ConvertToBadBaseIncomplete = %ConvertToBadBaseIncomplete, .AccessMemberWithInvalidBaseIncomplete = %AccessMemberWithInvalidBaseIncomplete, .DeriveFromFinal = %DeriveFromFinal.decl, .ConvertToBadBaseFinal = %ConvertToBadBaseFinal, .AccessMemberWithInvalidBaseFinal_WithMember = %AccessMemberWithInvalidBaseFinal_WithMember, .AccessMemberWithInvalidBaseFinal_NoMember = %AccessMemberWithInvalidBaseFinal_NoMember} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Final.decl = class_decl @Final, () -// CHECK:STDOUT: %DeriveFromError.decl = class_decl @DeriveFromError, () +// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] +// CHECK:STDOUT: %Final.decl = class_decl @Final, () [template = constants.%Final] +// CHECK:STDOUT: %DeriveFromError.decl = class_decl @DeriveFromError, () [template = constants.%DeriveFromError] // CHECK:STDOUT: %AccessMemberWithInvalidBaseError: = fn_decl @AccessMemberWithInvalidBaseError [template] -// CHECK:STDOUT: %DeriveFromNonType.decl = class_decl @DeriveFromNonType, () +// CHECK:STDOUT: %DeriveFromNonType.decl = class_decl @DeriveFromNonType, () [template = constants.%DeriveFromNonType] // CHECK:STDOUT: %AccessMemberWithInvalidBasNonType: = fn_decl @AccessMemberWithInvalidBasNonType [template] -// CHECK:STDOUT: %DeriveFromi32.decl = class_decl @DeriveFromi32, () +// CHECK:STDOUT: %DeriveFromi32.decl = class_decl @DeriveFromi32, () [template = constants.%DeriveFromi32] // CHECK:STDOUT: %ConvertToBadBasei32: = fn_decl @ConvertToBadBasei32 [template] // CHECK:STDOUT: %AccessMemberWithInvalidBasei32: = fn_decl @AccessMemberWithInvalidBasei32 [template] -// CHECK:STDOUT: %DeriveFromTuple.decl = class_decl @DeriveFromTuple, () +// CHECK:STDOUT: %DeriveFromTuple.decl = class_decl @DeriveFromTuple, () [template = constants.%DeriveFromTuple] // CHECK:STDOUT: %ConvertToBadBaseTuple: = fn_decl @ConvertToBadBaseTuple [template] // CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple: = fn_decl @AccessMemberWithInvalidBaseTuple [template] -// CHECK:STDOUT: %DeriveFromStruct.decl = class_decl @DeriveFromStruct, () +// CHECK:STDOUT: %DeriveFromStruct.decl = class_decl @DeriveFromStruct, () [template = constants.%DeriveFromStruct] // CHECK:STDOUT: %ConvertToBadBaseStruct: = fn_decl @ConvertToBadBaseStruct [template] // CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct: = fn_decl @AccessMemberWithInvalidBaseStruct [template] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %DeriveFromIncomplete.decl = class_decl @DeriveFromIncomplete, () +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %DeriveFromIncomplete.decl = class_decl @DeriveFromIncomplete, () [template = constants.%DeriveFromIncomplete] // CHECK:STDOUT: %ConvertToBadBaseIncomplete: = fn_decl @ConvertToBadBaseIncomplete [template] // CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete: = fn_decl @AccessMemberWithInvalidBaseIncomplete [template] -// CHECK:STDOUT: %DeriveFromFinal.decl = class_decl @DeriveFromFinal, () +// CHECK:STDOUT: %DeriveFromFinal.decl = class_decl @DeriveFromFinal, () [template = constants.%DeriveFromFinal] // CHECK:STDOUT: %ConvertToBadBaseFinal: = fn_decl @ConvertToBadBaseFinal [template] // CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember: = fn_decl @AccessMemberWithInvalidBaseFinal_WithMember [template] // CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember: = fn_decl @AccessMemberWithInvalidBaseFinal_NoMember [template] @@ -225,7 +225,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromTuple { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, constants.%Base [template = constants.%Base] +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc51_22.1: (type,) = tuple_literal (%Base.ref) // CHECK:STDOUT: %.loc51_22.2: type = converted %.loc51_22.1, constants.%.10 [template = constants.%.10] // CHECK:STDOUT: %.loc51_23: = base_decl , element0 [template] @@ -247,7 +247,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: class @Incomplete; // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromIncomplete { -// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete.decl [template = constants.%Incomplete] // CHECK:STDOUT: %.loc87: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -256,7 +256,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromFinal { -// CHECK:STDOUT: %Final.ref: type = name_ref Final, constants.%Final [template = constants.%Final] +// CHECK:STDOUT: %Final.ref: type = name_ref Final, file.%Final.decl [template = constants.%Final] // CHECK:STDOUT: %.loc101: = base_decl Final, 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 37e39b6a79ac..5c0bb8992694 100644 --- a/toolchain/check/testdata/class/fail_base_method_define.carbon +++ b/toolchain/check/testdata/class/fail_base_method_define.carbon @@ -41,15 +41,15 @@ fn D.C.F() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B = %B.decl, .D = %D.decl} [template] -// CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %D.decl = class_decl @D, () +// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] +// CHECK:STDOUT: %D.decl = class_decl @D, () [template = constants.%D] // CHECK:STDOUT: %F: = fn_decl @F.3 [template] // CHECK:STDOUT: %.loc27: = fn_decl @.1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %F: = fn_decl @F.1 [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -64,7 +64,7 @@ fn D.C.F() {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { -// CHECK:STDOUT: %B.ref: type = name_ref B, constants.%B [template = constants.%B] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc16: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/fail_base_modifiers.carbon b/toolchain/check/testdata/class/fail_base_modifiers.carbon index a1c97ca448f7..bcd887cce54f 100644 --- a/toolchain/check/testdata/class/fail_base_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_base_modifiers.carbon @@ -63,11 +63,11 @@ class C4 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B = %B.decl, .C1 = %C1.decl, .C2 = %C2.decl, .C3 = %C3.decl, .C4 = %C4.decl} [template] -// CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %C1.decl = class_decl @C1, () -// CHECK:STDOUT: %C2.decl = class_decl @C2, () -// CHECK:STDOUT: %C3.decl = class_decl @C3, () -// CHECK:STDOUT: %C4.decl = class_decl @C4, () +// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] +// CHECK:STDOUT: %C1.decl = class_decl @C1, () [template = constants.%C1] +// CHECK:STDOUT: %C2.decl = class_decl @C2, () [template = constants.%C2] +// CHECK:STDOUT: %C3.decl = class_decl @C3, () [template = constants.%C3] +// CHECK:STDOUT: %C4.decl = class_decl @C4, () [template = constants.%C4] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { @@ -76,7 +76,7 @@ class C4 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C1 { -// CHECK:STDOUT: %B.ref: type = name_ref B, constants.%B [template = constants.%B] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc13: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -85,7 +85,7 @@ class C4 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C2 { -// CHECK:STDOUT: %B.ref: type = name_ref B, constants.%B [template = constants.%B] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc23: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -93,7 +93,7 @@ class C4 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C3 { -// CHECK:STDOUT: %B.ref: type = name_ref B, constants.%B [template = constants.%B] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc33: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -102,7 +102,7 @@ class C4 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C4 { -// CHECK:STDOUT: %B.ref: type = name_ref B, constants.%B [template = constants.%B] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc43: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/fail_base_no_extend.carbon b/toolchain/check/testdata/class/fail_base_no_extend.carbon index 71dca8b509f4..353062026843 100644 --- a/toolchain/check/testdata/class/fail_base_no_extend.carbon +++ b/toolchain/check/testdata/class/fail_base_no_extend.carbon @@ -27,8 +27,8 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B = %B.decl, .C = %C.decl} [template] -// CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { @@ -37,7 +37,7 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B.ref: type = name_ref B, constants.%B [template = constants.%B] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc13: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/fail_base_repeated.carbon b/toolchain/check/testdata/class/fail_base_repeated.carbon index 7151c4b3c092..a8b8833ec8ad 100644 --- a/toolchain/check/testdata/class/fail_base_repeated.carbon +++ b/toolchain/check/testdata/class/fail_base_repeated.carbon @@ -47,10 +47,10 @@ class D { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B1 = %B1.decl, .B2 = %B2.decl, .C = %C.decl, .D = %D.decl} [template] -// CHECK:STDOUT: %B1.decl = class_decl @B1, () -// CHECK:STDOUT: %B2.decl = class_decl @B2, () -// CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %D.decl = class_decl @D, () +// CHECK:STDOUT: %B1.decl = class_decl @B1, () [template = constants.%B1] +// CHECK:STDOUT: %B2.decl = class_decl @B2, () [template = constants.%B2] +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %D.decl = class_decl @D, () [template = constants.%D] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B1 { @@ -64,9 +64,9 @@ class D { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B1.ref: type = name_ref B1, constants.%B1 [template = constants.%B1] +// CHECK:STDOUT: %B1.ref: type = name_ref B1, file.%B1.decl [template = constants.%B1] // CHECK:STDOUT: %.loc11: = base_decl B1, element0 [template] -// CHECK:STDOUT: %B2.ref: type = name_ref B2, constants.%B2 [template = constants.%B2] +// CHECK:STDOUT: %B2.ref: type = name_ref B2, file.%B2.decl [template = constants.%B2] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc11 @@ -74,9 +74,9 @@ class D { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { -// CHECK:STDOUT: %B1.ref.loc23: type = name_ref B1, constants.%B1 [template = constants.%B1] +// CHECK:STDOUT: %B1.ref.loc23: type = name_ref B1, file.%B1.decl [template = constants.%B1] // CHECK:STDOUT: %.loc23: = base_decl B1, element0 [template] -// CHECK:STDOUT: %B1.ref.loc30: type = name_ref B1, constants.%B1 [template = constants.%B1] +// CHECK:STDOUT: %B1.ref.loc30: type = name_ref B1, file.%B1.decl [template = constants.%B1] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc23 diff --git a/toolchain/check/testdata/class/fail_base_unbound.carbon b/toolchain/check/testdata/class/fail_base_unbound.carbon index b4ba5bdc3b95..05e329e3d837 100644 --- a/toolchain/check/testdata/class/fail_base_unbound.carbon +++ b/toolchain/check/testdata/class/fail_base_unbound.carbon @@ -29,10 +29,10 @@ let b: B = C.base; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.B = %B.decl, .C = %C.decl} [template] -// CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %B.ref: type = name_ref B, constants.%B [template = constants.%B] -// CHECK:STDOUT: %C.ref: type = name_ref C, constants.%C [template = constants.%C] +// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %B.ref: type = name_ref B, %B.decl [template = constants.%B] +// CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %base.ref: = name_ref base, @C.%.loc10 [template = @C.%.loc10] // CHECK:STDOUT: %b: B = bind_name b, // CHECK:STDOUT: } @@ -43,7 +43,7 @@ let b: B = C.base; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B.ref: type = name_ref B, constants.%B [template = constants.%B] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] // CHECK:STDOUT: %.loc10: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon index c282ccf25ce3..61fcb7b7b8ec 100644 --- a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon +++ b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon @@ -25,7 +25,7 @@ fn Make() -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.C = %C.decl, .Make = %Make} [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: %Make: = fn_decl @Make [template] // CHECK:STDOUT: } // 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 f4f2c4ca864e..ed2d7c576cbf 100644 --- a/toolchain/check/testdata/class/fail_derived_to_base.carbon +++ b/toolchain/check/testdata/class/fail_derived_to_base.carbon @@ -54,11 +54,11 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A1 = %A1.decl, .A2 = %A2.decl, .B2 = %B2.decl, .ConvertUnrelated = %ConvertUnrelated, .Incomplete = %Incomplete.decl, .ConvertIncomplete = %ConvertIncomplete} [template] -// CHECK:STDOUT: %A1.decl = class_decl @A1, () -// CHECK:STDOUT: %A2.decl = class_decl @A2, () -// CHECK:STDOUT: %B2.decl = class_decl @B2, () +// CHECK:STDOUT: %A1.decl = class_decl @A1, () [template = constants.%A1] +// CHECK:STDOUT: %A2.decl = class_decl @A2, () [template = constants.%A2] +// CHECK:STDOUT: %B2.decl = class_decl @B2, () [template = constants.%B2] // CHECK:STDOUT: %ConvertUnrelated: = fn_decl @ConvertUnrelated [template] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] // CHECK:STDOUT: %ConvertIncomplete: = fn_decl @ConvertIncomplete [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -77,7 +77,7 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B2 { -// CHECK:STDOUT: %A2.ref: type = name_ref A2, constants.%A2 [template = constants.%A2] +// CHECK:STDOUT: %A2.ref: type = name_ref A2, file.%A2.decl [template = constants.%A2] // CHECK:STDOUT: %.loc16: = base_decl A2, element0 [template] // CHECK:STDOUT: %.loc17: = field_decl b, element1 [template] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_field_modifiers.carbon b/toolchain/check/testdata/class/fail_field_modifiers.carbon index 1f1f133f8d8a..acb86715975e 100644 --- a/toolchain/check/testdata/class/fail_field_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_field_modifiers.carbon @@ -39,7 +39,7 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { diff --git a/toolchain/check/testdata/class/fail_import_misuses.carbon b/toolchain/check/testdata/class/fail_import_misuses.carbon index c8545da497e5..728723c85784 100644 --- a/toolchain/check/testdata/class/fail_import_misuses.carbon +++ b/toolchain/check/testdata/class/fail_import_misuses.carbon @@ -44,8 +44,8 @@ var a: Incomplete; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl, .Incomplete = %Incomplete.decl} [template] -// CHECK:STDOUT: %Empty.decl = class_decl @Empty, () -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () +// CHECK:STDOUT: %Empty.decl = class_decl @Empty, () [template = constants.%Empty] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Empty { @@ -66,11 +66,11 @@ var a: Incomplete; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %import_ref.1, .Incomplete = %import_ref.2, .a = %a} [template] -// CHECK:STDOUT: %import_ref.1: invalid = import_ref ir1, inst+1, used [template = constants.%Empty] -// CHECK:STDOUT: %import_ref.2: invalid = import_ref ir1, inst+4, used [template = constants.%Incomplete] -// CHECK:STDOUT: %.decl = class_decl @.1, () -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%Empty] +// CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+4, used [template = constants.%Incomplete] +// CHECK:STDOUT: %.decl = class_decl @.1, () [template = constants.%.2] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, %import_ref.2 [template = constants.%Incomplete] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index 21d5cb17528d..37b5ecf74ddd 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -126,10 +126,10 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .CallClassFunction = %CallClassFunction, .global_var = %global_var, .ConvertFromStruct = %ConvertFromStruct, .MemberAccess = %MemberAccess, .Copy = %Copy, .Let = %Let, .TakeIncomplete = %TakeIncomplete, .ReturnIncomplete = %ReturnIncomplete, .CallTakeIncomplete = %CallTakeIncomplete, .CallReturnIncomplete = %CallReturnIncomplete} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %.loc15: = fn_decl @.1 [template] // CHECK:STDOUT: %CallClassFunction: = fn_decl @CallClassFunction [template] -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: 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] @@ -151,7 +151,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallClassFunction() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %Function.ref: = name_ref Function, [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -178,7 +178,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Let(%p: Class*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p // CHECK:STDOUT: %.loc75: ref Class = deref %p.ref // CHECK:STDOUT: %c: = bind_name c, diff --git a/toolchain/check/testdata/class/fail_init.carbon b/toolchain/check/testdata/class/fail_init.carbon index cef4f072e1d1..6bf15b6ec260 100644 --- a/toolchain/check/testdata/class/fail_init.carbon +++ b/toolchain/check/testdata/class/fail_init.carbon @@ -41,7 +41,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .F = %F} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -58,14 +58,14 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc16_9: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: %.loc16_10.1: {.a: i32} = struct_literal (%.loc16_9) -// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc16_10.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc16_10.3: ref Class = temporary %.loc16_10.2, // CHECK:STDOUT: %.loc16_10.4: ref Class = converted %.loc16_10.1, %.loc16_10.3 // CHECK:STDOUT: %.loc20_9: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: %.loc20_17: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc20_18.1: {.a: i32, .c: i32} = struct_literal (%.loc20_9, %.loc20_17) -// CHECK:STDOUT: %Class.ref.loc20: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc20: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc20_18.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc20_18.3: ref i32 = class_element_access %.loc20_18.2, element0 // CHECK:STDOUT: %.loc20_18.4: init i32 = initialize_from %.loc20_9 to %.loc20_18.3 [template = constants.%.3] @@ -75,7 +75,7 @@ fn F() { // CHECK:STDOUT: %.loc24_17: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc24_25: i32 = int_literal 3 [template = constants.%.8] // CHECK:STDOUT: %.loc24_26.1: {.a: i32, .b: i32, .c: i32} = struct_literal (%.loc24_9, %.loc24_17, %.loc24_25) -// CHECK:STDOUT: %Class.ref.loc24: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc24: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc24_26.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc24_26.3: ref Class = temporary %.loc24_26.2, // CHECK:STDOUT: %.loc24_26.4: ref Class = converted %.loc24_26.1, %.loc24_26.3 diff --git a/toolchain/check/testdata/class/fail_init_as_inplace.carbon b/toolchain/check/testdata/class/fail_init_as_inplace.carbon index 0a72ae7caadf..41479352a8bd 100644 --- a/toolchain/check/testdata/class/fail_init_as_inplace.carbon +++ b/toolchain/check/testdata/class/fail_init_as_inplace.carbon @@ -38,7 +38,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .G = %G, .F = %F} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } @@ -56,13 +56,13 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref.loc21_10: type = name_ref Class, constants.%Class [template = constants.%Class] +// 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_33.1: {.a: i32, .b: i32} = struct_literal (%.loc21_24, %.loc21_32) -// CHECK:STDOUT: %Class.ref.loc21_38: type = name_ref Class, constants.%Class [template = constants.%Class] +// 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] diff --git a/toolchain/check/testdata/class/fail_memaccess_category.carbon b/toolchain/check/testdata/class/fail_memaccess_category.carbon index 9207fcff3bd8..9605dba6fab0 100644 --- a/toolchain/check/testdata/class/fail_memaccess_category.carbon +++ b/toolchain/check/testdata/class/fail_memaccess_category.carbon @@ -50,8 +50,8 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl, .B = %B.decl, .F = %F} [template] -// CHECK:STDOUT: %A.decl = class_decl @A, () -// CHECK:STDOUT: %B.decl = class_decl @B, () +// CHECK:STDOUT: %A.decl = class_decl @A, () [template = constants.%A] +// CHECK:STDOUT: %B.decl = class_decl @B, () [template = constants.%B] // CHECK:STDOUT: %F: = fn_decl @F.2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -63,7 +63,7 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %A.ref: type = name_ref A, constants.%A [template = constants.%A] +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %.loc12: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/fail_member_of_let.carbon b/toolchain/check/testdata/class/fail_member_of_let.carbon index 47fbe6ea4b1b..ee28258e2c1a 100644 --- a/toolchain/check/testdata/class/fail_member_of_let.carbon +++ b/toolchain/check/testdata/class/fail_member_of_let.carbon @@ -27,8 +27,8 @@ fn T.F() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %T: type = bind_name T, %Class.ref // CHECK:STDOUT: %.loc19: = fn_decl @.1 [template] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_method.carbon b/toolchain/check/testdata/class/fail_method.carbon index e168484e0d5b..6fb83cd29430 100644 --- a/toolchain/check/testdata/class/fail_method.carbon +++ b/toolchain/check/testdata/class/fail_method.carbon @@ -51,8 +51,8 @@ fn F(c: Class) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .A = %A, .F = %F} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %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] @@ -79,13 +79,13 @@ fn F(c: Class) { // CHECK:STDOUT: %c.ref.loc16: Class = name_ref c, %c // CHECK:STDOUT: %.loc16_4: = bound_method %c.ref.loc16, @Class.%WithSelf // CHECK:STDOUT: %.loc16_13: init () = call %.loc16_4(%c.ref.loc16) -// CHECK:STDOUT: %Class.ref.loc18: type = name_ref Class, constants.%Class [template = constants.%Class] +// 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: %.loc18: init () = call %NoSelf.ref.loc18() -// CHECK:STDOUT: %Class.ref.loc25: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc25: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %WithSelf.ref.loc25: = name_ref WithSelf, @Class.%WithSelf [template = @Class.%WithSelf] // CHECK:STDOUT: %.loc25: init () = call %WithSelf.ref.loc25() -// CHECK:STDOUT: %Class.ref.loc32: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc32: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %WithSelf.ref.loc32: = name_ref WithSelf, @Class.%WithSelf [template = @Class.%WithSelf] // CHECK:STDOUT: %c.ref.loc32: Class = name_ref c, %c // CHECK:STDOUT: %.loc32: init () = call %WithSelf.ref.loc32() diff --git a/toolchain/check/testdata/class/fail_method_modifiers.carbon b/toolchain/check/testdata/class/fail_method_modifiers.carbon index 4396057d894c..2fd287b9aef0 100644 --- a/toolchain/check/testdata/class/fail_method_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_method_modifiers.carbon @@ -58,9 +58,9 @@ base class BaseClass { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.FinalClass = %FinalClass.decl, .AbstractClass = %AbstractClass.decl, .BaseClass = %BaseClass.decl} [template] -// CHECK:STDOUT: %FinalClass.decl = class_decl @FinalClass, () -// CHECK:STDOUT: %AbstractClass.decl = class_decl @AbstractClass, () -// CHECK:STDOUT: %BaseClass.decl = class_decl @BaseClass, () +// CHECK:STDOUT: %FinalClass.decl = class_decl @FinalClass, () [template = constants.%FinalClass] +// CHECK:STDOUT: %AbstractClass.decl = class_decl @AbstractClass, () [template = constants.%AbstractClass] +// CHECK:STDOUT: %BaseClass.decl = class_decl @BaseClass, () [template = constants.%BaseClass] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @FinalClass { diff --git a/toolchain/check/testdata/class/fail_modifiers.carbon b/toolchain/check/testdata/class/fail_modifiers.carbon index c7dfd7b7a882..354b6275e125 100644 --- a/toolchain/check/testdata/class/fail_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_modifiers.carbon @@ -78,12 +78,12 @@ abstract base class AbstractAndBase {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.DuplicatePrivate = %DuplicatePrivate.decl, .TwoAccess = %TwoAccess.decl, .TwoAbstract = %TwoAbstract.decl, .Virtual = %Virtual.decl, .WrongOrder = %WrongOrder.decl, .AbstractAndBase = %AbstractAndBase.decl} [template] -// CHECK:STDOUT: %DuplicatePrivate.decl = class_decl @DuplicatePrivate, () -// CHECK:STDOUT: %TwoAccess.decl = class_decl @TwoAccess, () -// CHECK:STDOUT: %TwoAbstract.decl = class_decl @TwoAbstract, () -// CHECK:STDOUT: %Virtual.decl = class_decl @Virtual, () -// CHECK:STDOUT: %WrongOrder.decl = class_decl @WrongOrder, () -// CHECK:STDOUT: %AbstractAndBase.decl = class_decl @AbstractAndBase, () +// CHECK:STDOUT: %DuplicatePrivate.decl = class_decl @DuplicatePrivate, () [template = constants.%DuplicatePrivate] +// CHECK:STDOUT: %TwoAccess.decl = class_decl @TwoAccess, () [template = constants.%TwoAccess] +// CHECK:STDOUT: %TwoAbstract.decl = class_decl @TwoAbstract, () [template = constants.%TwoAbstract] +// CHECK:STDOUT: %Virtual.decl = class_decl @Virtual, () [template = constants.%Virtual] +// CHECK:STDOUT: %WrongOrder.decl = class_decl @WrongOrder, () [template = constants.%WrongOrder] +// CHECK:STDOUT: %AbstractAndBase.decl = class_decl @AbstractAndBase, () [template = constants.%AbstractAndBase] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DuplicatePrivate; diff --git a/toolchain/check/testdata/class/fail_out_of_line_decl.carbon b/toolchain/check/testdata/class/fail_out_of_line_decl.carbon index a9f7a024c7eb..273ce3d3f524 100644 --- a/toolchain/check/testdata/class/fail_out_of_line_decl.carbon +++ b/toolchain/check/testdata/class/fail_out_of_line_decl.carbon @@ -20,7 +20,7 @@ fn C.F() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.C = %C.decl} [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon b/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon index 953dbd914d79..6ca4c2dcc3f2 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon @@ -89,21 +89,21 @@ base class G; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl.loc7, .B = %B.decl.loc16, .C = %C.decl.loc25, .D = %D.decl.loc34, .E = %E.decl.loc43, .F = %F.decl.loc52, .G = %G.decl.loc61} [template] -// CHECK:STDOUT: %A.decl.loc7 = class_decl @A, () -// CHECK:STDOUT: %A.decl.loc14 = class_decl @A, () -// CHECK:STDOUT: %B.decl.loc16 = class_decl @B, () -// CHECK:STDOUT: %B.decl.loc23 = class_decl @B, () -// CHECK:STDOUT: %C.decl.loc25 = class_decl @C, () -// CHECK:STDOUT: %C.decl.loc32 = class_decl @C, () -// CHECK:STDOUT: %D.decl.loc34 = class_decl @D, () -// CHECK:STDOUT: %D.decl.loc41 = class_decl @D, () -// CHECK:STDOUT: %E.decl.loc43 = class_decl @E, () -// CHECK:STDOUT: %E.decl.loc50 = class_decl @E, () -// CHECK:STDOUT: %F.decl.loc52 = class_decl @F, () -// CHECK:STDOUT: %F.decl.loc59 = class_decl @F, () -// CHECK:STDOUT: %G.decl.loc61 = class_decl @G, () -// CHECK:STDOUT: %G.decl.loc68 = class_decl @G, () -// CHECK:STDOUT: %G.decl.loc75 = class_decl @G, () +// CHECK:STDOUT: %A.decl.loc7 = class_decl @A, () [template = constants.%A] +// CHECK:STDOUT: %A.decl.loc14 = class_decl @A, () [template = constants.%A] +// CHECK:STDOUT: %B.decl.loc16 = class_decl @B, () [template = constants.%B] +// CHECK:STDOUT: %B.decl.loc23 = class_decl @B, () [template = constants.%B] +// CHECK:STDOUT: %C.decl.loc25 = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %C.decl.loc32 = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %D.decl.loc34 = class_decl @D, () [template = constants.%D] +// CHECK:STDOUT: %D.decl.loc41 = class_decl @D, () [template = constants.%D] +// CHECK:STDOUT: %E.decl.loc43 = class_decl @E, () [template = constants.%E] +// CHECK:STDOUT: %E.decl.loc50 = class_decl @E, () [template = constants.%E] +// CHECK:STDOUT: %F.decl.loc52 = class_decl @F, () [template = constants.%F] +// CHECK:STDOUT: %F.decl.loc59 = class_decl @F, () [template = constants.%F] +// CHECK:STDOUT: %G.decl.loc61 = class_decl @G, () [template = constants.%G] +// CHECK:STDOUT: %G.decl.loc68 = class_decl @G, () [template = constants.%G] +// CHECK:STDOUT: %G.decl.loc75 = class_decl @G, () [template = constants.%G] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { diff --git a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon index d51286d70aa3..b57030af018f 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon @@ -36,29 +36,29 @@ class Y { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl.loc7, .X = %X.decl, .Y = %Y.decl} [template] -// CHECK:STDOUT: %A.decl.loc7 = class_decl @A.1, () -// CHECK:STDOUT: %X.decl = class_decl @X, () -// CHECK:STDOUT: %A.decl.loc15 = class_decl @A.1, () -// CHECK:STDOUT: %Y.decl = class_decl @Y, () +// CHECK:STDOUT: %A.decl.loc7 = class_decl @A.1, () [template = constants.%A.1] +// CHECK:STDOUT: %X.decl = class_decl @X, () [template = constants.%X] +// CHECK:STDOUT: %A.decl.loc15 = class_decl @A.1, () [template = constants.%A.1] +// CHECK:STDOUT: %Y.decl = class_decl @Y, () [template = constants.%Y] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A.1 { -// CHECK:STDOUT: %B.decl = class_decl @B.2, () +// CHECK:STDOUT: %B.decl = class_decl @B.2, () [template = constants.%B.2] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @X { -// CHECK:STDOUT: %A.decl = class_decl @A.2, () -// CHECK:STDOUT: %B.decl = class_decl @B.1, () +// CHECK:STDOUT: %A.decl = class_decl @A.2, () [template = constants.%A.2] +// CHECK:STDOUT: %B.decl = class_decl @B.1, () [template = constants.%B.1] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A.2 { -// CHECK:STDOUT: %B.decl = class_decl @B.1, () +// CHECK:STDOUT: %B.decl = class_decl @B.1, () [template = constants.%B.1] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .B = %B.decl @@ -72,7 +72,7 @@ class Y { // CHECK:STDOUT: class @B.2; // CHECK:STDOUT: // CHECK:STDOUT: class @Y { -// CHECK:STDOUT: %.decl = class_decl @.1, () +// CHECK:STDOUT: %.decl = class_decl @.1, () [template = constants.%.2] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_redefinition.carbon b/toolchain/check/testdata/class/fail_redefinition.carbon index 4033a3cde245..ed905eb2eee3 100644 --- a/toolchain/check/testdata/class/fail_redefinition.carbon +++ b/toolchain/check/testdata/class/fail_redefinition.carbon @@ -33,8 +33,8 @@ fn Class.H() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl.loc7} [template] -// CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class, () -// CHECK:STDOUT: %Class.decl.loc18 = class_decl @Class, () +// CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class, () [template = constants.%Class] +// CHECK:STDOUT: %Class.decl.loc18 = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: %H: = fn_decl @H [template] diff --git a/toolchain/check/testdata/class/fail_reorder.carbon b/toolchain/check/testdata/class/fail_reorder.carbon index 62f27daebbfe..b44d24060e72 100644 --- a/toolchain/check/testdata/class/fail_reorder.carbon +++ b/toolchain/check/testdata/class/fail_reorder.carbon @@ -35,7 +35,7 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { @@ -49,7 +49,7 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %F.ref: = name_ref F, [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_scope.carbon b/toolchain/check/testdata/class/fail_scope.carbon index bcd28ba77117..e7d7547f898b 100644 --- a/toolchain/check/testdata/class/fail_scope.carbon +++ b/toolchain/check/testdata/class/fail_scope.carbon @@ -27,7 +27,7 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .G = %G} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_self.carbon b/toolchain/check/testdata/class/fail_self.carbon index 5a24a7477699..33cc8b67c69b 100644 --- a/toolchain/check/testdata/class/fail_self.carbon +++ b/toolchain/check/testdata/class/fail_self.carbon @@ -62,10 +62,10 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .WrongSelf = %WrongSelf.decl, .CallWrongSelf = %CallWrongSelf} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F.1 [template] // CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %WrongSelf.decl = class_decl @WrongSelf, () +// CHECK:STDOUT: %WrongSelf.decl = class_decl @WrongSelf, () [template = constants.%WrongSelf] // CHECK:STDOUT: %CallWrongSelf: = fn_decl @CallWrongSelf [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -92,7 +92,7 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> %return: Class { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %self.var: ref Class = var self // CHECK:STDOUT: %self: ref Class = bind_name self, %self.var // CHECK:STDOUT: %self.ref: ref Class = name_ref self, %self diff --git a/toolchain/check/testdata/class/fail_todo_generic.carbon b/toolchain/check/testdata/class/fail_todo_generic.carbon index 5587854859e4..02a72c45e1ad 100644 --- a/toolchain/check/testdata/class/fail_todo_generic.carbon +++ b/toolchain/check/testdata/class/fail_todo_generic.carbon @@ -20,7 +20,7 @@ class C[](); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.C = %C.decl} [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C; diff --git a/toolchain/check/testdata/class/fail_todo_generic_method.carbon b/toolchain/check/testdata/class/fail_todo_generic_method.carbon index 3ca9162a0bf1..fe31bdafbeef 100644 --- a/toolchain/check/testdata/class/fail_todo_generic_method.carbon +++ b/toolchain/check/testdata/class/fail_todo_generic_method.carbon @@ -33,7 +33,7 @@ fn Class(T:! type).F[self: Self](n: T) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, (, ) +// CHECK:STDOUT: %Class.decl = class_decl @Class, (, ) [template = constants.%Class] // CHECK:STDOUT: %.loc24: = fn_decl @.1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_todo_import_forward_decl.carbon b/toolchain/check/testdata/class/fail_todo_import_forward_decl.carbon index ccd5fdce705c..376270bb42d0 100644 --- a/toolchain/check/testdata/class/fail_todo_import_forward_decl.carbon +++ b/toolchain/check/testdata/class/fail_todo_import_forward_decl.carbon @@ -34,7 +34,7 @@ class ForwardDecl { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.ForwardDecl = %ForwardDecl.decl} [template] -// CHECK:STDOUT: %ForwardDecl.decl = class_decl @ForwardDecl, () +// CHECK:STDOUT: %ForwardDecl.decl = class_decl @ForwardDecl, () [template = constants.%ForwardDecl] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDecl; @@ -49,8 +49,8 @@ class ForwardDecl { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.ForwardDecl = %import_ref} [template] -// CHECK:STDOUT: %import_ref: invalid = import_ref ir1, inst+1, used [template = constants.%ForwardDecl] -// CHECK:STDOUT: %.decl = class_decl @.1, () +// CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%ForwardDecl] +// CHECK:STDOUT: %.decl = class_decl @.1, () [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @ForwardDecl; diff --git a/toolchain/check/testdata/class/fail_todo_modifiers.carbon b/toolchain/check/testdata/class/fail_todo_modifiers.carbon index 29b6855d58ff..64167fe41d56 100644 --- a/toolchain/check/testdata/class/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_todo_modifiers.carbon @@ -71,9 +71,9 @@ abstract class Abstract { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Access = %Access.decl, .Base = %Base.decl, .Abstract = %Abstract.decl} [template] -// CHECK:STDOUT: %Access.decl = class_decl @Access, () -// CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Abstract.decl = class_decl @Abstract, () +// CHECK:STDOUT: %Access.decl = class_decl @Access, () [template = constants.%Access] +// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] +// CHECK:STDOUT: %Abstract.decl = class_decl @Abstract, () [template = constants.%Abstract] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Access { diff --git a/toolchain/check/testdata/class/fail_unbound_field.carbon b/toolchain/check/testdata/class/fail_unbound_field.carbon index 3ed8f1a62cd7..fced53c83312 100644 --- a/toolchain/check/testdata/class/fail_unbound_field.carbon +++ b/toolchain/check/testdata/class/fail_unbound_field.carbon @@ -31,7 +31,7 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .G = %G} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -52,7 +52,7 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %field.ref: = name_ref field, @Class.%.loc8 [template = @Class.%.loc8] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_unknown_member.carbon b/toolchain/check/testdata/class/fail_unknown_member.carbon index 9688ef4c4d7f..4d42cf08a2b7 100644 --- a/toolchain/check/testdata/class/fail_unknown_member.carbon +++ b/toolchain/check/testdata/class/fail_unknown_member.carbon @@ -27,7 +27,7 @@ fn G(c: Class) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .G = %G} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/field_access.carbon b/toolchain/check/testdata/class/field_access.carbon index d601a84bccc6..4ffd2dcd1727 100644 --- a/toolchain/check/testdata/class/field_access.carbon +++ b/toolchain/check/testdata/class/field_access.carbon @@ -30,7 +30,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .Run = %Run} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %Run: = fn_decl @Run [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -45,7 +45,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: 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: %c.ref.loc14: ref Class = name_ref c, %c diff --git a/toolchain/check/testdata/class/field_access_in_value.carbon b/toolchain/check/testdata/class/field_access_in_value.carbon index e1b62f21d0f8..86addcce7ba2 100644 --- a/toolchain/check/testdata/class/field_access_in_value.carbon +++ b/toolchain/check/testdata/class/field_access_in_value.carbon @@ -31,7 +31,7 @@ fn Test() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .Test = %Test} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %Test: = fn_decl @Test [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -46,7 +46,7 @@ fn Test() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Test() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref.loc13: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc13: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %cv.var: ref Class = var cv // CHECK:STDOUT: %cv: ref Class = bind_name cv, %cv.var // CHECK:STDOUT: %cv.ref.loc14: ref Class = name_ref cv, %cv @@ -57,7 +57,7 @@ fn Test() { // 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: assign %.loc15_5, %.loc15_10 -// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, constants.%Class [template = constants.%Class] +// 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 // CHECK:STDOUT: %.loc16: Class = bind_value %cv.ref.loc16 // CHECK:STDOUT: %c: Class = bind_name c, %.loc16 diff --git a/toolchain/check/testdata/class/forward_declared.carbon b/toolchain/check/testdata/class/forward_declared.carbon index 73d506055b4e..351bb3f2ce9a 100644 --- a/toolchain/check/testdata/class/forward_declared.carbon +++ b/toolchain/check/testdata/class/forward_declared.carbon @@ -17,7 +17,7 @@ fn F(p: Class*) -> Class* { return p; } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .F = %F} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/import.carbon b/toolchain/check/testdata/class/import.carbon index 407952f2abe4..bc00541f6380 100644 --- a/toolchain/check/testdata/class/import.carbon +++ b/toolchain/check/testdata/class/import.carbon @@ -60,11 +60,11 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl, .Field = %Field.decl, .ForwardDeclared = %ForwardDeclared.decl.loc11, .Incomplete = %Incomplete.decl} [template] -// CHECK:STDOUT: %Empty.decl = class_decl @Empty, () -// CHECK:STDOUT: %Field.decl = class_decl @Field, () -// CHECK:STDOUT: %ForwardDeclared.decl.loc11 = class_decl @ForwardDeclared, () -// CHECK:STDOUT: %ForwardDeclared.decl.loc13 = class_decl @ForwardDeclared, () -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () +// CHECK:STDOUT: %Empty.decl = class_decl @Empty, () [template = constants.%Empty] +// CHECK:STDOUT: %Field.decl = class_decl @Field, () [template = constants.%Field] +// CHECK:STDOUT: %ForwardDeclared.decl.loc11 = class_decl @ForwardDeclared, () [template = constants.%ForwardDeclared] +// CHECK:STDOUT: %ForwardDeclared.decl.loc13 = class_decl @ForwardDeclared, () [template = constants.%ForwardDeclared] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Empty { @@ -118,10 +118,10 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %import_ref.1, .Field = %import_ref.2, .ForwardDeclared = %import_ref.3, .Incomplete = %import_ref.4, .Run = %Run} [template] -// CHECK:STDOUT: %import_ref.1: invalid = import_ref ir1, inst+1, used [template = constants.%Empty] -// CHECK:STDOUT: %import_ref.2: invalid = import_ref ir1, inst+4, used [template = constants.%Field] -// CHECK:STDOUT: %import_ref.3: invalid = import_ref ir1, inst+11, used [template = constants.%ForwardDeclared] -// CHECK:STDOUT: %import_ref.4: invalid = import_ref ir1, inst+25, used [template = constants.%Incomplete] +// CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%Empty] +// CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+4, used [template = constants.%Field] +// CHECK:STDOUT: %import_ref.3: type = import_ref ir1, inst+11, used [template = constants.%ForwardDeclared] +// CHECK:STDOUT: %import_ref.4: type = import_ref ir1, inst+25, used [template = constants.%Incomplete] // CHECK:STDOUT: %Run: = fn_decl @Run [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -150,16 +150,16 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Empty.decl = class_decl @Empty, () -// CHECK:STDOUT: %Empty.ref: type = name_ref Empty, constants.%Empty [template = constants.%Empty] +// CHECK:STDOUT: %Empty.decl = class_decl @Empty, () [template = constants.%Empty] +// CHECK:STDOUT: %Empty.ref: type = name_ref Empty, file.%import_ref.1 [template = constants.%Empty] // CHECK:STDOUT: %a.var: ref Empty = var a // CHECK:STDOUT: %a: ref Empty = bind_name a, %a.var // CHECK:STDOUT: %.loc7_19.1: {} = struct_literal () // CHECK:STDOUT: %.loc7_19.2: init Empty = class_init (), %a.var [template = constants.%.4] // CHECK:STDOUT: %.loc7_19.3: init Empty = converted %.loc7_19.1, %.loc7_19.2 [template = constants.%.4] // CHECK:STDOUT: assign %a.var, %.loc7_19.3 -// CHECK:STDOUT: %Field.decl = class_decl @Field, () -// CHECK:STDOUT: %Field.ref: type = name_ref Field, constants.%Field [template = constants.%Field] +// CHECK:STDOUT: %Field.decl = class_decl @Field, () [template = constants.%Field] +// CHECK:STDOUT: %Field.ref: type = name_ref Field, file.%import_ref.2 [template = constants.%Field] // CHECK:STDOUT: %b.var: ref Field = var b // CHECK:STDOUT: %b: ref Field = bind_name b, %b.var // CHECK:STDOUT: %.loc9_24: i32 = int_literal 1 [template = constants.%.7] @@ -173,8 +173,8 @@ fn Run() { // CHECK:STDOUT: %.loc10_4: ref i32 = class_element_access %b.ref, element0 // CHECK:STDOUT: %.loc10_9: i32 = int_literal 2 [template = constants.%.10] // CHECK:STDOUT: assign %.loc10_4, %.loc10_9 -// CHECK:STDOUT: %ForwardDeclared.decl = class_decl @ForwardDeclared, () -// CHECK:STDOUT: %ForwardDeclared.ref.loc12: type = name_ref ForwardDeclared, constants.%ForwardDeclared [template = constants.%ForwardDeclared] +// CHECK:STDOUT: %ForwardDeclared.decl = class_decl @ForwardDeclared, () [template = constants.%ForwardDeclared] +// CHECK:STDOUT: %ForwardDeclared.ref.loc12: type = name_ref ForwardDeclared, file.%import_ref.3 [template = constants.%ForwardDeclared] // CHECK:STDOUT: %c.var: ref ForwardDeclared = var c // CHECK:STDOUT: %c: ref ForwardDeclared = bind_name c, %c.var // CHECK:STDOUT: %.loc12_29.1: {} = struct_literal () @@ -189,15 +189,15 @@ fn Run() { // CHECK:STDOUT: %.loc14_4: = bound_method %c.ref.loc14, @ForwardDeclared.%import_ref.1 // CHECK:STDOUT: %.loc14_3: ForwardDeclared* = addr_of %c.ref.loc14 // CHECK:STDOUT: %.loc14_6: init () = call %.loc14_4(%.loc14_3) -// CHECK:STDOUT: %ForwardDeclared.ref.loc16: type = name_ref ForwardDeclared, constants.%ForwardDeclared [template = constants.%ForwardDeclared] +// CHECK:STDOUT: %ForwardDeclared.ref.loc16: type = name_ref ForwardDeclared, file.%import_ref.3 [template = constants.%ForwardDeclared] // CHECK:STDOUT: %.loc16_25: type = ptr_type ForwardDeclared [template = constants.%.12] // CHECK:STDOUT: %d.var: ref ForwardDeclared* = var d // CHECK:STDOUT: %d: ref ForwardDeclared* = bind_name d, %d.var // CHECK:STDOUT: %c.ref.loc16: ref ForwardDeclared = name_ref c, %c // CHECK:STDOUT: %.loc16_29: ForwardDeclared* = addr_of %c.ref.loc16 // CHECK:STDOUT: assign %d.var, %.loc16_29 -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%import_ref.4 [template = constants.%Incomplete] // CHECK:STDOUT: %.loc18: type = ptr_type Incomplete [template = constants.%.13] // CHECK:STDOUT: %e.var: ref Incomplete* = var e // CHECK:STDOUT: %e: ref Incomplete* = bind_name e, %e.var diff --git a/toolchain/check/testdata/class/import_base.carbon b/toolchain/check/testdata/class/import_base.carbon index 16525f6fc3df..8bbb1e83caa1 100644 --- a/toolchain/check/testdata/class/import_base.carbon +++ b/toolchain/check/testdata/class/import_base.carbon @@ -46,8 +46,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Child = %Child.decl} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Child.decl = class_decl @Child, () +// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] +// CHECK:STDOUT: %Child.decl = class_decl @Child, () [template = constants.%Child] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { @@ -64,7 +64,7 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Child { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, constants.%Base [template = constants.%Base] +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc13: = base_decl Base, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -100,7 +100,7 @@ fn Run() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %import_ref.1, .Child = %import_ref.2, .Run = %Run} [template] // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+1, unused -// CHECK:STDOUT: %import_ref.2: invalid = import_ref ir1, inst+19, used [template = constants.%Child] +// CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+19, used [template = constants.%Child] // CHECK:STDOUT: %Run: = fn_decl @Run [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -127,9 +127,9 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Child.decl = class_decl @Child, () -// CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Child.ref: type = name_ref Child, constants.%Child [template = constants.%Child] +// CHECK:STDOUT: %Child.decl = class_decl @Child, () [template = constants.%Child] +// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] +// CHECK:STDOUT: %Child.ref: type = name_ref Child, file.%import_ref.2 [template = constants.%Child] // CHECK:STDOUT: %a.var: ref Child = var a // CHECK:STDOUT: %a: ref Child = bind_name a, %a.var // CHECK:STDOUT: %.loc7_33: i32 = int_literal 0 [template = constants.%.7] diff --git a/toolchain/check/testdata/class/import_member_cycle.carbon b/toolchain/check/testdata/class/import_member_cycle.carbon index d8e246fddf90..6345984e44ee 100644 --- a/toolchain/check/testdata/class/import_member_cycle.carbon +++ b/toolchain/check/testdata/class/import_member_cycle.carbon @@ -33,11 +33,11 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Cycle = %Cycle.decl} [template] -// CHECK:STDOUT: %Cycle.decl = class_decl @Cycle, () +// CHECK:STDOUT: %Cycle.decl = class_decl @Cycle, () [template = constants.%Cycle] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Cycle { -// CHECK:STDOUT: %Cycle.ref: type = name_ref Cycle, constants.%Cycle [template = constants.%Cycle] +// CHECK:STDOUT: %Cycle.ref: type = name_ref Cycle, file.%Cycle.decl [template = constants.%Cycle] // CHECK:STDOUT: %.loc5_15: type = ptr_type Cycle [template = constants.%.1] // CHECK:STDOUT: %.loc5_8: = field_decl a, element0 [template] // CHECK:STDOUT: @@ -55,7 +55,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Cycle = %import_ref, .Run = %Run} [template] -// CHECK:STDOUT: %import_ref: invalid = import_ref ir1, inst+1, used [template = constants.%Cycle] +// CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%Cycle] // CHECK:STDOUT: %Run: = fn_decl @Run [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -68,8 +68,8 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cycle.decl = class_decl @Cycle, () -// CHECK:STDOUT: %Cycle.ref: type = name_ref Cycle, constants.%Cycle [template = constants.%Cycle] +// CHECK:STDOUT: %Cycle.decl = class_decl @Cycle, () [template = constants.%Cycle] +// CHECK:STDOUT: %Cycle.ref: type = name_ref Cycle, file.%import_ref [template = constants.%Cycle] // CHECK:STDOUT: %.loc7: type = ptr_type Cycle [template = constants.%.1] // CHECK:STDOUT: %a.var: ref Cycle* = var a // CHECK:STDOUT: %a: ref Cycle* = bind_name a, %a.var diff --git a/toolchain/check/testdata/class/import_struct_cyle.carbon b/toolchain/check/testdata/class/import_struct_cyle.carbon index 8990c85c94a6..6186dce352a4 100644 --- a/toolchain/check/testdata/class/import_struct_cyle.carbon +++ b/toolchain/check/testdata/class/import_struct_cyle.carbon @@ -39,17 +39,17 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Cycle = %Cycle.decl.loc4, .a = %a} [template] -// CHECK:STDOUT: %Cycle.decl.loc4 = class_decl @Cycle, () -// CHECK:STDOUT: %Cycle.ref: type = name_ref Cycle, constants.%Cycle [template = constants.%Cycle] +// CHECK:STDOUT: %Cycle.decl.loc4 = class_decl @Cycle, () [template = constants.%Cycle] +// CHECK:STDOUT: %Cycle.ref: type = name_ref Cycle, %Cycle.decl.loc4 [template = constants.%Cycle] // CHECK:STDOUT: %.loc6_18: type = ptr_type Cycle [template = constants.%.1] // CHECK:STDOUT: %.loc6_19: type = struct_type {.b: Cycle*} [template = constants.%.2] // CHECK:STDOUT: %a.var: ref {.b: Cycle*} = var a // CHECK:STDOUT: %a: ref {.b: Cycle*} = bind_name a, %a.var -// CHECK:STDOUT: %Cycle.decl.loc8 = class_decl @Cycle, () +// CHECK:STDOUT: %Cycle.decl.loc8 = class_decl @Cycle, () [template = constants.%Cycle] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Cycle { -// CHECK:STDOUT: %Cycle.ref: type = name_ref Cycle, constants.%Cycle [template = constants.%Cycle] +// CHECK:STDOUT: %Cycle.ref: type = name_ref Cycle, file.%Cycle.decl.loc4 [template = constants.%Cycle] // CHECK:STDOUT: %.loc10_20: type = ptr_type Cycle [template = constants.%.1] // CHECK:STDOUT: %.loc10_21: type = struct_type {.b: Cycle*} [template = constants.%.2] // CHECK:STDOUT: %.loc10_8: = field_decl c, element0 [template] @@ -85,7 +85,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cycle.decl = class_decl @Cycle, () +// CHECK:STDOUT: %Cycle.decl = class_decl @Cycle, () [template = constants.%Cycle] // CHECK:STDOUT: %a.ref.loc7_3: ref {.b: Cycle*} = name_ref a, file.%import_ref.2 // CHECK:STDOUT: %.loc7_4: ref Cycle* = struct_access %a.ref.loc7_3, element0 // CHECK:STDOUT: %a.ref.loc7_11: ref {.b: Cycle*} = name_ref a, file.%import_ref.2 diff --git a/toolchain/check/testdata/class/init.carbon b/toolchain/check/testdata/class/init.carbon index 1cf1e841ee68..3e50e3cffc9f 100644 --- a/toolchain/check/testdata/class/init.carbon +++ b/toolchain/check/testdata/class/init.carbon @@ -31,14 +31,14 @@ fn MakeReorder(n: i32, next: Class*) -> Class { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .Make = %Make, .MakeReorder = %MakeReorder} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %Make: = fn_decl @Make [template] // CHECK:STDOUT: %MakeReorder: = fn_decl @MakeReorder [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %.loc8: = field_decl n, element0 [template] -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %.loc9_18: type = ptr_type Class [template = constants.%.2] // CHECK:STDOUT: %.loc9_11: = field_decl next, element1 [template] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/init_as.carbon b/toolchain/check/testdata/class/init_as.carbon index d368312221ce..11470bcf6fc7 100644 --- a/toolchain/check/testdata/class/init_as.carbon +++ b/toolchain/check/testdata/class/init_as.carbon @@ -27,7 +27,7 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .F = %F} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -45,7 +45,7 @@ fn F() -> i32 { // 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_26.1: {.a: i32, .b: i32} = struct_literal (%.loc13_17, %.loc13_25) -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// 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] diff --git a/toolchain/check/testdata/class/init_nested.carbon b/toolchain/check/testdata/class/init_nested.carbon index d1bd1c28a58b..5418e7edf783 100644 --- a/toolchain/check/testdata/class/init_nested.carbon +++ b/toolchain/check/testdata/class/init_nested.carbon @@ -37,9 +37,9 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Inner = %Inner.decl, .MakeInner = %MakeInner, .Outer = %Outer.decl, .MakeOuter = %MakeOuter} [template] -// CHECK:STDOUT: %Inner.decl = class_decl @Inner, () +// CHECK:STDOUT: %Inner.decl = class_decl @Inner, () [template = constants.%Inner] // CHECK:STDOUT: %MakeInner: = fn_decl @MakeInner [template] -// CHECK:STDOUT: %Outer.decl = class_decl @Outer, () +// CHECK:STDOUT: %Outer.decl = class_decl @Outer, () [template = constants.%Outer] // CHECK:STDOUT: %MakeOuter: = fn_decl @MakeOuter [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -53,9 +53,9 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Outer { -// CHECK:STDOUT: %Inner.ref.loc15: type = name_ref Inner, constants.%Inner [template = constants.%Inner] +// CHECK:STDOUT: %Inner.ref.loc15: type = name_ref Inner, file.%Inner.decl [template = constants.%Inner] // CHECK:STDOUT: %.loc15: = field_decl c, element0 [template] -// CHECK:STDOUT: %Inner.ref.loc16: type = name_ref Inner, constants.%Inner [template = constants.%Inner] +// CHECK:STDOUT: %Inner.ref.loc16: type = name_ref Inner, file.%Inner.decl [template = constants.%Inner] // CHECK:STDOUT: %.loc16: = field_decl d, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/method.carbon b/toolchain/check/testdata/class/method.carbon index 20f9e442290e..9aa14ae9fcb9 100644 --- a/toolchain/check/testdata/class/method.carbon +++ b/toolchain/check/testdata/class/method.carbon @@ -68,7 +68,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .Call = %Call, .CallAlias = %CallAlias, .CallOnConstBoundMethod = %CallOnConstBoundMethod, .CallWithAddr = %CallWithAddr, .CallFThroughPointer = %CallFThroughPointer, .CallGThroughPointer = %CallGThroughPointer, .Make = %Make, .CallFOnInitializingExpr = %CallFOnInitializingExpr, .CallGOnInitializingExpr = %CallGOnInitializingExpr} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %Call: = fn_decl @Call [template] // CHECK:STDOUT: %CallAlias: = fn_decl @CallAlias [template] @@ -129,7 +129,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc31_17: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc31_18.1: {.k: i32} = struct_literal (%.loc31_17) -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// 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] @@ -146,7 +146,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallWithAddr() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: 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: %c.ref: ref Class = name_ref c, %c diff --git a/toolchain/check/testdata/class/nested.carbon b/toolchain/check/testdata/class/nested.carbon index 52716650aa5f..754e35a582b9 100644 --- a/toolchain/check/testdata/class/nested.carbon +++ b/toolchain/check/testdata/class/nested.carbon @@ -47,19 +47,19 @@ fn F(a: Outer*) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Outer = %Outer.decl, .F = %F} [template] -// CHECK:STDOUT: %Outer.decl = class_decl @Outer, () +// CHECK:STDOUT: %Outer.decl = class_decl @Outer, () [template = constants.%Outer] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Outer { -// CHECK:STDOUT: %Inner.decl = class_decl @Inner, () +// CHECK:STDOUT: %Inner.decl = class_decl @Inner, () [template = constants.%Inner] // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Outer [template = constants.%Outer] // CHECK:STDOUT: %.loc14_15: type = ptr_type Outer [template = constants.%.3] // CHECK:STDOUT: %.loc14_9: = field_decl po, element0 [template] -// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, constants.%Outer [template = constants.%Outer] +// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer.decl [template = constants.%Outer] // CHECK:STDOUT: %.loc15_16: type = ptr_type Outer [template = constants.%.3] // CHECK:STDOUT: %.loc15_9: = field_decl qo, element1 [template] -// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, constants.%Inner [template = constants.%Inner] +// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, %Inner.decl [template = constants.%Inner] // CHECK:STDOUT: %.loc16_16: type = ptr_type Inner [template = constants.%.1] // CHECK:STDOUT: %.loc16_9: = field_decl pi, element2 [template] // CHECK:STDOUT: @@ -74,10 +74,10 @@ fn F(a: Outer*) { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Inner [template = constants.%Inner] // CHECK:STDOUT: %.loc9_17: type = ptr_type Inner [template = constants.%.1] // CHECK:STDOUT: %.loc9_11: = field_decl pi, element0 [template] -// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, constants.%Outer [template = constants.%Outer] +// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer.decl [template = constants.%Outer] // CHECK:STDOUT: %.loc10_18: type = ptr_type Outer [template = constants.%.3] // CHECK:STDOUT: %.loc10_11: = field_decl po, element1 [template] -// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, constants.%Inner [template = constants.%Inner] +// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [template = constants.%Inner] // CHECK:STDOUT: %.loc11_18: type = ptr_type Inner [template = constants.%.1] // CHECK:STDOUT: %.loc11_11: = field_decl qi, element2 [template] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/nested_name.carbon b/toolchain/check/testdata/class/nested_name.carbon index 817e64e2a46b..dd428f4d4923 100644 --- a/toolchain/check/testdata/class/nested_name.carbon +++ b/toolchain/check/testdata/class/nested_name.carbon @@ -33,13 +33,13 @@ fn G(o: Outer) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Outer = %Outer.decl, .F = %F, .G = %G} [template] -// CHECK:STDOUT: %Outer.decl = class_decl @Outer, () +// CHECK:STDOUT: %Outer.decl = class_decl @Outer, () [template = constants.%Outer] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Outer { -// CHECK:STDOUT: %Inner.decl = class_decl @Inner, () +// CHECK:STDOUT: %Inner.decl = class_decl @Inner, () [template = constants.%Inner] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Inner = %Inner.decl @@ -63,7 +63,7 @@ fn G(o: Outer) { // CHECK:STDOUT: fn @G(%o: Outer) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %o.ref: Outer = name_ref o, %o -// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, constants.%Inner [template = constants.%Inner] +// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [template = constants.%Inner] // CHECK:STDOUT: %i.var: ref Inner = var i // CHECK:STDOUT: %i: ref Inner = bind_name i, %i.var // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/class/raw_self.carbon b/toolchain/check/testdata/class/raw_self.carbon index 1434bb824339..0a694ffd9fc4 100644 --- a/toolchain/check/testdata/class/raw_self.carbon +++ b/toolchain/check/testdata/class/raw_self.carbon @@ -33,7 +33,7 @@ fn Class.G[self: Class](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/raw_self_type.carbon b/toolchain/check/testdata/class/raw_self_type.carbon index 863353445310..0fd3227534f9 100644 --- a/toolchain/check/testdata/class/raw_self_type.carbon +++ b/toolchain/check/testdata/class/raw_self_type.carbon @@ -21,7 +21,7 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { diff --git a/toolchain/check/testdata/class/redeclaration.carbon b/toolchain/check/testdata/class/redeclaration.carbon index 002a0b7fd894..6c78305f6414 100644 --- a/toolchain/check/testdata/class/redeclaration.carbon +++ b/toolchain/check/testdata/class/redeclaration.carbon @@ -21,8 +21,8 @@ fn Class.F() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl.loc7} [template] -// CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class, () -// CHECK:STDOUT: %Class.decl.loc9 = class_decl @Class, () +// CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class, () [template = constants.%Class] +// CHECK:STDOUT: %Class.decl.loc9 = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/redeclaration_introducer.carbon b/toolchain/check/testdata/class/redeclaration_introducer.carbon index 5103c8af2e6e..5a8d75035db4 100644 --- a/toolchain/check/testdata/class/redeclaration_introducer.carbon +++ b/toolchain/check/testdata/class/redeclaration_introducer.carbon @@ -23,12 +23,12 @@ abstract class C {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl.loc7, .B = %B.decl.loc8, .C = %C.decl.loc9} [template] -// CHECK:STDOUT: %A.decl.loc7 = class_decl @A, () -// CHECK:STDOUT: %B.decl.loc8 = class_decl @B, () -// CHECK:STDOUT: %C.decl.loc9 = class_decl @C, () -// CHECK:STDOUT: %A.decl.loc11 = class_decl @A, () -// CHECK:STDOUT: %B.decl.loc12 = class_decl @B, () -// CHECK:STDOUT: %C.decl.loc13 = class_decl @C, () +// CHECK:STDOUT: %A.decl.loc7 = class_decl @A, () [template = constants.%A] +// CHECK:STDOUT: %B.decl.loc8 = class_decl @B, () [template = constants.%B] +// CHECK:STDOUT: %C.decl.loc9 = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %A.decl.loc11 = class_decl @A, () [template = constants.%A] +// CHECK:STDOUT: %B.decl.loc12 = class_decl @B, () [template = constants.%B] +// CHECK:STDOUT: %C.decl.loc13 = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { diff --git a/toolchain/check/testdata/class/reenter_scope.carbon b/toolchain/check/testdata/class/reenter_scope.carbon index 73c034da3a89..d38e108b18cc 100644 --- a/toolchain/check/testdata/class/reenter_scope.carbon +++ b/toolchain/check/testdata/class/reenter_scope.carbon @@ -22,7 +22,7 @@ fn Class.F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/scope.carbon b/toolchain/check/testdata/class/scope.carbon index a88b1880a260..be0327a79155 100644 --- a/toolchain/check/testdata/class/scope.carbon +++ b/toolchain/check/testdata/class/scope.carbon @@ -34,7 +34,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .F = %F, .Run = %Run} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F.2 [template] // CHECK:STDOUT: %Run: = fn_decl @Run [template] // CHECK:STDOUT: } @@ -78,7 +78,7 @@ fn Run() { // CHECK:STDOUT: assign %a.var, %.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, constants.%Class [template = constants.%Class] +// 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: %.loc23: init i32 = call %F.ref.loc23() // CHECK:STDOUT: assign %b.var, %.loc23 diff --git a/toolchain/check/testdata/class/self.carbon b/toolchain/check/testdata/class/self.carbon index 99d453f33210..d49aed2b34ad 100644 --- a/toolchain/check/testdata/class/self.carbon +++ b/toolchain/check/testdata/class/self.carbon @@ -31,7 +31,7 @@ fn Class.G[addr self: Class*]() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/self_conversion.carbon b/toolchain/check/testdata/class/self_conversion.carbon index b62ab3918962..96afaa8add9f 100644 --- a/toolchain/check/testdata/class/self_conversion.carbon +++ b/toolchain/check/testdata/class/self_conversion.carbon @@ -48,8 +48,8 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Base = %Base.decl, .Derived = %Derived.decl, .Call = %Call} [template] -// CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () +// CHECK:STDOUT: %Base.decl = class_decl @Base, () [template = constants.%Base] +// CHECK:STDOUT: %Derived.decl = class_decl @Derived, () [template = constants.%Derived] // CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase [template] // CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase [template] // CHECK:STDOUT: %Call: = fn_decl @Call [template] @@ -63,7 +63,7 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, constants.%Base [template = constants.%Base] +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc12: = base_decl Base, element0 [template] // CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase [template] // CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase [template] diff --git a/toolchain/check/testdata/class/self_type.carbon b/toolchain/check/testdata/class/self_type.carbon index 1afe06c5d498..e29f17a7a66a 100644 --- a/toolchain/check/testdata/class/self_type.carbon +++ b/toolchain/check/testdata/class/self_type.carbon @@ -28,7 +28,7 @@ fn Class.F[self: Class]() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/static_method.carbon b/toolchain/check/testdata/class/static_method.carbon index 42cf817ae50e..fbe86a9a9c57 100644 --- a/toolchain/check/testdata/class/static_method.carbon +++ b/toolchain/check/testdata/class/static_method.carbon @@ -24,7 +24,7 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Class = %Class.decl, .Run = %Run} [template] -// CHECK:STDOUT: %Class.decl = class_decl @Class, () +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] // CHECK:STDOUT: %Run: = fn_decl @Run [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -39,7 +39,7 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: 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: %c.ref: ref Class = name_ref c, %c diff --git a/toolchain/check/testdata/global/class_obj.carbon b/toolchain/check/testdata/global/class_obj.carbon index a3c359a3d084..6ff504ac4c39 100644 --- a/toolchain/check/testdata/global/class_obj.carbon +++ b/toolchain/check/testdata/global/class_obj.carbon @@ -19,8 +19,8 @@ var a: A = {}; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl, .a = %a} [template] -// CHECK:STDOUT: %A.decl = class_decl @A, () -// CHECK:STDOUT: %A.ref: type = name_ref A, constants.%A [template = constants.%A] +// CHECK:STDOUT: %A.decl = class_decl @A, () [template = constants.%A] +// CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %a.var: ref A = var a // CHECK:STDOUT: %a: ref A = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/global/class_with_fun.carbon b/toolchain/check/testdata/global/class_with_fun.carbon index 0c2107e3683e..6dd0fea9a56b 100644 --- a/toolchain/check/testdata/global/class_with_fun.carbon +++ b/toolchain/check/testdata/global/class_with_fun.carbon @@ -23,9 +23,9 @@ var a: A = {}; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.A = %A.decl, .ret_a = %ret_a, .a = %a} [template] -// CHECK:STDOUT: %A.decl = class_decl @A, () +// CHECK:STDOUT: %A.decl = class_decl @A, () [template = constants.%A] // CHECK:STDOUT: %ret_a: = fn_decl @ret_a [template] -// CHECK:STDOUT: %A.ref: type = name_ref A, constants.%A [template = constants.%A] +// CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %a.var: ref A = var a // CHECK:STDOUT: %a: ref A = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon index 9ee9ceb1a84f..b1e0c28be703 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -45,7 +45,7 @@ class C { // CHECK:STDOUT: file { // CHECK:STDOUT: %.loc17: i32 = block_arg // CHECK:STDOUT: %x: i32 = bind_name x, %.loc17 -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { diff --git a/toolchain/check/testdata/impl/basic.carbon b/toolchain/check/testdata/impl/basic.carbon index 875552fcfc7b..3778fa4b9a7e 100644 --- a/toolchain/check/testdata/impl/basic.carbon +++ b/toolchain/check/testdata/impl/basic.carbon @@ -20,7 +20,7 @@ impl i32 as Simple { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Simple = %Simple.decl} [template] -// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, () +// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, () [template = constants.%.1] // CHECK:STDOUT: impl_decl @impl, () // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/declaration.carbon b/toolchain/check/testdata/impl/declaration.carbon index 1f29f04b8cc1..b5874fb0f0a9 100644 --- a/toolchain/check/testdata/impl/declaration.carbon +++ b/toolchain/check/testdata/impl/declaration.carbon @@ -16,7 +16,7 @@ impl i32 as I; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () +// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] // CHECK:STDOUT: impl_decl @impl, () // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/empty.carbon b/toolchain/check/testdata/impl/empty.carbon index 088f5d7be69f..8bc787c98cf5 100644 --- a/toolchain/check/testdata/impl/empty.carbon +++ b/toolchain/check/testdata/impl/empty.carbon @@ -18,7 +18,7 @@ impl i32 as Empty { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl} [template] -// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () +// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () [template = constants.%.1] // CHECK:STDOUT: impl_decl @impl, () // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/extend_impl.carbon b/toolchain/check/testdata/impl/extend_impl.carbon index 9f586c7bca82..06bbd0321dd3 100644 --- a/toolchain/check/testdata/impl/extend_impl.carbon +++ b/toolchain/check/testdata/impl/extend_impl.carbon @@ -24,8 +24,8 @@ fn G(c: C) { // CHECK:STDOUT: --- extend_impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = interface_type @HasF [template] +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: type = tuple_type () [template] // CHECK:STDOUT: %.4: type = ptr_type {} [template] @@ -33,8 +33,8 @@ fn G(c: C) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.HasF = %HasF.decl, .C = %C.decl, .G = %G} [template] -// CHECK:STDOUT: %HasF.decl = interface_decl @HasF, () -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %HasF.decl = interface_decl @HasF, () [template = constants.%.1] +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -68,7 +68,7 @@ fn G(c: C) { // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%c: C) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref: type = name_ref C, constants.%C [template = constants.%C] +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %F.ref.loc20: = name_ref F, @HasF.%F [template = @HasF.%F] // CHECK:STDOUT: %.loc20: init () = call %F.ref.loc20() // CHECK:STDOUT: %c.ref: C = name_ref c, %c diff --git a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon index 68d308c6e616..25efc3bfd7dd 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon @@ -26,15 +26,15 @@ class C { // CHECK:STDOUT: --- fail_extend_impl_forall.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = interface_type @GenericInterface [template] +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.GenericInterface = %GenericInterface.decl, .C = %C.decl} [template] -// CHECK:STDOUT: %GenericInterface.decl = interface_decl @GenericInterface, (, ) -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %GenericInterface.decl = interface_decl @GenericInterface, (, ) [template = constants.%.1] +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @GenericInterface { @@ -52,7 +52,7 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: impl_decl @impl, (, , , ) +// CHECK:STDOUT: impl_decl @impl, (, , , ) // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: has_error diff --git a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon index 889b0a5d97f4..7c569c519941 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon @@ -19,7 +19,7 @@ extend impl i32 as I {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () +// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] // CHECK:STDOUT: impl_decl @impl, () // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon index e9291da323f3..2516664a6642 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon @@ -36,8 +36,8 @@ class E { // CHECK:STDOUT: --- fail_extend_impl_type_as.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = interface_type @I [template] +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %E: type = class_type @E [template] @@ -45,10 +45,10 @@ class E { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl, .C = %C.decl, .D = %D.decl, .E = %E.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () -// CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %D.decl = class_decl @D, () -// CHECK:STDOUT: %E.decl = class_decl @E, () +// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] +// CHECK:STDOUT: %D.decl = class_decl @D, () [template = constants.%D] +// CHECK:STDOUT: %E.decl = class_decl @E, () [template = constants.%E] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon index 83c0293198b0..fb78e90d409a 100644 --- a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon @@ -20,7 +20,7 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.C = %C.decl} [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as i32; diff --git a/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon b/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon index aaef9b2aa710..64940b80c3fa 100644 --- a/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon @@ -19,18 +19,18 @@ interface I { // CHECK:STDOUT: --- fail_extend_partially_defined_interface.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = interface_type @I [template] +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () +// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .C = %C.decl diff --git a/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon b/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon index 3bb5b73d613d..37b1450c374e 100644 --- a/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon @@ -19,15 +19,15 @@ class C { // CHECK:STDOUT: --- fail_extend_undefined_interface.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = interface_type @I [template] +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl, .C = %C.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I; diff --git a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon index d7c36756fbb9..4469ce182c49 100644 --- a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon +++ b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon @@ -23,7 +23,7 @@ impl as Simple { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Simple = %Simple.decl} [template] -// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, () +// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, () [template = constants.%.1] // CHECK:STDOUT: impl_decl @impl, () // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_type.carbon b/toolchain/check/testdata/impl/fail_impl_bad_type.carbon index 766a835901a6..76b4792d951d 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_type.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_type.carbon @@ -14,14 +14,14 @@ impl true as I {} // CHECK:STDOUT: --- fail_impl_bad_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: type = interface_type @I [template] +// CHECK:STDOUT: %.1: type = interface_type @I [template] +// CHECK:STDOUT: %.2: bool = bool_literal true [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () -// CHECK:STDOUT: impl_decl @impl, (, ) +// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] +// CHECK:STDOUT: impl_decl @impl, (, ) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/fail_redefinition.carbon b/toolchain/check/testdata/impl/fail_redefinition.carbon index 78e2d75384c0..aba88d0a4ca9 100644 --- a/toolchain/check/testdata/impl/fail_redefinition.carbon +++ b/toolchain/check/testdata/impl/fail_redefinition.carbon @@ -24,7 +24,7 @@ impl i32 as I {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () +// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] // CHECK:STDOUT: impl_decl @impl, () // CHECK:STDOUT: impl_decl @impl, () // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/impl_as.carbon b/toolchain/check/testdata/impl/impl_as.carbon index 38da3ea3ec44..c479537b3aa8 100644 --- a/toolchain/check/testdata/impl/impl_as.carbon +++ b/toolchain/check/testdata/impl/impl_as.carbon @@ -17,15 +17,15 @@ class C { // CHECK:STDOUT: --- impl_as.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = interface_type @Simple [template] +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Simple = %Simple.decl, .C = %C.decl} [template] -// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, () -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, () [template = constants.%.1] +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { diff --git a/toolchain/check/testdata/impl/impl_forall.carbon b/toolchain/check/testdata/impl/impl_forall.carbon index 23e7baa8780a..15122ac05e96 100644 --- a/toolchain/check/testdata/impl/impl_forall.carbon +++ b/toolchain/check/testdata/impl/impl_forall.carbon @@ -20,8 +20,8 @@ impl forall [T:! type] T as Simple { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Simple = %Simple.decl} [template] -// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, () -// CHECK:STDOUT: impl_decl @impl, (, , , ) +// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, () [template = constants.%.1] +// CHECK:STDOUT: impl_decl @impl, (, , , ) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { diff --git a/toolchain/check/testdata/impl/redeclaration.carbon b/toolchain/check/testdata/impl/redeclaration.carbon index 386ac6810907..5b9016be7497 100644 --- a/toolchain/check/testdata/impl/redeclaration.carbon +++ b/toolchain/check/testdata/impl/redeclaration.carbon @@ -24,9 +24,9 @@ impl i32 as I {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl, .X = %X.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () +// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] // CHECK:STDOUT: impl_decl @impl, () -// CHECK:STDOUT: %X.decl = class_decl @X, () +// CHECK:STDOUT: %X.decl = class_decl @X, () [template = constants.%X] // CHECK:STDOUT: impl_decl @impl, () // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/as_type.carbon b/toolchain/check/testdata/interface/as_type.carbon index 1560f872b4c4..809821782a52 100644 --- a/toolchain/check/testdata/interface/as_type.carbon +++ b/toolchain/check/testdata/interface/as_type.carbon @@ -17,7 +17,7 @@ fn F(e: Empty) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl, .F = %F} [template] -// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () +// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () [template = constants.%.1] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/basic.carbon b/toolchain/check/testdata/interface/basic.carbon index b3f551d3feb9..1cc4986d4cf9 100644 --- a/toolchain/check/testdata/interface/basic.carbon +++ b/toolchain/check/testdata/interface/basic.carbon @@ -15,11 +15,16 @@ interface ForwardDeclared { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = interface_type @Empty [template] +// CHECK:STDOUT: %.2: type = interface_type @ForwardDeclared [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl, .ForwardDeclared = %ForwardDeclared.decl.loc10} [template] -// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () -// CHECK:STDOUT: %ForwardDeclared.decl.loc10 = interface_decl @ForwardDeclared, () -// CHECK:STDOUT: %ForwardDeclared.decl.loc12 = interface_decl @ForwardDeclared, () +// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () [template = constants.%.1] +// CHECK:STDOUT: %ForwardDeclared.decl.loc10 = interface_decl @ForwardDeclared, () [template = constants.%.2] +// CHECK:STDOUT: %ForwardDeclared.decl.loc12 = interface_decl @ForwardDeclared, () [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Empty { diff --git a/toolchain/check/testdata/interface/fail_as_type_of_type.carbon b/toolchain/check/testdata/interface/fail_as_type_of_type.carbon index b97278eb2b29..0a90b75b77cf 100644 --- a/toolchain/check/testdata/interface/fail_as_type_of_type.carbon +++ b/toolchain/check/testdata/interface/fail_as_type_of_type.carbon @@ -23,7 +23,7 @@ fn F(T:! Empty) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl, .F = %F} [template] -// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () +// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () [template = constants.%.1] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_duplicate.carbon b/toolchain/check/testdata/interface/fail_duplicate.carbon index bb182b76e2e4..397c3fdfcda2 100644 --- a/toolchain/check/testdata/interface/fail_duplicate.carbon +++ b/toolchain/check/testdata/interface/fail_duplicate.carbon @@ -39,17 +39,20 @@ interface Class { } // CHECK:STDOUT: --- fail_duplicate.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = interface_type @Interface [template] +// CHECK:STDOUT: %.2: type = interface_type @.1 [template] // CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.3: type = interface_type @.2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Interface = %Interface.decl.loc7, .Function = %Function, .Class = %Class.decl} [template] -// CHECK:STDOUT: %Interface.decl.loc7 = interface_decl @Interface, () -// CHECK:STDOUT: %Interface.decl.loc15 = interface_decl @Interface, () +// CHECK:STDOUT: %Interface.decl.loc7 = interface_decl @Interface, () [template = constants.%.1] +// CHECK:STDOUT: %Interface.decl.loc15 = interface_decl @Interface, () [template = constants.%.1] // CHECK:STDOUT: %Function: = fn_decl @Function [template] -// CHECK:STDOUT: %.decl.loc27 = interface_decl @.1, () -// CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %.decl.loc37 = interface_decl @.2, () +// CHECK:STDOUT: %.decl.loc27 = interface_decl @.1, () [template = constants.%.2] +// CHECK:STDOUT: %Class.decl = class_decl @Class, () [template = constants.%Class] +// CHECK:STDOUT: %.decl.loc37 = interface_decl @.2, () [template = constants.%.3] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { diff --git a/toolchain/check/testdata/interface/fail_modifiers.carbon b/toolchain/check/testdata/interface/fail_modifiers.carbon index 2a33b867a2b8..4d4c96fbc6b1 100644 --- a/toolchain/check/testdata/interface/fail_modifiers.carbon +++ b/toolchain/check/testdata/interface/fail_modifiers.carbon @@ -28,12 +28,19 @@ protected interface Protected; // CHECK:STDOUT: --- fail_modifiers.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = interface_type @Abstract [template] +// CHECK:STDOUT: %.2: type = interface_type @Default [template] +// CHECK:STDOUT: %.3: type = interface_type @Virtual [template] +// CHECK:STDOUT: %.4: type = interface_type @Protected [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Abstract = %Abstract.decl, .Default = %Default.decl, .Virtual = %Virtual.decl, .Protected = %Protected.decl} [template] -// CHECK:STDOUT: %Abstract.decl = interface_decl @Abstract, () -// CHECK:STDOUT: %Default.decl = interface_decl @Default, () -// CHECK:STDOUT: %Virtual.decl = interface_decl @Virtual, () -// CHECK:STDOUT: %Protected.decl = interface_decl @Protected, () +// CHECK:STDOUT: %Abstract.decl = interface_decl @Abstract, () [template = constants.%.1] +// CHECK:STDOUT: %Default.decl = interface_decl @Default, () [template = constants.%.2] +// CHECK:STDOUT: %Virtual.decl = interface_decl @Virtual, () [template = constants.%.3] +// CHECK:STDOUT: %Protected.decl = interface_decl @Protected, () [template = constants.%.4] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Abstract { diff --git a/toolchain/check/testdata/interface/fail_todo_generic.carbon b/toolchain/check/testdata/interface/fail_todo_generic.carbon index fe4d04804b28..21369d23376a 100644 --- a/toolchain/check/testdata/interface/fail_todo_generic.carbon +++ b/toolchain/check/testdata/interface/fail_todo_generic.carbon @@ -14,9 +14,13 @@ interface I[](); // CHECK:STDOUT: --- fail_todo_generic.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = interface_type @I [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.I = %I.decl} [template] -// CHECK:STDOUT: %I.decl = interface_decl @I, () +// CHECK:STDOUT: %I.decl = interface_decl @I, () [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I; diff --git a/toolchain/check/testdata/interface/fail_todo_modifiers.carbon b/toolchain/check/testdata/interface/fail_todo_modifiers.carbon index 3437076bd9e9..b297c3a8b7b3 100644 --- a/toolchain/check/testdata/interface/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/interface/fail_todo_modifiers.carbon @@ -23,10 +23,15 @@ private interface Private { // CHECK:STDOUT: --- fail_todo_modifiers.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = interface_type @Modifiers [template] +// CHECK:STDOUT: %.2: type = interface_type @Private [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Modifiers = %Modifiers.decl, .Private = %Private.decl} [template] -// CHECK:STDOUT: %Modifiers.decl = interface_decl @Modifiers, () -// CHECK:STDOUT: %Private.decl = interface_decl @Private, () +// CHECK:STDOUT: %Modifiers.decl = interface_decl @Modifiers, () [template = constants.%.1] +// CHECK:STDOUT: %Private.decl = interface_decl @Private, () [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Modifiers { diff --git a/toolchain/check/testdata/interface/import.carbon b/toolchain/check/testdata/interface/import.carbon index 274d1c2474ff..b6c7f2926732 100644 --- a/toolchain/check/testdata/interface/import.carbon +++ b/toolchain/check/testdata/interface/import.carbon @@ -27,11 +27,16 @@ import library "a"; // CHECK:STDOUT: --- a.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = interface_type @Empty [template] +// CHECK:STDOUT: %.2: type = interface_type @ForwardDeclared [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %Empty.decl, .ForwardDeclared = %ForwardDeclared.decl.loc7} [template] -// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () -// CHECK:STDOUT: %ForwardDeclared.decl.loc7 = interface_decl @ForwardDeclared, () -// CHECK:STDOUT: %ForwardDeclared.decl.loc9 = interface_decl @ForwardDeclared, () +// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () [template = constants.%.1] +// CHECK:STDOUT: %ForwardDeclared.decl.loc7 = interface_decl @ForwardDeclared, () [template = constants.%.2] +// CHECK:STDOUT: %ForwardDeclared.decl.loc9 = interface_decl @ForwardDeclared, () [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Empty { @@ -53,6 +58,6 @@ import library "a"; // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Empty = %import_ref.1, .ForwardDeclared = %import_ref.2} [template] // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+1, unused -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+2, unused +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+3, unused // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/package_expr/syntax.carbon b/toolchain/check/testdata/package_expr/syntax.carbon index a5108c4548a5..f2e503c6ecaf 100644 --- a/toolchain/check/testdata/package_expr/syntax.carbon +++ b/toolchain/check/testdata/package_expr/syntax.carbon @@ -125,7 +125,7 @@ fn Main() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.NS = %.loc4, .Main = %Main} [template] // CHECK:STDOUT: %.loc4: = namespace {.C = %C.decl} [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: %Main: = fn_decl @Main [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -145,7 +145,7 @@ fn Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %package.ref: = name_ref package, package [template = package] // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%.loc4 [template = file.%.loc4] -// CHECK:STDOUT: %C.ref: type = name_ref C, constants.%C [template = constants.%C] +// 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: %.loc11: init () = call %Foo.ref() // CHECK:STDOUT: return 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 bdaa2a3bdf7b..b5078398f88a 100644 --- a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon @@ -43,7 +43,7 @@ fn G() -> C { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.F = %F, .C = %C.decl, .G = %G} [template] // CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -68,7 +68,7 @@ fn G() -> C { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> %return: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref: type = name_ref C, constants.%C [template = constants.%C] +// 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: %.loc20_29: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc20_37: i32 = int_literal 2 [template = constants.%.6] diff --git a/toolchain/check/testdata/return/returned_var.carbon b/toolchain/check/testdata/return/returned_var.carbon index c6c5855c372e..c84e07d4dc44 100644 --- a/toolchain/check/testdata/return/returned_var.carbon +++ b/toolchain/check/testdata/return/returned_var.carbon @@ -34,7 +34,7 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.C = %C.decl, .F = %F, .G = %G} [template] -// CHECK:STDOUT: %C.decl = class_decl @C, () +// CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } @@ -50,7 +50,7 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref: type = name_ref C, constants.%C [template = constants.%C] +// 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] diff --git a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon index a231b2e7a2b2..8c98c4835d5a 100644 --- a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon @@ -26,12 +26,12 @@ var p: Incomplete* = &s.a; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Incomplete = %Incomplete.decl, .s = %s, .p = %p} [template] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] // CHECK:STDOUT: %.loc15: type = struct_type {.a: Incomplete} [template = constants.%.1] // CHECK:STDOUT: %s.var: ref = var s // CHECK:STDOUT: %s: ref = bind_name s, %s.var -// CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] // CHECK:STDOUT: %.loc17: type = ptr_type Incomplete [template = constants.%.2] // CHECK:STDOUT: %p.var: ref Incomplete* = var p // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var diff --git a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon index 6c38eab8b0c5..46413efc2015 100644 --- a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon @@ -28,13 +28,13 @@ var p: Incomplete* = &t[1]; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.Incomplete = %Incomplete.decl, .t = %t, .p = %p} [template] -// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] // CHECK:STDOUT: %.loc15_24.1: (type, type) = tuple_literal (i32, %Incomplete.ref.loc15) // CHECK:STDOUT: %.loc15_24.2: type = converted %.loc15_24.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %t.var: ref = var t // CHECK:STDOUT: %t: ref = bind_name t, %t.var -// CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, constants.%Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] // CHECK:STDOUT: %.loc17: type = ptr_type Incomplete [template = constants.%.3] // CHECK:STDOUT: %p.var: ref Incomplete* = var p // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var diff --git a/toolchain/check/testdata/var/fail_not_copyable.carbon b/toolchain/check/testdata/var/fail_not_copyable.carbon index 262d812e48e4..870629578207 100644 --- a/toolchain/check/testdata/var/fail_not_copyable.carbon +++ b/toolchain/check/testdata/var/fail_not_copyable.carbon @@ -35,7 +35,7 @@ fn F(x: X) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace {.X = %X.decl, .F = %F} [template] -// CHECK:STDOUT: %X.decl = class_decl @X, () +// CHECK:STDOUT: %X.decl = class_decl @X, () [template = constants.%X] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -50,7 +50,7 @@ fn F(x: X) { // CHECK:STDOUT: %s: ref String = bind_name s, %s.var // CHECK:STDOUT: %.loc16: String = string_literal "hello" [template = constants.%.5] // CHECK:STDOUT: assign %s.var, -// CHECK:STDOUT: %X.ref: type = name_ref X, constants.%X [template = constants.%X] +// CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %y.var: ref X = var y // CHECK:STDOUT: %y: ref X = bind_name y, %y.var // CHECK:STDOUT: %x.ref: X = name_ref x, %x diff --git a/toolchain/sem_ir/file.cpp b/toolchain/sem_ir/file.cpp index 026ea53c9094..d7b5fa7c11cc 100644 --- a/toolchain/sem_ir/file.cpp +++ b/toolchain/sem_ir/file.cpp @@ -517,13 +517,11 @@ auto GetExprCategory(const File& file, InstId inst_id) -> ExprCategory { case Branch::Kind: case BranchIf::Kind: case BranchWithArg::Kind: - case ClassDecl::Kind: case FieldDecl::Kind: case FunctionDecl::Kind: case ImplDecl::Kind: case Import::Kind: case ImportRefUnused::Kind: - case InterfaceDecl::Kind: case Namespace::Kind: case Return::Kind: case ReturnExpr::Kind: @@ -559,8 +557,10 @@ auto GetExprCategory(const File& file, InstId inst_id) -> ExprCategory { case BlockArg::Kind: case BoolLiteral::Kind: case BoundMethod::Kind: + case ClassDecl::Kind: case ClassType::Kind: case ConstType::Kind: + case InterfaceDecl::Kind: case InterfaceType::Kind: case IntLiteral::Kind: case Param::Kind: diff --git a/toolchain/sem_ir/typed_insts.h b/toolchain/sem_ir/typed_insts.h index cba36bd84574..93a46fd375b4 100644 --- a/toolchain/sem_ir/typed_insts.h +++ b/toolchain/sem_ir/typed_insts.h @@ -315,8 +315,7 @@ struct ClassDecl { static constexpr auto Kind = InstKind::ClassDecl.Define("class_decl"); - // No type: a class declaration is not itself a value. The name of a class - // declaration becomes a class type value. + TypeId type_id; // TODO: For a generic class declaration, the name of the class declaration // should become a parameterized entity name value. ClassId class_id; @@ -474,8 +473,7 @@ struct InterfaceDecl { InstKind::InterfaceDecl.Define( "interface_decl"); - // No type: an interface declaration is not itself a value. The name of an - // interface declaration becomes a facet type value. + TypeId type_id; // TODO: For a generic interface declaration, the name of the interface // declaration should become a parameterized entity name value. InterfaceId interface_id;