diff --git a/toolchain/check/BUILD b/toolchain/check/BUILD index b52147e368b0..229b450123cb 100644 --- a/toolchain/check/BUILD +++ b/toolchain/check/BUILD @@ -65,7 +65,6 @@ cc_library( "//toolchain/sem_ir:ids", "//toolchain/sem_ir:inst", "//toolchain/sem_ir:inst_kind", - "//toolchain/sem_ir:value_stores", "@llvm-project//llvm:Support", ], ) @@ -96,7 +95,6 @@ cc_library( "//toolchain/sem_ir:ids", "//toolchain/sem_ir:inst", "//toolchain/sem_ir:inst_kind", - "//toolchain/sem_ir:value_stores", "@llvm-project//llvm:Support", ], ) @@ -124,7 +122,6 @@ cc_library( "//toolchain/sem_ir:ids", "//toolchain/sem_ir:inst", "//toolchain/sem_ir:inst_kind", - "//toolchain/sem_ir:value_stores", ], ) diff --git a/toolchain/check/context.cpp b/toolchain/check/context.cpp index 8553f0d90e22..a03880ca338f 100644 --- a/toolchain/check/context.cpp +++ b/toolchain/check/context.cpp @@ -100,14 +100,13 @@ auto Context::AddPlaceholderInst(SemIR::ParseNodeAndInst parse_node_and_inst) auto Context::AddConstant(SemIR::Inst inst, bool is_symbolic) -> SemIR::ConstantId { - // TODO: Deduplicate constants. - auto inst_id = sem_ir().insts().AddInNoBlock( - SemIR::ParseNodeAndInst::Untyped(Parse::NodeId::Invalid, inst)); - constants().Add(inst_id); - + auto [inst_id, added] = constants().GetOrAdd(inst); auto const_id = is_symbolic ? SemIR::ConstantId::ForSymbolicConstant(inst_id) : SemIR::ConstantId::ForTemplateConstant(inst_id); - constant_values().Set(inst_id, const_id); + if (added) { + // TODO: Should `ConstantStore` do this for us? + constant_values().Set(inst_id, const_id); + } CARBON_VLOG() << "AddConstantInst: " << inst << "\n"; return const_id; diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp index 888fd1508358..4c613c105a15 100644 --- a/toolchain/check/eval.cpp +++ b/toolchain/check/eval.cpp @@ -100,6 +100,9 @@ auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst) return RebuildIfFieldsAreConstant(context, inst, &SemIR::BoundMethod::object_id, &SemIR::BoundMethod::function_id); + case SemIR::StructType::Kind: + return RebuildIfFieldsAreConstant(context, inst, + &SemIR::StructType::fields_id); case SemIR::StructValue::Kind: return RebuildIfFieldsAreConstant(context, inst, &SemIR::StructValue::elements_id); @@ -110,23 +113,25 @@ auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst) return RebuildIfFieldsAreConstant(context, inst, &SemIR::TupleValue::elements_id); - // These cases are constants already. + // These cases are always constants. case SemIR::Builtin::Kind: case SemIR::ClassType::Kind: case SemIR::ConstType::Kind: case SemIR::PointerType::Kind: - case SemIR::StructType::Kind: case SemIR::StructTypeField::Kind: case SemIR::TupleType::Kind: case SemIR::UnboundElementType::Kind: // TODO: Propagate symbolic / template nature from operands. - return SemIR::ConstantId::ForTemplateConstant(inst_id); + return context.AddConstant(inst, /*is_symbolic=*/false); + // These cases are treated as being the unique canonical definition of the + // corresponding constant value. + // TODO: This doesn't properly handle redeclarations. Consider adding a + // corresponding `Value` inst for each of these cases. case SemIR::BaseDecl::Kind: case SemIR::FieldDecl::Kind: case SemIR::FunctionDecl::Kind: case SemIR::Namespace::Kind: - // TODO: Consider adding a corresponding `Value` inst. return SemIR::ConstantId::ForTemplateConstant(inst_id); case SemIR::BoolLiteral::Kind: @@ -134,6 +139,9 @@ auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst) case SemIR::RealLiteral::Kind: case SemIR::StringLiteral::Kind: // Promote literals to the constant block. + // TODO: Convert literals into a canonical form. Currently we can form two + // different `i32` constants with the same value if they are represented + // by `APInt`s with different bit widths. return context.AddConstant(inst, /*is_symbolic=*/false); // TODO: These need special handling. diff --git a/toolchain/check/handle_class.cpp b/toolchain/check/handle_class.cpp index 40e073490367..30c385a3d48f 100644 --- a/toolchain/check/handle_class.cpp +++ b/toolchain/check/handle_class.cpp @@ -5,6 +5,7 @@ #include "toolchain/check/context.h" #include "toolchain/check/convert.h" #include "toolchain/check/modifiers.h" +#include "toolchain/sem_ir/typed_insts.h" namespace Carbon::Check { diff --git a/toolchain/check/testdata/array/assign_var.carbon b/toolchain/check/testdata/array/assign_var.carbon index 95f061ecc2f3..01bb487b80da 100644 --- a/toolchain/check/testdata/array/assign_var.carbon +++ b/toolchain/check/testdata/array/assign_var.carbon @@ -16,12 +16,11 @@ var b: [i32; 3] = a; // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] // CHECK:STDOUT: %.6: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.8: type = array_type %.7, i32 [template] -// CHECK:STDOUT: %.9: type = ptr_type [i32; 3] [template] -// CHECK:STDOUT: %.10: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.11: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.12: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.7: type = array_type %.6, i32 [template] +// CHECK:STDOUT: %.8: type = ptr_type [i32; 3] [template] +// CHECK:STDOUT: %.9: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.10: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.11: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -43,24 +42,24 @@ var b: [i32; 3] = a; // CHECK:STDOUT: %.loc7_34.8: init (i32, i32, i32) = tuple_init (%.loc7_34.3, %.loc7_34.5, %.loc7_34.7) to %a.var // CHECK:STDOUT: %.loc7_34.9: init (i32, i32, i32) = converted %.loc7_34.1, %.loc7_34.8 // CHECK:STDOUT: assign %a.var, %.loc7_34.9 -// CHECK:STDOUT: %.loc8_14: i32 = int_literal 3 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, i32 [template = constants.%.8] +// CHECK:STDOUT: %.loc8_14: i32 = int_literal 3 [template = constants.%.6] +// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, i32 [template = constants.%.7] // CHECK:STDOUT: %b.var: ref [i32; 3] = var b // CHECK:STDOUT: %b: ref [i32; 3] = bind_name b, %b.var // CHECK:STDOUT: %a.ref: ref (i32, i32, i32) = name_ref a, %a // CHECK:STDOUT: %.loc8_19.1: ref i32 = tuple_access %a.ref, element0 // CHECK:STDOUT: %.loc8_19.2: i32 = bind_value %.loc8_19.1 -// CHECK:STDOUT: %.loc8_19.3: i32 = int_literal 0 [template = constants.%.10] +// CHECK:STDOUT: %.loc8_19.3: i32 = int_literal 0 [template = constants.%.9] // CHECK:STDOUT: %.loc8_19.4: ref i32 = array_index %b.var, %.loc8_19.3 // CHECK:STDOUT: %.loc8_19.5: init i32 = initialize_from %.loc8_19.2 to %.loc8_19.4 // CHECK:STDOUT: %.loc8_19.6: ref i32 = tuple_access %a.ref, element1 // CHECK:STDOUT: %.loc8_19.7: i32 = bind_value %.loc8_19.6 -// CHECK:STDOUT: %.loc8_19.8: i32 = int_literal 1 [template = constants.%.11] +// CHECK:STDOUT: %.loc8_19.8: i32 = int_literal 1 [template = constants.%.10] // CHECK:STDOUT: %.loc8_19.9: ref i32 = array_index %b.var, %.loc8_19.8 // CHECK:STDOUT: %.loc8_19.10: init i32 = initialize_from %.loc8_19.7 to %.loc8_19.9 // CHECK:STDOUT: %.loc8_19.11: ref i32 = tuple_access %a.ref, element2 // CHECK:STDOUT: %.loc8_19.12: i32 = bind_value %.loc8_19.11 -// CHECK:STDOUT: %.loc8_19.13: i32 = int_literal 2 [template = constants.%.12] +// CHECK:STDOUT: %.loc8_19.13: i32 = int_literal 2 [template = constants.%.11] // CHECK:STDOUT: %.loc8_19.14: ref i32 = array_index %b.var, %.loc8_19.13 // CHECK:STDOUT: %.loc8_19.15: init i32 = initialize_from %.loc8_19.12 to %.loc8_19.14 // CHECK:STDOUT: %.loc8_19.16: init [i32; 3] = array_init (%.loc8_19.5, %.loc8_19.10, %.loc8_19.15) to %b.var diff --git a/toolchain/check/testdata/array/base.carbon b/toolchain/check/testdata/array/base.carbon index d25b7fbc76bf..ceaf700fd2c0 100644 --- a/toolchain/check/testdata/array/base.carbon +++ b/toolchain/check/testdata/array/base.carbon @@ -14,27 +14,23 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] // CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] // CHECK:STDOUT: %.3: type = ptr_type [i32; 1] [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.8: type = array_type %.7, f64 [template] -// CHECK:STDOUT: %.9: type = ptr_type [f64; 2] [template] -// CHECK:STDOUT: %.10: f64 = real_literal 111e-1 [template] -// CHECK:STDOUT: %.11: f64 = real_literal 22e-1 [template] -// CHECK:STDOUT: %.12: type = tuple_type (f64, f64) [template] -// CHECK:STDOUT: %.13: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.14: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.15: type = tuple_type () [template] -// CHECK:STDOUT: %.16: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.17: type = array_type %.16, () [template] -// CHECK:STDOUT: %.18: type = ptr_type [(); 5] [template] -// CHECK:STDOUT: %.19: type = tuple_type ((), (), (), (), ()) [template] -// CHECK:STDOUT: %.20: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.21: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.22: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.23: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.24: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.4: type = tuple_type (i32) [template] +// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.7: type = array_type %.6, f64 [template] +// CHECK:STDOUT: %.8: type = ptr_type [f64; 2] [template] +// CHECK:STDOUT: %.9: f64 = real_literal 111e-1 [template] +// CHECK:STDOUT: %.10: f64 = real_literal 22e-1 [template] +// CHECK:STDOUT: %.11: type = tuple_type (f64, f64) [template] +// CHECK:STDOUT: %.12: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.13: type = tuple_type () [template] +// CHECK:STDOUT: %.14: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.15: type = array_type %.14, () [template] +// CHECK:STDOUT: %.16: type = ptr_type [(); 5] [template] +// CHECK:STDOUT: %.17: type = tuple_type ((), (), (), (), ()) [template] +// CHECK:STDOUT: %.18: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.19: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.20: i32 = int_literal 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -43,34 +39,34 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.2] // CHECK:STDOUT: %a.var: ref [i32; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc7_22.1: (i32,) = tuple_literal (%.loc7_20) -// CHECK:STDOUT: %.loc7_22.2: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc7_22.2: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc7_22.3: ref i32 = array_index %a.var, %.loc7_22.2 // CHECK:STDOUT: %.loc7_22.4: init i32 = initialize_from %.loc7_20 to %.loc7_22.3 // CHECK:STDOUT: %.loc7_22.5: init [i32; 1] = array_init (%.loc7_22.4) to %a.var // CHECK:STDOUT: %.loc7_22.6: init [i32; 1] = converted %.loc7_22.1, %.loc7_22.5 // CHECK:STDOUT: assign %a.var, %.loc7_22.6 -// CHECK:STDOUT: %.loc8_14: i32 = int_literal 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, f64 [template = constants.%.8] +// CHECK:STDOUT: %.loc8_14: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, f64 [template = constants.%.7] // CHECK:STDOUT: %b.var: ref [f64; 2] = var b // CHECK:STDOUT: %b: ref [f64; 2] = bind_name b, %b.var -// CHECK:STDOUT: %.loc8_20: f64 = real_literal 111e-1 [template = constants.%.10] -// CHECK:STDOUT: %.loc8_26: f64 = real_literal 22e-1 [template = constants.%.11] +// CHECK:STDOUT: %.loc8_20: f64 = real_literal 111e-1 [template = constants.%.9] +// CHECK:STDOUT: %.loc8_26: f64 = real_literal 22e-1 [template = constants.%.10] // CHECK:STDOUT: %.loc8_30.1: (f64, f64) = tuple_literal (%.loc8_20, %.loc8_26) -// CHECK:STDOUT: %.loc8_30.2: i32 = int_literal 0 [template = constants.%.13] +// CHECK:STDOUT: %.loc8_30.2: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc8_30.3: ref f64 = array_index %b.var, %.loc8_30.2 // CHECK:STDOUT: %.loc8_30.4: init f64 = initialize_from %.loc8_20 to %.loc8_30.3 -// CHECK:STDOUT: %.loc8_30.5: i32 = int_literal 1 [template = constants.%.14] +// CHECK:STDOUT: %.loc8_30.5: i32 = int_literal 1 [template = constants.%.12] // CHECK:STDOUT: %.loc8_30.6: ref f64 = array_index %b.var, %.loc8_30.5 // CHECK:STDOUT: %.loc8_30.7: init f64 = initialize_from %.loc8_26 to %.loc8_30.6 // CHECK:STDOUT: %.loc8_30.8: init [f64; 2] = array_init (%.loc8_30.4, %.loc8_30.7) to %b.var // CHECK:STDOUT: %.loc8_30.9: init [f64; 2] = converted %.loc8_30.1, %.loc8_30.8 // CHECK:STDOUT: assign %b.var, %.loc8_30.9 // CHECK:STDOUT: %.loc9_10.1: () = tuple_literal () -// CHECK:STDOUT: %.loc9_13: i32 = int_literal 5 [template = constants.%.16] -// CHECK:STDOUT: %.loc9_10.2: type = converted %.loc9_10.1, constants.%.15 [template = constants.%.15] -// CHECK:STDOUT: %.loc9_14: type = array_type %.loc9_13, () [template = constants.%.17] +// CHECK:STDOUT: %.loc9_13: i32 = int_literal 5 [template = constants.%.14] +// CHECK:STDOUT: %.loc9_10.2: type = converted %.loc9_10.1, constants.%.13 [template = constants.%.13] +// CHECK:STDOUT: %.loc9_14: type = array_type %.loc9_13, () [template = constants.%.15] // CHECK:STDOUT: %c.var: ref [(); 5] = var c // CHECK:STDOUT: %c: ref [(); 5] = bind_name c, %c.var // CHECK:STDOUT: %.loc9_20.1: () = tuple_literal () @@ -79,23 +75,23 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: %.loc9_32.1: () = tuple_literal () // CHECK:STDOUT: %.loc9_36.1: () = tuple_literal () // CHECK:STDOUT: %.loc9_38.1: ((), (), (), (), ()) = tuple_literal (%.loc9_20.1, %.loc9_24.1, %.loc9_28.1, %.loc9_32.1, %.loc9_36.1) -// CHECK:STDOUT: %.loc9_38.2: i32 = int_literal 0 [template = constants.%.20] +// CHECK:STDOUT: %.loc9_38.2: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc9_38.3: ref () = array_index %c.var, %.loc9_38.2 // CHECK:STDOUT: %.loc9_20.2: init () = tuple_init () to %.loc9_38.3 // CHECK:STDOUT: %.loc9_20.3: init () = converted %.loc9_20.1, %.loc9_20.2 -// CHECK:STDOUT: %.loc9_38.4: i32 = int_literal 1 [template = constants.%.21] +// CHECK:STDOUT: %.loc9_38.4: i32 = int_literal 1 [template = constants.%.12] // CHECK:STDOUT: %.loc9_38.5: ref () = array_index %c.var, %.loc9_38.4 // CHECK:STDOUT: %.loc9_24.2: init () = tuple_init () to %.loc9_38.5 // CHECK:STDOUT: %.loc9_24.3: init () = converted %.loc9_24.1, %.loc9_24.2 -// CHECK:STDOUT: %.loc9_38.6: i32 = int_literal 2 [template = constants.%.22] +// CHECK:STDOUT: %.loc9_38.6: i32 = int_literal 2 [template = constants.%.18] // CHECK:STDOUT: %.loc9_38.7: ref () = array_index %c.var, %.loc9_38.6 // CHECK:STDOUT: %.loc9_28.2: init () = tuple_init () to %.loc9_38.7 // CHECK:STDOUT: %.loc9_28.3: init () = converted %.loc9_28.1, %.loc9_28.2 -// CHECK:STDOUT: %.loc9_38.8: i32 = int_literal 3 [template = constants.%.23] +// CHECK:STDOUT: %.loc9_38.8: i32 = int_literal 3 [template = constants.%.19] // CHECK:STDOUT: %.loc9_38.9: ref () = array_index %c.var, %.loc9_38.8 // CHECK:STDOUT: %.loc9_32.2: init () = tuple_init () to %.loc9_38.9 // CHECK:STDOUT: %.loc9_32.3: init () = converted %.loc9_32.1, %.loc9_32.2 -// CHECK:STDOUT: %.loc9_38.10: i32 = int_literal 4 [template = constants.%.24] +// CHECK:STDOUT: %.loc9_38.10: i32 = int_literal 4 [template = constants.%.20] // CHECK:STDOUT: %.loc9_38.11: ref () = array_index %c.var, %.loc9_38.10 // CHECK:STDOUT: %.loc9_36.2: init () = tuple_init () to %.loc9_38.11 // CHECK:STDOUT: %.loc9_36.3: init () = converted %.loc9_36.1, %.loc9_36.2 diff --git a/toolchain/check/testdata/array/fail_incomplete_element.carbon b/toolchain/check/testdata/array/fail_incomplete_element.carbon index 631805b503c2..e511818ccfc8 100644 --- a/toolchain/check/testdata/array/fail_incomplete_element.carbon +++ b/toolchain/check/testdata/array/fail_incomplete_element.carbon @@ -22,27 +22,29 @@ var p: Incomplete* = &a[0]; // CHECK:STDOUT: --- fail_incomplete_element.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] // CHECK:STDOUT: %.2: type = array_type %.1, Incomplete [template] -// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.4: type = ptr_type [template] +// CHECK:STDOUT: %.3: type = ptr_type Incomplete [template] +// CHECK:STDOUT: %.4: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.5: type = ptr_type [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Incomplete = %Incomplete.decl, .a = %a, .p = %p} [template] // CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] -// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete [template = %Incomplete] +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete [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.loc20: type = name_ref Incomplete, %Incomplete [template = %Incomplete] -// CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete [template] +// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %.loc20_18: 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 // CHECK:STDOUT: %a.ref: ref = name_ref a, %a -// CHECK:STDOUT: %.loc20_25: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc20_25: i32 = int_literal 0 [template = constants.%.4] // CHECK:STDOUT: %.loc20_22: * = addr_of // CHECK:STDOUT: assign %p.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_invalid_type.carbon b/toolchain/check/testdata/array/fail_invalid_type.carbon index cbd7fe8fde95..6fc2942ba263 100644 --- a/toolchain/check/testdata/array/fail_invalid_type.carbon +++ b/toolchain/check/testdata/array/fail_invalid_type.carbon @@ -13,16 +13,15 @@ var a: [1; 1]; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: type = array_type %.2, [template] -// CHECK:STDOUT: %.4: type = ptr_type [; 1] [template] +// CHECK:STDOUT: %.2: type = array_type %.1, [template] +// CHECK:STDOUT: %.3: type = ptr_type [; 1] [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a = %a} [template] // CHECK:STDOUT: %.loc10_9: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_12: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_13: type = array_type %.loc10_12, [template = constants.%.3] +// CHECK:STDOUT: %.loc10_12: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_13: type = array_type %.loc10_12, [template = constants.%.2] // CHECK:STDOUT: %a.var: ref [; 1] = var a // CHECK:STDOUT: %a: ref [; 1] = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_out_of_bound.carbon b/toolchain/check/testdata/array/fail_out_of_bound.carbon index 25d14b14a7c8..5ef8d41e4fbf 100644 --- a/toolchain/check/testdata/array/fail_out_of_bound.carbon +++ b/toolchain/check/testdata/array/fail_out_of_bound.carbon @@ -15,10 +15,9 @@ var a: [i32; 1] = (1, 2, 3); // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] // CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] // CHECK:STDOUT: %.3: type = ptr_type [i32; 1] [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.6: type = tuple_type (i32, i32, i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -27,9 +26,9 @@ var a: [i32; 1] = (1, 2, 3); // CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32 [template = constants.%.2] // CHECK:STDOUT: %a.var: ref [i32; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_23: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_26: i32 = int_literal 3 [template = constants.%.6] +// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_23: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_26: i32 = int_literal 3 [template = constants.%.5] // CHECK:STDOUT: %.loc10_27: (i32, i32, i32) = tuple_literal (%.loc10_20, %.loc10_23, %.loc10_26) // CHECK:STDOUT: assign %a.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_type_mismatch.carbon b/toolchain/check/testdata/array/fail_type_mismatch.carbon index 84fe48ef0c89..1fe2979bb225 100644 --- a/toolchain/check/testdata/array/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/array/fail_type_mismatch.carbon @@ -42,19 +42,10 @@ var d: [i32; 3] = t2; // CHECK:STDOUT: %.11: type = tuple_type (type, type, type) [template] // CHECK:STDOUT: %.12: type = tuple_type (i32, String*, String*) [template] // CHECK:STDOUT: %.13: type = ptr_type (i32, String*, String*) [template] -// CHECK:STDOUT: %.14: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.15: type = array_type %.14, i32 [template] -// CHECK:STDOUT: %.16: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.17: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.18: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.19: type = array_type %.18, i32 [template] -// CHECK:STDOUT: %.20: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.21: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.22: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.23: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.24: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.25: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.26: type = array_type %.25, i32 [template] +// CHECK:STDOUT: %.14: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.15: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.16: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.17: type = ptr_type (i32, i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -75,32 +66,32 @@ var d: [i32; 3] = t2; // CHECK:STDOUT: %.loc12_29.2: type = converted %.loc12_29.1, constants.%.8 [template = constants.%.8] // CHECK:STDOUT: %t1.var: ref (i32, String, String) = var t1 // CHECK:STDOUT: %t1: ref (i32, String, String) = bind_name t1, %t1.var -// CHECK:STDOUT: %.loc16_14: i32 = int_literal 3 [template = constants.%.14] -// CHECK:STDOUT: %.loc16_15: type = array_type %.loc16_14, i32 [template = constants.%.15] +// CHECK:STDOUT: %.loc16_14: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc16_15: type = array_type %.loc16_14, i32 [template = constants.%.2] // CHECK:STDOUT: %b.var: ref [i32; 3] = var b // CHECK:STDOUT: %b: ref [i32; 3] = bind_name b, %b.var // CHECK:STDOUT: %t1.ref: ref (i32, String, String) = name_ref t1, %t1 // CHECK:STDOUT: %.loc16_19.1: ref i32 = tuple_access %t1.ref, element0 // CHECK:STDOUT: %.loc16_19.2: i32 = bind_value %.loc16_19.1 -// CHECK:STDOUT: %.loc16_19.3: i32 = int_literal 0 [template = constants.%.16] +// CHECK:STDOUT: %.loc16_19.3: i32 = int_literal 0 [template = constants.%.9] // CHECK:STDOUT: %.loc16_19.4: ref i32 = array_index %b.var, %.loc16_19.3 // CHECK:STDOUT: %.loc16_19.5: init i32 = initialize_from %.loc16_19.2 to %.loc16_19.4 // CHECK:STDOUT: %.loc16_19.6: ref String = tuple_access %t1.ref, element1 // CHECK:STDOUT: assign %b.var, -// CHECK:STDOUT: %.loc21_14: i32 = int_literal 3 [template = constants.%.18] -// CHECK:STDOUT: %.loc21_15: type = array_type %.loc21_14, i32 [template = constants.%.19] +// CHECK:STDOUT: %.loc21_14: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc21_15: type = array_type %.loc21_14, i32 [template = constants.%.2] // CHECK:STDOUT: %c.var: ref [i32; 3] = var c // CHECK:STDOUT: %c: ref [i32; 3] = bind_name c, %c.var -// CHECK:STDOUT: %.loc21_20: i32 = int_literal 1 [template = constants.%.20] -// CHECK:STDOUT: %.loc21_23: i32 = int_literal 2 [template = constants.%.21] +// CHECK:STDOUT: %.loc21_20: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc21_23: i32 = int_literal 2 [template = constants.%.14] // CHECK:STDOUT: %.loc21_24: (i32, i32) = tuple_literal (%.loc21_20, %.loc21_23) // CHECK:STDOUT: assign %c.var, // CHECK:STDOUT: %.loc23_18.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc23_18.2: type = converted %.loc23_18.1, constants.%.22 [template = constants.%.22] +// CHECK:STDOUT: %.loc23_18.2: type = converted %.loc23_18.1, constants.%.15 [template = constants.%.15] // CHECK:STDOUT: %t2.var: ref (i32, i32) = var t2 // CHECK:STDOUT: %t2: ref (i32, i32) = bind_name t2, %t2.var -// CHECK:STDOUT: %.loc27_14: i32 = int_literal 3 [template = constants.%.25] -// CHECK:STDOUT: %.loc27_15: type = array_type %.loc27_14, i32 [template = constants.%.26] +// CHECK:STDOUT: %.loc27_14: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc27_15: type = array_type %.loc27_14, i32 [template = constants.%.2] // CHECK:STDOUT: %d.var: ref [i32; 3] = var d // CHECK:STDOUT: %d: ref [i32; 3] = bind_name d, %d.var // CHECK:STDOUT: %t2.ref: ref (i32, i32) = name_ref t2, %t2 diff --git a/toolchain/check/testdata/array/function_param.carbon b/toolchain/check/testdata/array/function_param.carbon index 7b5715b77cf0..398111da53be 100644 --- a/toolchain/check/testdata/array/function_param.carbon +++ b/toolchain/check/testdata/array/function_param.carbon @@ -20,12 +20,10 @@ fn G() -> i32 { // CHECK:STDOUT: %.3: type = ptr_type [i32; 3] [template] // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.6: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] // CHECK:STDOUT: %.8: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.9: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.10: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.11: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.9: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -49,17 +47,17 @@ fn G() -> i32 { // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc12_13: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc12_16: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_19: i32 = int_literal 3 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_19: i32 = int_literal 3 [template = constants.%.1] // CHECK:STDOUT: %.loc12_20.1: (i32, i32, i32) = tuple_literal (%.loc12_13, %.loc12_16, %.loc12_19) -// CHECK:STDOUT: %.loc12_23: i32 = int_literal 1 [template = constants.%.8] +// CHECK:STDOUT: %.loc12_23: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc12_20.2: ref [i32; 3] = temporary_storage -// CHECK:STDOUT: %.loc12_20.3: i32 = int_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc12_20.3: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %.loc12_20.4: ref i32 = array_index %.loc12_20.2, %.loc12_20.3 // CHECK:STDOUT: %.loc12_20.5: init i32 = initialize_from %.loc12_13 to %.loc12_20.4 -// CHECK:STDOUT: %.loc12_20.6: i32 = int_literal 1 [template = constants.%.10] +// CHECK:STDOUT: %.loc12_20.6: i32 = int_literal 1 [template = constants.%.8] // CHECK:STDOUT: %.loc12_20.7: ref i32 = array_index %.loc12_20.2, %.loc12_20.6 // CHECK:STDOUT: %.loc12_20.8: init i32 = initialize_from %.loc12_16 to %.loc12_20.7 -// CHECK:STDOUT: %.loc12_20.9: i32 = int_literal 2 [template = constants.%.11] +// CHECK:STDOUT: %.loc12_20.9: i32 = int_literal 2 [template = constants.%.9] // CHECK:STDOUT: %.loc12_20.10: ref i32 = array_index %.loc12_20.2, %.loc12_20.9 // CHECK:STDOUT: %.loc12_20.11: init i32 = initialize_from %.loc12_19 to %.loc12_20.10 // CHECK:STDOUT: %.loc12_20.12: init [i32; 3] = array_init (%.loc12_20.5, %.loc12_20.8, %.loc12_20.11) to %.loc12_20.2 diff --git a/toolchain/check/testdata/array/nine_elements.carbon b/toolchain/check/testdata/array/nine_elements.carbon index e60052cf42cf..1d35bc43fc93 100644 --- a/toolchain/check/testdata/array/nine_elements.carbon +++ b/toolchain/check/testdata/array/nine_elements.carbon @@ -20,17 +20,16 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9); // CHECK:STDOUT: %.9: i32 = int_literal 6 [template] // CHECK:STDOUT: %.10: i32 = int_literal 7 [template] // CHECK:STDOUT: %.11: i32 = int_literal 8 [template] -// CHECK:STDOUT: %.12: i32 = int_literal 9 [template] -// CHECK:STDOUT: %.13: type = tuple_type (i32, i32, i32, i32, i32, i32, i32, i32, i32) [template] -// CHECK:STDOUT: %.14: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.15: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.16: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.17: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.18: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.19: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.20: i32 = int_literal 6 [template] -// CHECK:STDOUT: %.21: i32 = int_literal 7 [template] -// CHECK:STDOUT: %.22: i32 = int_literal 8 [template] +// CHECK:STDOUT: %.12: type = tuple_type (i32, i32, i32, i32, i32, i32, i32, i32, i32) [template] +// CHECK:STDOUT: %.13: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.14: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.15: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.16: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.17: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.18: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.19: i32 = int_literal 6 [template] +// CHECK:STDOUT: %.20: i32 = int_literal 7 [template] +// CHECK:STDOUT: %.21: i32 = int_literal 8 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -47,33 +46,33 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9); // CHECK:STDOUT: %.loc7_35: i32 = int_literal 6 [template = constants.%.9] // CHECK:STDOUT: %.loc7_38: i32 = int_literal 7 [template = constants.%.10] // CHECK:STDOUT: %.loc7_41: i32 = int_literal 8 [template = constants.%.11] -// CHECK:STDOUT: %.loc7_44: i32 = int_literal 9 [template = constants.%.12] +// CHECK:STDOUT: %.loc7_44: i32 = int_literal 9 [template = constants.%.1] // CHECK:STDOUT: %.loc7_45.1: (i32, i32, i32, i32, i32, i32, i32, i32, i32) = tuple_literal (%.loc7_20, %.loc7_23, %.loc7_26, %.loc7_29, %.loc7_32, %.loc7_35, %.loc7_38, %.loc7_41, %.loc7_44) -// CHECK:STDOUT: %.loc7_45.2: i32 = int_literal 0 [template = constants.%.14] +// CHECK:STDOUT: %.loc7_45.2: i32 = int_literal 0 [template = constants.%.13] // CHECK:STDOUT: %.loc7_45.3: ref i32 = array_index %a.var, %.loc7_45.2 // CHECK:STDOUT: %.loc7_45.4: init i32 = initialize_from %.loc7_20 to %.loc7_45.3 -// CHECK:STDOUT: %.loc7_45.5: i32 = int_literal 1 [template = constants.%.15] +// CHECK:STDOUT: %.loc7_45.5: i32 = int_literal 1 [template = constants.%.14] // CHECK:STDOUT: %.loc7_45.6: ref i32 = array_index %a.var, %.loc7_45.5 // CHECK:STDOUT: %.loc7_45.7: init i32 = initialize_from %.loc7_23 to %.loc7_45.6 -// CHECK:STDOUT: %.loc7_45.8: i32 = int_literal 2 [template = constants.%.16] +// CHECK:STDOUT: %.loc7_45.8: i32 = int_literal 2 [template = constants.%.15] // CHECK:STDOUT: %.loc7_45.9: ref i32 = array_index %a.var, %.loc7_45.8 // CHECK:STDOUT: %.loc7_45.10: init i32 = initialize_from %.loc7_26 to %.loc7_45.9 -// CHECK:STDOUT: %.loc7_45.11: i32 = int_literal 3 [template = constants.%.17] +// CHECK:STDOUT: %.loc7_45.11: i32 = int_literal 3 [template = constants.%.16] // CHECK:STDOUT: %.loc7_45.12: ref i32 = array_index %a.var, %.loc7_45.11 // CHECK:STDOUT: %.loc7_45.13: init i32 = initialize_from %.loc7_29 to %.loc7_45.12 -// CHECK:STDOUT: %.loc7_45.14: i32 = int_literal 4 [template = constants.%.18] +// CHECK:STDOUT: %.loc7_45.14: i32 = int_literal 4 [template = constants.%.17] // CHECK:STDOUT: %.loc7_45.15: ref i32 = array_index %a.var, %.loc7_45.14 // CHECK:STDOUT: %.loc7_45.16: init i32 = initialize_from %.loc7_32 to %.loc7_45.15 -// CHECK:STDOUT: %.loc7_45.17: i32 = int_literal 5 [template = constants.%.19] +// CHECK:STDOUT: %.loc7_45.17: i32 = int_literal 5 [template = constants.%.18] // CHECK:STDOUT: %.loc7_45.18: ref i32 = array_index %a.var, %.loc7_45.17 // CHECK:STDOUT: %.loc7_45.19: init i32 = initialize_from %.loc7_35 to %.loc7_45.18 -// CHECK:STDOUT: %.loc7_45.20: i32 = int_literal 6 [template = constants.%.20] +// CHECK:STDOUT: %.loc7_45.20: i32 = int_literal 6 [template = constants.%.19] // CHECK:STDOUT: %.loc7_45.21: ref i32 = array_index %a.var, %.loc7_45.20 // CHECK:STDOUT: %.loc7_45.22: init i32 = initialize_from %.loc7_38 to %.loc7_45.21 -// CHECK:STDOUT: %.loc7_45.23: i32 = int_literal 7 [template = constants.%.21] +// CHECK:STDOUT: %.loc7_45.23: i32 = int_literal 7 [template = constants.%.20] // CHECK:STDOUT: %.loc7_45.24: ref i32 = array_index %a.var, %.loc7_45.23 // CHECK:STDOUT: %.loc7_45.25: init i32 = initialize_from %.loc7_41 to %.loc7_45.24 -// CHECK:STDOUT: %.loc7_45.26: i32 = int_literal 8 [template = constants.%.22] +// CHECK:STDOUT: %.loc7_45.26: i32 = int_literal 8 [template = constants.%.21] // CHECK:STDOUT: %.loc7_45.27: ref i32 = array_index %a.var, %.loc7_45.26 // CHECK:STDOUT: %.loc7_45.28: init i32 = initialize_from %.loc7_44 to %.loc7_45.27 // CHECK:STDOUT: %.loc7_45.29: init [i32; 9] = array_init (%.loc7_45.4, %.loc7_45.7, %.loc7_45.10, %.loc7_45.13, %.loc7_45.16, %.loc7_45.19, %.loc7_45.22, %.loc7_45.25, %.loc7_45.28) to %a.var diff --git a/toolchain/check/testdata/as/identity.carbon b/toolchain/check/testdata/as/identity.carbon index 6d8a049114f1..273905dbe76f 100644 --- a/toolchain/check/testdata/as/identity.carbon +++ b/toolchain/check/testdata/as/identity.carbon @@ -27,15 +27,17 @@ fn Initializing() { // CHECK:STDOUT: --- identity.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %X: type = class_type @X [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] +// CHECK:STDOUT: %.4: type = ptr_type X [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.X = %X.decl, .Value = %Value, .Reference = %Reference, .Make = %Make, .Initializing = %Initializing} [template] // CHECK:STDOUT: %X.decl = class_decl @X, () -// CHECK:STDOUT: %X: type = class_type @X [template] +// CHECK:STDOUT: %X: type = class_type @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] @@ -49,20 +51,20 @@ fn Initializing() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Value(%n: X) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc14_10: type = name_ref X, file.%X [template = file.%X] +// CHECK:STDOUT: %X.ref.loc14_10: type = name_ref X, file.%X [template = constants.%X] // CHECK:STDOUT: %n.ref: X = name_ref n, %n -// CHECK:STDOUT: %X.ref.loc14_19: type = name_ref X, file.%X [template = file.%X] +// CHECK:STDOUT: %X.ref.loc14_19: type = name_ref X, file.%X [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, file.%X [template = file.%X] -// CHECK:STDOUT: %.loc18_11: type = ptr_type X [template] +// CHECK:STDOUT: %X.ref.loc18_10: type = name_ref X, file.%X [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, file.%X [template = file.%X] +// CHECK:STDOUT: %X.ref.loc18_23: type = name_ref X, file.%X [template = constants.%X] // CHECK:STDOUT: %.loc18_15: X* = addr_of %.loc18_17 // CHECK:STDOUT: %q: X* = bind_name q, %.loc18_15 // CHECK:STDOUT: return @@ -72,13 +74,13 @@ fn Initializing() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Initializing() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc24_10: type = name_ref X, file.%X [template = file.%X] +// CHECK:STDOUT: %X.ref.loc24_10: type = name_ref X, file.%X [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, file.%X [template = file.%X] +// CHECK:STDOUT: %X.ref.loc24_25: type = name_ref X, file.%X [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 659e8f9e081b..aeb12bcd1f9c 100644 --- a/toolchain/check/testdata/as/tuple.carbon +++ b/toolchain/check/testdata/as/tuple.carbon @@ -23,6 +23,7 @@ fn Var() { // CHECK:STDOUT: --- tuple.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %X: type = class_type @X [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] @@ -35,7 +36,7 @@ fn Var() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.X = %X.decl, .Make = %Make, .Let = %Let, .Var = %Var} [template] // CHECK:STDOUT: %X.decl = class_decl @X, () -// CHECK:STDOUT: %X: type = class_type @X [template] +// CHECK:STDOUT: %X: type = class_type @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 +51,8 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Let() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc15_11: type = name_ref X, file.%X [template = file.%X] -// CHECK:STDOUT: %X.ref.loc15_14: type = name_ref X, file.%X [template = file.%X] +// CHECK:STDOUT: %X.ref.loc15_11: type = name_ref X, file.%X [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc15_14: type = name_ref X, file.%X [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 +62,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, file.%X [template = file.%X] -// CHECK:STDOUT: %X.ref.loc15_43: type = name_ref X, file.%X [template = file.%X] +// CHECK:STDOUT: %X.ref.loc15_40: type = name_ref X, file.%X [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc15_43: type = name_ref X, file.%X [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 +78,8 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Var() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc20_11: type = name_ref X, file.%X [template = file.%X] -// CHECK:STDOUT: %X.ref.loc20_14: type = name_ref X, file.%X [template = file.%X] +// CHECK:STDOUT: %X.ref.loc20_11: type = name_ref X, file.%X [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc20_14: type = name_ref X, file.%X [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 +91,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, file.%X [template = file.%X] -// CHECK:STDOUT: %X.ref.loc20_43: type = name_ref X, file.%X [template = file.%X] +// CHECK:STDOUT: %X.ref.loc20_40: type = name_ref X, file.%X [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc20_43: type = name_ref X, file.%X [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/basics/numeric_literals.carbon b/toolchain/check/testdata/basics/numeric_literals.carbon index 23f9d5ea2f05..a59e1bd1a56a 100644 --- a/toolchain/check/testdata/basics/numeric_literals.carbon +++ b/toolchain/check/testdata/basics/numeric_literals.carbon @@ -33,33 +33,26 @@ fn F() { // CHECK:STDOUT: %.3: type = ptr_type [i32; 5] [template] // CHECK:STDOUT: %.4: i32 = int_literal 8 [template] // CHECK:STDOUT: %.5: i32 = int_literal 9 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 8 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 8 [template] -// CHECK:STDOUT: %.8: i32 = int_literal 39999999999999999993 [template] -// CHECK:STDOUT: %.9: type = tuple_type (i32, i32, i32, i32, i32) [template] -// CHECK:STDOUT: %.10: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.11: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.12: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.13: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.14: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.15: i32 = int_literal 7 [template] -// CHECK:STDOUT: %.16: type = array_type %.15, f64 [template] -// CHECK:STDOUT: %.17: type = ptr_type [f64; 7] [template] -// CHECK:STDOUT: %.18: f64 = real_literal 9e-1 [template] -// CHECK:STDOUT: %.19: f64 = real_literal 80e-1 [template] -// CHECK:STDOUT: %.20: f64 = real_literal 800e-1 [template] -// CHECK:STDOUT: %.21: f64 = real_literal 10e6 [template] -// CHECK:STDOUT: %.22: f64 = real_literal 10e7 [template] -// CHECK:STDOUT: %.23: f64 = real_literal 10e-9 [template] -// CHECK:STDOUT: %.24: f64 = real_literal 399999999999999999930e39999999999999999992 [template] -// CHECK:STDOUT: %.25: type = tuple_type (f64, f64, f64, f64, f64, f64, f64) [template] -// CHECK:STDOUT: %.26: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.27: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.28: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.29: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.30: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.31: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.32: i32 = int_literal 6 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 39999999999999999993 [template] +// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32, i32, i32) [template] +// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.9: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.10: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.11: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.12: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.13: i32 = int_literal 7 [template] +// CHECK:STDOUT: %.14: type = array_type %.13, f64 [template] +// CHECK:STDOUT: %.15: type = ptr_type [f64; 7] [template] +// CHECK:STDOUT: %.16: f64 = real_literal 9e-1 [template] +// CHECK:STDOUT: %.17: f64 = real_literal 80e-1 [template] +// CHECK:STDOUT: %.18: f64 = real_literal 800e-1 [template] +// CHECK:STDOUT: %.19: f64 = real_literal 10e6 [template] +// CHECK:STDOUT: %.20: f64 = real_literal 10e7 [template] +// CHECK:STDOUT: %.21: f64 = real_literal 10e-9 [template] +// CHECK:STDOUT: %.22: f64 = real_literal 399999999999999999930e39999999999999999992 [template] +// CHECK:STDOUT: %.23: type = tuple_type (f64, f64, f64, f64, f64, f64, f64) [template] +// CHECK:STDOUT: %.24: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.25: i32 = int_literal 6 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -75,59 +68,59 @@ fn F() { // CHECK:STDOUT: %ints: ref [i32; 5] = bind_name ints, %ints.var // CHECK:STDOUT: %.loc11: i32 = int_literal 8 [template = constants.%.4] // CHECK:STDOUT: %.loc12: i32 = int_literal 9 [template = constants.%.5] -// CHECK:STDOUT: %.loc13: i32 = int_literal 8 [template = constants.%.6] -// CHECK:STDOUT: %.loc14: i32 = int_literal 8 [template = constants.%.7] -// CHECK:STDOUT: %.loc15: i32 = int_literal 39999999999999999993 [template = constants.%.8] +// CHECK:STDOUT: %.loc13: i32 = int_literal 8 [template = constants.%.4] +// CHECK:STDOUT: %.loc14: i32 = int_literal 8 [template = constants.%.4] +// CHECK:STDOUT: %.loc15: i32 = int_literal 39999999999999999993 [template = constants.%.6] // CHECK:STDOUT: %.loc16_3.1: (i32, i32, i32, i32, i32) = tuple_literal (%.loc11, %.loc12, %.loc13, %.loc14, %.loc15) -// CHECK:STDOUT: %.loc16_3.2: i32 = int_literal 0 [template = constants.%.10] +// CHECK:STDOUT: %.loc16_3.2: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc16_3.3: ref i32 = array_index %ints.var, %.loc16_3.2 // CHECK:STDOUT: %.loc16_3.4: init i32 = initialize_from %.loc11 to %.loc16_3.3 -// CHECK:STDOUT: %.loc16_3.5: i32 = int_literal 1 [template = constants.%.11] +// CHECK:STDOUT: %.loc16_3.5: i32 = int_literal 1 [template = constants.%.9] // CHECK:STDOUT: %.loc16_3.6: ref i32 = array_index %ints.var, %.loc16_3.5 // CHECK:STDOUT: %.loc16_3.7: init i32 = initialize_from %.loc12 to %.loc16_3.6 -// CHECK:STDOUT: %.loc16_3.8: i32 = int_literal 2 [template = constants.%.12] +// CHECK:STDOUT: %.loc16_3.8: i32 = int_literal 2 [template = constants.%.10] // CHECK:STDOUT: %.loc16_3.9: ref i32 = array_index %ints.var, %.loc16_3.8 // CHECK:STDOUT: %.loc16_3.10: init i32 = initialize_from %.loc13 to %.loc16_3.9 -// CHECK:STDOUT: %.loc16_3.11: i32 = int_literal 3 [template = constants.%.13] +// CHECK:STDOUT: %.loc16_3.11: i32 = int_literal 3 [template = constants.%.11] // CHECK:STDOUT: %.loc16_3.12: ref i32 = array_index %ints.var, %.loc16_3.11 // CHECK:STDOUT: %.loc16_3.13: init i32 = initialize_from %.loc14 to %.loc16_3.12 -// CHECK:STDOUT: %.loc16_3.14: i32 = int_literal 4 [template = constants.%.14] +// CHECK:STDOUT: %.loc16_3.14: i32 = int_literal 4 [template = constants.%.12] // CHECK:STDOUT: %.loc16_3.15: ref i32 = array_index %ints.var, %.loc16_3.14 // CHECK:STDOUT: %.loc16_3.16: init i32 = initialize_from %.loc15 to %.loc16_3.15 // CHECK:STDOUT: %.loc16_3.17: init [i32; 5] = array_init (%.loc16_3.4, %.loc16_3.7, %.loc16_3.10, %.loc16_3.13, %.loc16_3.16) to %ints.var // CHECK:STDOUT: %.loc16_3.18: init [i32; 5] = converted %.loc16_3.1, %.loc16_3.17 // CHECK:STDOUT: assign %ints.var, %.loc16_3.18 -// CHECK:STDOUT: %.loc17_21: i32 = int_literal 7 [template = constants.%.15] -// CHECK:STDOUT: %.loc17_22: type = array_type %.loc17_21, f64 [template = constants.%.16] +// CHECK:STDOUT: %.loc17_21: i32 = int_literal 7 [template = constants.%.13] +// CHECK:STDOUT: %.loc17_22: type = array_type %.loc17_21, f64 [template = constants.%.14] // CHECK:STDOUT: %floats.var: ref [f64; 7] = var floats // CHECK:STDOUT: %floats: ref [f64; 7] = bind_name floats, %floats.var -// CHECK:STDOUT: %.loc18: f64 = real_literal 9e-1 [template = constants.%.18] -// CHECK:STDOUT: %.loc19: f64 = real_literal 80e-1 [template = constants.%.19] -// CHECK:STDOUT: %.loc20: f64 = real_literal 800e-1 [template = constants.%.20] -// CHECK:STDOUT: %.loc21: f64 = real_literal 10e6 [template = constants.%.21] -// CHECK:STDOUT: %.loc22: f64 = real_literal 10e7 [template = constants.%.22] -// CHECK:STDOUT: %.loc23: f64 = real_literal 10e-9 [template = constants.%.23] -// CHECK:STDOUT: %.loc24: f64 = real_literal 399999999999999999930e39999999999999999992 [template = constants.%.24] +// CHECK:STDOUT: %.loc18: f64 = real_literal 9e-1 [template = constants.%.16] +// CHECK:STDOUT: %.loc19: f64 = real_literal 80e-1 [template = constants.%.17] +// CHECK:STDOUT: %.loc20: f64 = real_literal 800e-1 [template = constants.%.18] +// CHECK:STDOUT: %.loc21: f64 = real_literal 10e6 [template = constants.%.19] +// CHECK:STDOUT: %.loc22: f64 = real_literal 10e7 [template = constants.%.20] +// CHECK:STDOUT: %.loc23: f64 = real_literal 10e-9 [template = constants.%.21] +// CHECK:STDOUT: %.loc24: f64 = real_literal 399999999999999999930e39999999999999999992 [template = constants.%.22] // CHECK:STDOUT: %.loc25_3.1: (f64, f64, f64, f64, f64, f64, f64) = tuple_literal (%.loc18, %.loc19, %.loc20, %.loc21, %.loc22, %.loc23, %.loc24) -// CHECK:STDOUT: %.loc25_3.2: i32 = int_literal 0 [template = constants.%.26] +// CHECK:STDOUT: %.loc25_3.2: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: %.loc25_3.3: ref f64 = array_index %floats.var, %.loc25_3.2 // CHECK:STDOUT: %.loc25_3.4: init f64 = initialize_from %.loc18 to %.loc25_3.3 -// CHECK:STDOUT: %.loc25_3.5: i32 = int_literal 1 [template = constants.%.27] +// CHECK:STDOUT: %.loc25_3.5: i32 = int_literal 1 [template = constants.%.9] // CHECK:STDOUT: %.loc25_3.6: ref f64 = array_index %floats.var, %.loc25_3.5 // CHECK:STDOUT: %.loc25_3.7: init f64 = initialize_from %.loc19 to %.loc25_3.6 -// CHECK:STDOUT: %.loc25_3.8: i32 = int_literal 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc25_3.8: i32 = int_literal 2 [template = constants.%.10] // CHECK:STDOUT: %.loc25_3.9: ref f64 = array_index %floats.var, %.loc25_3.8 // CHECK:STDOUT: %.loc25_3.10: init f64 = initialize_from %.loc20 to %.loc25_3.9 -// CHECK:STDOUT: %.loc25_3.11: i32 = int_literal 3 [template = constants.%.29] +// CHECK:STDOUT: %.loc25_3.11: i32 = int_literal 3 [template = constants.%.11] // CHECK:STDOUT: %.loc25_3.12: ref f64 = array_index %floats.var, %.loc25_3.11 // CHECK:STDOUT: %.loc25_3.13: init f64 = initialize_from %.loc21 to %.loc25_3.12 -// CHECK:STDOUT: %.loc25_3.14: i32 = int_literal 4 [template = constants.%.30] +// CHECK:STDOUT: %.loc25_3.14: i32 = int_literal 4 [template = constants.%.12] // CHECK:STDOUT: %.loc25_3.15: ref f64 = array_index %floats.var, %.loc25_3.14 // CHECK:STDOUT: %.loc25_3.16: init f64 = initialize_from %.loc22 to %.loc25_3.15 -// CHECK:STDOUT: %.loc25_3.17: i32 = int_literal 5 [template = constants.%.31] +// CHECK:STDOUT: %.loc25_3.17: i32 = int_literal 5 [template = constants.%.24] // CHECK:STDOUT: %.loc25_3.18: ref f64 = array_index %floats.var, %.loc25_3.17 // CHECK:STDOUT: %.loc25_3.19: init f64 = initialize_from %.loc23 to %.loc25_3.18 -// CHECK:STDOUT: %.loc25_3.20: i32 = int_literal 6 [template = constants.%.32] +// CHECK:STDOUT: %.loc25_3.20: i32 = int_literal 6 [template = constants.%.25] // CHECK:STDOUT: %.loc25_3.21: ref f64 = array_index %floats.var, %.loc25_3.20 // CHECK:STDOUT: %.loc25_3.22: init f64 = initialize_from %.loc24 to %.loc25_3.21 // CHECK:STDOUT: %.loc25_3.23: init [f64; 7] = array_init (%.loc25_3.4, %.loc25_3.7, %.loc25_3.10, %.loc25_3.13, %.loc25_3.16, %.loc25_3.19, %.loc25_3.22) to %floats.var diff --git a/toolchain/check/testdata/class/base.carbon b/toolchain/check/testdata/class/base.carbon index 3e88e8edfd2f..85a80eaf4536 100644 --- a/toolchain/check/testdata/class/base.carbon +++ b/toolchain/check/testdata/class/base.carbon @@ -25,32 +25,37 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: --- base.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.b: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.b: i32} [template] -// CHECK:STDOUT: %.3: type = struct_type {.base: Base, .d: i32} [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: {.b: i32}*, .d: i32} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.base: {.b: i32}*, .d: i32} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.base: Base, .d: i32} [template] -// CHECK:STDOUT: %.7: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.8: i32 = int_literal 7 [template] -// CHECK:STDOUT: %.9: type = struct_type {.base: {.b: i32}, .d: i32} [template] -// CHECK:STDOUT: %.10: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.11: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.12: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %Base: type = class_type @Base [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.b: i32} [template] +// CHECK:STDOUT: %Derived: type = class_type @Derived [template] +// CHECK:STDOUT: %.3: type = ptr_type {.b: i32} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Derived, i32 [template] +// CHECK:STDOUT: %.6: type = struct_type {.base: Base, .d: i32} [template] +// CHECK:STDOUT: %.7: type = struct_type {.base: {.b: i32}*, .d: i32} [template] +// CHECK:STDOUT: %.8: type = ptr_type {.base: {.b: i32}*, .d: i32} [template] +// CHECK:STDOUT: %.9: type = ptr_type {.base: Base, .d: i32} [template] +// CHECK:STDOUT: %.10: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.11: i32 = int_literal 7 [template] +// CHECK:STDOUT: %.12: type = struct_type {.base: {.b: i32}, .d: i32} [template] +// CHECK:STDOUT: %.13: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.14: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.15: type = ptr_type (i32, i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Base = %Base.decl, .Derived = %Derived.decl, .Make = %Make, .Access = %Access} [template] // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base [template] +// CHECK:STDOUT: %Base: type = class_type @Base [template = constants.%Base] // CHECK:STDOUT: %Derived.decl = class_decl @Derived, () -// CHECK:STDOUT: %Derived: type = class_type @Derived [template] +// CHECK:STDOUT: %Derived: type = class_type @Derived [template = constants.%Derived] // CHECK:STDOUT: %Make: = fn_decl @Make [template] // CHECK:STDOUT: %Access: = fn_decl @Access [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl b, element0 [template] // CHECK:STDOUT: %b: = bind_name b, %.loc8_8.2 [template = %.loc8_8.2] // CHECK:STDOUT: @@ -59,10 +64,10 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base [template = file.%Base] -// CHECK:STDOUT: %.loc12_20.1: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base [template = constants.%Base] +// CHECK:STDOUT: %.loc12_20.1: type = unbound_element_type Derived, Base [template = constants.%.4] // CHECK:STDOUT: %.loc12_20.2: = base_decl Base, element0 [template] -// CHECK:STDOUT: %.loc14_8.1: type = unbound_element_type Derived, i32 [template] +// CHECK:STDOUT: %.loc14_8.1: type = unbound_element_type Derived, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc14_8.2: = field_decl d, element1 [template] // CHECK:STDOUT: %d: = bind_name d, %.loc14_8.2 [template = %.loc14_8.2] // CHECK:STDOUT: @@ -74,9 +79,9 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: Derived { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_25: i32 = int_literal 4 [template = constants.%.7] +// CHECK:STDOUT: %.loc18_25: i32 = int_literal 4 [template = constants.%.10] // CHECK:STDOUT: %.loc18_26.1: {.b: i32} = struct_literal (%.loc18_25) -// CHECK:STDOUT: %.loc18_34: i32 = int_literal 7 [template = constants.%.8] +// CHECK:STDOUT: %.loc18_34: i32 = int_literal 7 [template = constants.%.11] // CHECK:STDOUT: %.loc18_35.1: {.base: {.b: i32}, .d: i32} = struct_literal (%.loc18_26.1, %.loc18_34) // CHECK:STDOUT: %.loc18_35.2: ref Base = class_element_access %return, element0 // CHECK:STDOUT: %.loc18_26.2: ref i32 = class_element_access %.loc18_35.2, element0 diff --git a/toolchain/check/testdata/class/base_field.carbon b/toolchain/check/testdata/class/base_field.carbon index 8c1cf11adc9c..dd1eba24de8f 100644 --- a/toolchain/check/testdata/class/base_field.carbon +++ b/toolchain/check/testdata/class/base_field.carbon @@ -24,31 +24,38 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: --- base_field.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32, .c: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32, .c: i32} [template] -// CHECK:STDOUT: %.3: type = struct_type {.base: Base, .d: i32, .e: i32} [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.base: Base, .d: i32, .e: i32} [template] +// CHECK:STDOUT: %Base: type = class_type @Base [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32, .c: i32} [template] +// CHECK:STDOUT: %Derived: type = class_type @Derived [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32, .c: i32} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Derived, i32 [template] +// CHECK:STDOUT: %.6: type = struct_type {.base: Base, .d: i32, .e: i32} [template] +// CHECK:STDOUT: %.7: type = ptr_type Derived [template] +// CHECK:STDOUT: %.8: type = ptr_type i32 [template] +// CHECK:STDOUT: %.9: type = struct_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] +// CHECK:STDOUT: %.10: type = ptr_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} [template] +// CHECK:STDOUT: %.11: type = ptr_type {.base: Base, .d: i32, .e: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Base = %Base.decl, .Derived = %Derived.decl, .Access = %Access} [template] // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base [template] +// CHECK:STDOUT: %Base: type = class_type @Base [template = constants.%Base] // CHECK:STDOUT: %Derived.decl = class_decl @Derived, () -// CHECK:STDOUT: %Derived: type = class_type @Derived [template] +// CHECK:STDOUT: %Derived: type = class_type @Derived [template = constants.%Derived] // CHECK:STDOUT: %Access: = fn_decl @Access [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 [template = %.loc8_8.2] -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Base, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1 [template] // CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2 [template = %.loc9_8.2] -// CHECK:STDOUT: %.loc10_8.1: type = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.loc10_8.1: type = unbound_element_type Base, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc10_8.2: = field_decl c, element2 [template] // CHECK:STDOUT: %c: = bind_name c, %.loc10_8.2 [template = %.loc10_8.2] // CHECK:STDOUT: @@ -59,13 +66,13 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base [template = file.%Base] -// CHECK:STDOUT: %.loc14_20.1: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base [template = constants.%Base] +// CHECK:STDOUT: %.loc14_20.1: type = unbound_element_type Derived, Base [template = constants.%.4] // CHECK:STDOUT: %.loc14_20.2: = base_decl Base, element0 [template] -// CHECK:STDOUT: %.loc16_8.1: type = unbound_element_type Derived, i32 [template] +// CHECK:STDOUT: %.loc16_8.1: type = unbound_element_type Derived, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc16_8.2: = field_decl d, element1 [template] // CHECK:STDOUT: %d: = bind_name d, %.loc16_8.2 [template = %.loc16_8.2] -// CHECK:STDOUT: %.loc17_8.1: type = unbound_element_type Derived, i32 [template] +// CHECK:STDOUT: %.loc17_8.1: type = unbound_element_type Derived, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc17_8.2: = field_decl e, element2 [template] // CHECK:STDOUT: %e: = bind_name e, %.loc17_8.2 [template = %.loc17_8.2] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_function_unqualified.carbon b/toolchain/check/testdata/class/base_function_unqualified.carbon index d4ac039c3cda..0432be86ee59 100644 --- a/toolchain/check/testdata/class/base_function_unqualified.carbon +++ b/toolchain/check/testdata/class/base_function_unqualified.carbon @@ -22,18 +22,21 @@ fn Derived.H() { // CHECK:STDOUT: --- base_function_unqualified.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Base: type = class_type @Base [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %Derived: type = class_type @Derived [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: Base} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %.5: type = struct_type {.base: Base} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Base = %Base.decl, .Derived = %Derived.decl} [template] // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base [template] +// CHECK:STDOUT: %Base: type = class_type @Base [template = constants.%Base] // CHECK:STDOUT: %Derived.decl = class_decl @Derived, () -// CHECK:STDOUT: %Derived: type = class_type @Derived [template] +// CHECK:STDOUT: %Derived: type = class_type @Derived [template = constants.%Derived] // CHECK:STDOUT: %H: = fn_decl @H [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -45,8 +48,8 @@ fn Derived.H() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base [template = file.%Base] -// CHECK:STDOUT: %.loc12_20.1: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base [template = constants.%Base] +// CHECK:STDOUT: %.loc12_20.1: type = unbound_element_type Derived, Base [template = constants.%.4] // CHECK:STDOUT: %.loc12_20.2: = 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 cb84ba2b3c6a..50595b66e3ec 100644 --- a/toolchain/check/testdata/class/base_method.carbon +++ b/toolchain/check/testdata/class/base_method.carbon @@ -25,27 +25,33 @@ fn Call(p: Derived*) { // CHECK:STDOUT: --- base_method.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: Base} [template] -// CHECK:STDOUT: %.5: type = struct_type {.base: {.a: i32}*} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.base: Base} [template] -// CHECK:STDOUT: %.7: type = tuple_type () [template] +// CHECK:STDOUT: %Base: type = class_type @Base [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.2: type = ptr_type Base [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %Derived: type = class_type @Derived [template] +// CHECK:STDOUT: %.6: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %.7: type = struct_type {.base: Base} [template] +// CHECK:STDOUT: %.8: type = ptr_type Derived [template] +// CHECK:STDOUT: %.9: type = struct_type {.base: {.a: i32}*} [template] +// CHECK:STDOUT: %.10: type = ptr_type {.base: Base} [template] +// CHECK:STDOUT: %.11: type = tuple_type () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Base = %Base.decl, .Derived = %Derived.decl, .Call = %Call} [template] // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base [template] +// CHECK:STDOUT: %Base: type = class_type @Base [template = constants.%Base] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %Derived.decl = class_decl @Derived, () -// CHECK:STDOUT: %Derived: type = class_type @Derived [template] +// CHECK:STDOUT: %Derived: type = class_type @Derived [template = constants.%Derived] // CHECK:STDOUT: %Call: = fn_decl @Call [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 [template = %.loc8_8.2] // CHECK:STDOUT: %F: = fn_decl @F [template] @@ -56,8 +62,8 @@ fn Call(p: Derived*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base [template = file.%Base] -// CHECK:STDOUT: %.loc18_20.1: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base [template = constants.%Base] +// CHECK:STDOUT: %.loc18_20.1: type = unbound_element_type Derived, Base [template = constants.%.6] // CHECK:STDOUT: %.loc18_20.2: = base_decl Base, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -70,7 +76,7 @@ fn Call(p: Derived*) { // CHECK:STDOUT: %self.ref: Base* = name_ref self, %self // CHECK:STDOUT: %.loc14_4: ref Base = deref %self.ref // CHECK:STDOUT: %.loc14_10: ref i32 = class_element_access %.loc14_4, element0 -// CHECK:STDOUT: %.loc14_15: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_15: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: assign %.loc14_10, %.loc14_15 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/base_method_shadow.carbon b/toolchain/check/testdata/class/base_method_shadow.carbon index 5757abfa1f18..61c038e97138 100644 --- a/toolchain/check/testdata/class/base_method_shadow.carbon +++ b/toolchain/check/testdata/class/base_method_shadow.carbon @@ -32,27 +32,38 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: --- base_method_shadow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: A} [template] -// CHECK:STDOUT: %.5: type = struct_type {.base: {}*} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.base: A} [template] -// CHECK:STDOUT: %.7: type = struct_type {.base: B} [template] -// CHECK:STDOUT: %.8: type = struct_type {.base: {.base: A}*} [template] -// CHECK:STDOUT: %.9: type = ptr_type {.base: B} [template] +// CHECK:STDOUT: %A: type = class_type @A [template] +// CHECK:STDOUT: %.1: type = ptr_type A [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %.4: type = ptr_type {} [template] +// CHECK:STDOUT: %.5: type = unbound_element_type B, A [template] +// CHECK:STDOUT: %.6: type = ptr_type B [template] +// CHECK:STDOUT: %.7: type = struct_type {.base: A} [template] +// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %.8: type = struct_type {.base: {}*} [template] +// CHECK:STDOUT: %.9: type = ptr_type {.base: A} [template] +// CHECK:STDOUT: %.10: type = unbound_element_type C, B [template] +// CHECK:STDOUT: %.11: type = ptr_type C [template] +// CHECK:STDOUT: %.12: type = struct_type {.base: B} [template] +// CHECK:STDOUT: %D: type = class_type @D [template] +// CHECK:STDOUT: %.13: type = unbound_element_type D, B [template] +// CHECK:STDOUT: %.14: type = ptr_type D [template] +// CHECK:STDOUT: %.15: type = struct_type {.base: {.base: A}*} [template] +// CHECK:STDOUT: %.16: type = ptr_type {.base: B} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A.decl, .B = %B.decl, .C = %C.decl, .D = %D.decl, .Call = %Call} [template] // CHECK:STDOUT: %A.decl = class_decl @A, () -// CHECK:STDOUT: %A: type = class_type @A [template] +// CHECK:STDOUT: %A: type = class_type @A [template = constants.%A] // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %B: type = class_type @B [template = constants.%B] // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @C [template = constants.%C] // CHECK:STDOUT: %D.decl = class_decl @D, () -// CHECK:STDOUT: %D: type = class_type @D [template] +// CHECK:STDOUT: %D: type = class_type @D [template = constants.%D] // CHECK:STDOUT: %Call: = fn_decl @Call [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -64,8 +75,8 @@ 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, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc12_17.1: type = unbound_element_type B, A [template] +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A [template = constants.%A] +// CHECK:STDOUT: %.loc12_17.1: type = unbound_element_type B, A [template = constants.%.5] // CHECK:STDOUT: %.loc12_17.2: = base_decl A, element0 [template] // CHECK:STDOUT: %F: = fn_decl @F.2 [template] // CHECK:STDOUT: @@ -76,8 +87,8 @@ 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, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc17_17.1: type = unbound_element_type C, B [template] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = constants.%B] +// CHECK:STDOUT: %.loc17_17.1: type = unbound_element_type C, B [template = constants.%.10] // CHECK:STDOUT: %.loc17_17.2: = base_decl B, element0 [template] // CHECK:STDOUT: %F: = fn_decl @F.3 [template] // CHECK:STDOUT: @@ -88,8 +99,8 @@ 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, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc22_17.1: type = unbound_element_type D, B [template] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = constants.%B] +// CHECK:STDOUT: %.loc22_17.1: type = unbound_element_type D, B [template = constants.%.13] // CHECK:STDOUT: %.loc22_17.2: = 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 3600a1e8c1b4..60c023ce0cec 100644 --- a/toolchain/check/testdata/class/basic.carbon +++ b/toolchain/check/testdata/class/basic.carbon @@ -25,14 +25,16 @@ fn Run() -> i32 { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.k: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 4 [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.k: i32} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .Run = %Run} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: %Run: = fn_decl @Run [template] // CHECK:STDOUT: } @@ -40,7 +42,7 @@ fn Run() -> i32 { // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %.loc14_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc14_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc14_8.2: = field_decl k, element0 [template] // CHECK:STDOUT: %k: = bind_name k, %.loc14_8.2 [template = %.loc14_8.2] // CHECK:STDOUT: @@ -64,9 +66,9 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [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.%.2] +// CHECK:STDOUT: %.loc22_18: i32 = int_literal 4 [template = constants.%.3] // CHECK:STDOUT: %.loc22_17.1: init i32 = call %F.ref(%.loc22_18) // CHECK:STDOUT: %.loc22_20: i32 = value_of_initializer %.loc22_17.1 // CHECK:STDOUT: %.loc22_17.2: i32 = converted %.loc22_17.1, %.loc22_20 diff --git a/toolchain/check/testdata/class/derived_to_base.carbon b/toolchain/check/testdata/class/derived_to_base.carbon index 44cdd98f8e98..2ec6e119c519 100644 --- a/toolchain/check/testdata/class/derived_to_base.carbon +++ b/toolchain/check/testdata/class/derived_to_base.carbon @@ -37,31 +37,42 @@ fn ConvertInit() { // CHECK:STDOUT: --- derived_to_base.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.3: type = struct_type {.base: A, .b: i32} [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: {.a: i32}*, .b: i32} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.base: {.a: i32}*, .b: i32} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.base: A, .b: i32} [template] -// CHECK:STDOUT: %.7: type = struct_type {.base: B, .c: i32} [template] -// CHECK:STDOUT: %.8: type = struct_type {.base: {.base: A, .b: i32}*, .c: i32} [template] -// CHECK:STDOUT: %.9: type = ptr_type {.base: {.base: A, .b: i32}*, .c: i32} [template] -// CHECK:STDOUT: %.10: type = ptr_type {.base: B, .c: i32} [template] -// CHECK:STDOUT: %.11: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.12: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.13: type = struct_type {.base: {.a: i32}, .b: i32} [template] -// CHECK:STDOUT: %.14: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.15: type = struct_type {.base: {.base: {.a: i32}, .b: i32}, .c: i32} [template] +// CHECK:STDOUT: %A: type = class_type @A [template] +// CHECK:STDOUT: %.1: type = unbound_element_type A, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type B, A [template] +// CHECK:STDOUT: %.5: type = unbound_element_type B, i32 [template] +// CHECK:STDOUT: %.6: type = struct_type {.base: A, .b: i32} [template] +// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %.7: type = struct_type {.base: {.a: i32}*, .b: i32} [template] +// CHECK:STDOUT: %.8: type = ptr_type {.base: {.a: i32}*, .b: i32} [template] +// CHECK:STDOUT: %.9: type = ptr_type {.base: A, .b: i32} [template] +// CHECK:STDOUT: %.10: type = unbound_element_type C, B [template] +// CHECK:STDOUT: %.11: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.12: type = struct_type {.base: B, .c: i32} [template] +// CHECK:STDOUT: %.13: type = ptr_type C [template] +// CHECK:STDOUT: %.14: type = ptr_type B [template] +// CHECK:STDOUT: %.15: type = struct_type {.base: {.base: A, .b: i32}*, .c: i32} [template] +// CHECK:STDOUT: %.16: type = ptr_type {.base: {.base: A, .b: i32}*, .c: i32} [template] +// CHECK:STDOUT: %.17: type = ptr_type {.base: B, .c: i32} [template] +// CHECK:STDOUT: %.18: type = ptr_type A [template] +// CHECK:STDOUT: %.19: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.20: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.21: type = struct_type {.base: {.a: i32}, .b: i32} [template] +// CHECK:STDOUT: %.22: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.23: type = struct_type {.base: {.base: {.a: i32}, .b: i32}, .c: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.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: %A: type = class_type @A [template] +// CHECK:STDOUT: %A: type = class_type @A [template = constants.%A] // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %B: type = class_type @B [template = constants.%B] // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @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] @@ -71,7 +82,7 @@ fn ConvertInit() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type A, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type A, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 [template = %.loc8_8.2] // CHECK:STDOUT: @@ -80,10 +91,10 @@ fn ConvertInit() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc12_17.1: type = unbound_element_type B, A [template] +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A [template = constants.%A] +// CHECK:STDOUT: %.loc12_17.1: type = unbound_element_type B, A [template = constants.%.4] // CHECK:STDOUT: %.loc12_17.2: = base_decl A, element0 [template] -// CHECK:STDOUT: %.loc13_8.1: type = unbound_element_type B, i32 [template] +// CHECK:STDOUT: %.loc13_8.1: type = unbound_element_type B, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc13_8.2: = field_decl b, element1 [template] // CHECK:STDOUT: %b: = bind_name b, %.loc13_8.2 [template = %.loc13_8.2] // CHECK:STDOUT: @@ -94,10 +105,10 @@ fn ConvertInit() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc17_17.1: type = unbound_element_type C, B [template] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = constants.%B] +// CHECK:STDOUT: %.loc17_17.1: type = unbound_element_type C, B [template = constants.%.10] // CHECK:STDOUT: %.loc17_17.2: = base_decl B, element0 [template] -// CHECK:STDOUT: %.loc18_8.1: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.loc18_8.1: type = unbound_element_type C, i32 [template = constants.%.11] // CHECK:STDOUT: %.loc18_8.2: = field_decl c, element1 [template] // CHECK:STDOUT: %c: = bind_name c, %.loc18_8.2 [template = %.loc18_8.2] // CHECK:STDOUT: @@ -140,7 +151,7 @@ fn ConvertInit() { // CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertValue(%c: C) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A [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 @@ -154,7 +165,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, file.%A [template = file.%A] +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A [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 @@ -164,14 +175,14 @@ fn ConvertInit() { // CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertInit() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc34_38: i32 = int_literal 1 [template = constants.%.11] +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A [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.%.12] +// 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.%.14] +// 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, file.%C [template = file.%C] +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C [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 457995167fa6..f5d2baaac674 100644 --- a/toolchain/check/testdata/class/fail_abstract.carbon +++ b/toolchain/check/testdata/class/fail_abstract.carbon @@ -29,32 +29,37 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: --- fail_abstract.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.3: type = struct_type {.base: Abstract, .d: i32} [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: {.a: i32}*, .d: i32} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.base: {.a: i32}*, .d: i32} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.base: Abstract, .d: i32} [template] -// CHECK:STDOUT: %.7: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.8: i32 = int_literal 7 [template] -// CHECK:STDOUT: %.9: type = struct_type {.base: {.a: i32}, .d: i32} [template] -// CHECK:STDOUT: %.10: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.11: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.12: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %Abstract: type = class_type @Abstract [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Abstract, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %Derived: type = class_type @Derived [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type Derived, Abstract [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Derived, i32 [template] +// CHECK:STDOUT: %.6: type = struct_type {.base: Abstract, .d: i32} [template] +// CHECK:STDOUT: %.7: type = struct_type {.base: {.a: i32}*, .d: i32} [template] +// CHECK:STDOUT: %.8: type = ptr_type {.base: {.a: i32}*, .d: i32} [template] +// CHECK:STDOUT: %.9: type = ptr_type {.base: Abstract, .d: i32} [template] +// CHECK:STDOUT: %.10: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.11: i32 = int_literal 7 [template] +// CHECK:STDOUT: %.12: type = struct_type {.base: {.a: i32}, .d: i32} [template] +// CHECK:STDOUT: %.13: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.14: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.15: type = ptr_type (i32, i32) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Abstract = %Abstract.decl, .Derived = %Derived.decl, .Make = %Make, .Access = %Access} [template] // CHECK:STDOUT: %Abstract.decl = class_decl @Abstract, () -// CHECK:STDOUT: %Abstract: type = class_type @Abstract [template] +// CHECK:STDOUT: %Abstract: type = class_type @Abstract [template = constants.%Abstract] // CHECK:STDOUT: %Derived.decl = class_decl @Derived, () -// CHECK:STDOUT: %Derived: type = class_type @Derived [template] +// CHECK:STDOUT: %Derived: type = class_type @Derived [template = constants.%Derived] // CHECK:STDOUT: %Make: = fn_decl @Make [template] // CHECK:STDOUT: %Access: = fn_decl @Access [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Abstract { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Abstract, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Abstract, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 [template = %.loc8_8.2] // CHECK:STDOUT: @@ -63,10 +68,10 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract [template = file.%Abstract] -// CHECK:STDOUT: %.loc12_24.1: type = unbound_element_type Derived, Abstract [template] +// CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract [template = constants.%Abstract] +// CHECK:STDOUT: %.loc12_24.1: type = unbound_element_type Derived, Abstract [template = constants.%.4] // CHECK:STDOUT: %.loc12_24.2: = base_decl Abstract, element0 [template] -// CHECK:STDOUT: %.loc14_8.1: type = unbound_element_type Derived, i32 [template] +// CHECK:STDOUT: %.loc14_8.1: type = unbound_element_type Derived, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc14_8.2: = field_decl d, element1 [template] // CHECK:STDOUT: %d: = bind_name d, %.loc14_8.2 [template = %.loc14_8.2] // CHECK:STDOUT: @@ -78,9 +83,9 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: Derived { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 [template = constants.%.7] +// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 [template = constants.%.10] // CHECK:STDOUT: %.loc22_26: {.a: i32} = struct_literal (%.loc22_25) -// CHECK:STDOUT: %.loc22_34: i32 = int_literal 7 [template = constants.%.8] +// CHECK:STDOUT: %.loc22_34: i32 = int_literal 7 [template = constants.%.11] // CHECK:STDOUT: %.loc22_35: {.base: {.a: i32}, .d: i32} = struct_literal (%.loc22_26, %.loc22_34) // CHECK:STDOUT: return // 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 42fd0d454b8f..b72b3bd99c69 100644 --- a/toolchain/check/testdata/class/fail_addr_not_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_not_self.carbon @@ -19,13 +19,15 @@ class Class { // CHECK:STDOUT: --- fail_addr_not_self.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = ptr_type Class [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @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 138ed237ee6c..4a71063cfb20 100644 --- a/toolchain/check/testdata/class/fail_addr_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_self.carbon @@ -41,15 +41,17 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: --- fail_addr_self.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %.3: type = ptr_type {} [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = ptr_type Class [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %.4: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .F = %F} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @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 25130b6e98ab..a9a4dca5d0b8 100644 --- a/toolchain/check/testdata/class/fail_base_bad_type.carbon +++ b/toolchain/check/testdata/class/fail_base_bad_type.carbon @@ -120,55 +120,85 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: --- fail_base_bad_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Base: type = class_type @Base [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.3: type = struct_type {.base: } [template] -// CHECK:STDOUT: %.4: type = ptr_type {.base: } [template] -// CHECK:STDOUT: %.5: i32 = int_literal 32 [template] -// CHECK:STDOUT: %.6: type = tuple_type (type) [template] -// CHECK:STDOUT: %.7: type = tuple_type (Base) [template] -// CHECK:STDOUT: %.8: type = tuple_type () [template] -// CHECK:STDOUT: %.9: type = ptr_type {} [template] -// CHECK:STDOUT: %.10: type = tuple_type ({}*) [template] -// CHECK:STDOUT: %.11: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.12: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.13: type = struct_type {.base: Final} [template] -// CHECK:STDOUT: %.14: type = struct_type {.base: {.a: i32}*} [template] -// CHECK:STDOUT: %.15: type = ptr_type {.base: Final} [template] +// CHECK:STDOUT: %Final: type = class_type @Final [template] +// CHECK:STDOUT: %.2: type = unbound_element_type Final, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %DeriveFromError: type = class_type @DeriveFromError [template] +// CHECK:STDOUT: %.4: type = unbound_element_type DeriveFromError, [template] +// CHECK:STDOUT: %.5: type = struct_type {.base: } [template] +// CHECK:STDOUT: %.6: type = ptr_type DeriveFromError [template] +// CHECK:STDOUT: %.7: type = ptr_type {.base: } [template] +// CHECK:STDOUT: %DeriveFromNonType: type = class_type @DeriveFromNonType [template] +// CHECK:STDOUT: %.8: i32 = int_literal 32 [template] +// CHECK:STDOUT: %.9: type = unbound_element_type DeriveFromNonType, [template] +// CHECK:STDOUT: %.10: type = ptr_type DeriveFromNonType [template] +// CHECK:STDOUT: %DeriveFromi32: type = class_type @DeriveFromi32 [template] +// CHECK:STDOUT: %.11: type = unbound_element_type DeriveFromi32, [template] +// CHECK:STDOUT: %.12: type = ptr_type DeriveFromi32 [template] +// CHECK:STDOUT: %.13: type = ptr_type i32 [template] +// CHECK:STDOUT: %DeriveFromTuple: type = class_type @DeriveFromTuple [template] +// CHECK:STDOUT: %.14: type = tuple_type (type) [template] +// CHECK:STDOUT: %.15: type = tuple_type (Base) [template] +// CHECK:STDOUT: %.16: type = tuple_type () [template] +// CHECK:STDOUT: %.17: type = ptr_type {} [template] +// CHECK:STDOUT: %.18: type = tuple_type ({}*) [template] +// CHECK:STDOUT: %.19: type = unbound_element_type DeriveFromTuple, [template] +// CHECK:STDOUT: %.20: type = ptr_type DeriveFromTuple [template] +// CHECK:STDOUT: %.21: type = ptr_type (Base,) [template] +// CHECK:STDOUT: %DeriveFromStruct: type = class_type @DeriveFromStruct [template] +// CHECK:STDOUT: %.22: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.23: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.24: type = unbound_element_type DeriveFromStruct, [template] +// CHECK:STDOUT: %.25: type = ptr_type DeriveFromStruct [template] +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] +// CHECK:STDOUT: %DeriveFromIncomplete: type = class_type @DeriveFromIncomplete [template] +// CHECK:STDOUT: %.26: type = unbound_element_type DeriveFromIncomplete, [template] +// CHECK:STDOUT: %.27: type = ptr_type DeriveFromIncomplete [template] +// CHECK:STDOUT: %.28: type = ptr_type Incomplete [template] +// CHECK:STDOUT: %DeriveFromFinal: type = class_type @DeriveFromFinal [template] +// CHECK:STDOUT: %.29: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.30: type = unbound_element_type DeriveFromFinal, Final [template] +// CHECK:STDOUT: %.31: type = struct_type {.base: Final} [template] +// CHECK:STDOUT: %.32: type = ptr_type DeriveFromFinal [template] +// CHECK:STDOUT: %.33: type = ptr_type Final [template] +// CHECK:STDOUT: %.34: type = struct_type {.base: {.a: i32}*} [template] +// CHECK:STDOUT: %.35: type = ptr_type {.base: Final} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.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: %Base: type = class_type @Base [template] +// CHECK:STDOUT: %Base: type = class_type @Base [template = constants.%Base] // CHECK:STDOUT: %Final.decl = class_decl @Final, () -// CHECK:STDOUT: %Final: type = class_type @Final [template] +// CHECK:STDOUT: %Final: type = class_type @Final [template = constants.%Final] // CHECK:STDOUT: %DeriveFromError.decl = class_decl @DeriveFromError, () -// CHECK:STDOUT: %DeriveFromError: type = class_type @DeriveFromError [template] +// CHECK:STDOUT: %DeriveFromError: type = class_type @DeriveFromError [template = constants.%DeriveFromError] // CHECK:STDOUT: %AccessMemberWithInvalidBaseError: = fn_decl @AccessMemberWithInvalidBaseError [template] // CHECK:STDOUT: %DeriveFromNonType.decl = class_decl @DeriveFromNonType, () -// CHECK:STDOUT: %DeriveFromNonType: type = class_type @DeriveFromNonType [template] +// CHECK:STDOUT: %DeriveFromNonType: type = class_type @DeriveFromNonType [template = constants.%DeriveFromNonType] // CHECK:STDOUT: %AccessMemberWithInvalidBasNonType: = fn_decl @AccessMemberWithInvalidBasNonType [template] // CHECK:STDOUT: %DeriveFromi32.decl = class_decl @DeriveFromi32, () -// CHECK:STDOUT: %DeriveFromi32: type = class_type @DeriveFromi32 [template] +// CHECK:STDOUT: %DeriveFromi32: type = class_type @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: type = class_type @DeriveFromTuple [template] +// CHECK:STDOUT: %DeriveFromTuple: type = class_type @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: type = class_type @DeriveFromStruct [template] +// CHECK:STDOUT: %DeriveFromStruct: type = class_type @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: %Incomplete: type = class_type @Incomplete [template] +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template = constants.%Incomplete] // CHECK:STDOUT: %DeriveFromIncomplete.decl = class_decl @DeriveFromIncomplete, () -// CHECK:STDOUT: %DeriveFromIncomplete: type = class_type @DeriveFromIncomplete [template] +// CHECK:STDOUT: %DeriveFromIncomplete: type = class_type @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: type = class_type @DeriveFromFinal [template] +// CHECK:STDOUT: %DeriveFromFinal: type = class_type @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] @@ -180,7 +210,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Final { -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Final, i32 [template] +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Final, i32 [template = constants.%.2] // CHECK:STDOUT: %.loc9_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc9_8.2 [template = %.loc9_8.2] // CHECK:STDOUT: @@ -190,7 +220,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromError { // CHECK:STDOUT: %error.ref: = name_ref error, -// CHECK:STDOUT: %.loc16_21.1: type = unbound_element_type DeriveFromError, [template] +// CHECK:STDOUT: %.loc16_21.1: type = unbound_element_type DeriveFromError, [template = constants.%.4] // CHECK:STDOUT: %.loc16_21.2: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -199,8 +229,8 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromNonType { -// CHECK:STDOUT: %.loc26_16: i32 = int_literal 32 [template = constants.%.5] -// CHECK:STDOUT: %.loc26_18.1: type = unbound_element_type DeriveFromNonType, [template] +// CHECK:STDOUT: %.loc26_16: i32 = int_literal 32 [template = constants.%.8] +// CHECK:STDOUT: %.loc26_18.1: type = unbound_element_type DeriveFromNonType, [template = constants.%.9] // CHECK:STDOUT: %.loc26_18.2: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -209,7 +239,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromi32 { -// CHECK:STDOUT: %.loc35_19.1: type = unbound_element_type DeriveFromi32, [template] +// CHECK:STDOUT: %.loc35_19.1: type = unbound_element_type DeriveFromi32, [template = constants.%.11] // CHECK:STDOUT: %.loc35_19.2: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -218,10 +248,10 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromTuple { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base [template = file.%Base] +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base [template = constants.%Base] // CHECK:STDOUT: %.loc51_22.1: (type,) = tuple_literal (%Base.ref) -// CHECK:STDOUT: %.loc51_22.2: type = converted %.loc51_22.1, constants.%.7 [template = constants.%.7] -// CHECK:STDOUT: %.loc51_23.1: type = unbound_element_type DeriveFromTuple, [template] +// CHECK:STDOUT: %.loc51_22.2: type = converted %.loc51_22.1, constants.%.15 [template = constants.%.15] +// CHECK:STDOUT: %.loc51_23.1: type = unbound_element_type DeriveFromTuple, [template = constants.%.19] // CHECK:STDOUT: %.loc51_23.2: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -230,8 +260,8 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromStruct { -// CHECK:STDOUT: %.loc67_33: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.loc67_34.1: type = unbound_element_type DeriveFromStruct, [template] +// CHECK:STDOUT: %.loc67_33: type = struct_type {.a: i32, .b: i32} [template = constants.%.22] +// CHECK:STDOUT: %.loc67_34.1: type = unbound_element_type DeriveFromStruct, [template = constants.%.24] // CHECK:STDOUT: %.loc67_34.2: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -242,8 +272,8 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: class @Incomplete; // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromIncomplete { -// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete [template = file.%Incomplete] -// CHECK:STDOUT: %.loc87_26.1: type = unbound_element_type DeriveFromIncomplete, [template] +// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %.loc87_26.1: type = unbound_element_type DeriveFromIncomplete, [template = constants.%.26] // CHECK:STDOUT: %.loc87_26.2: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -252,8 +282,8 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromFinal { -// CHECK:STDOUT: %Final.ref: type = name_ref Final, file.%Final [template = file.%Final] -// CHECK:STDOUT: %.loc101_21.1: type = unbound_element_type DeriveFromFinal, Final [template] +// CHECK:STDOUT: %Final.ref: type = name_ref Final, file.%Final [template = constants.%Final] +// CHECK:STDOUT: %.loc101_21.1: type = unbound_element_type DeriveFromFinal, Final [template = constants.%.30] // CHECK:STDOUT: %.loc101_21.2: = 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 aa9069719a33..2766bd8c5ab0 100644 --- a/toolchain/check/testdata/class/fail_base_method_define.carbon +++ b/toolchain/check/testdata/class/fail_base_method_define.carbon @@ -29,18 +29,22 @@ fn D.C.F() {} // CHECK:STDOUT: --- fail_base_method_define.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: B} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type D, B [template] +// CHECK:STDOUT: %.5: type = struct_type {.base: B} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B = %B.decl, .D = %D.decl} [template] // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %B: type = class_type @B [template = constants.%B] // CHECK:STDOUT: %D.decl = class_decl @D, () -// CHECK:STDOUT: %D: type = class_type @D [template] +// CHECK:STDOUT: %D: type = class_type @D [template = constants.%D] // CHECK:STDOUT: %F: = fn_decl @F.3 [template] // CHECK:STDOUT: %.loc27: = fn_decl @.1 [template] // CHECK:STDOUT: } @@ -48,7 +52,7 @@ fn D.C.F() {} // CHECK:STDOUT: class @B { // CHECK:STDOUT: %F: = fn_decl @F.1 [template] // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @C [template = constants.%C] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -63,8 +67,8 @@ fn D.C.F() {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc16_17.1: type = unbound_element_type D, B [template] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = constants.%B] +// CHECK:STDOUT: %.loc16_17.1: type = unbound_element_type D, B [template = constants.%.4] // CHECK:STDOUT: %.loc16_17.2: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/fail_base_misplaced.carbon b/toolchain/check/testdata/class/fail_base_misplaced.carbon index 7c7b04a7716a..1f6366f197ad 100644 --- a/toolchain/check/testdata/class/fail_base_misplaced.carbon +++ b/toolchain/check/testdata/class/fail_base_misplaced.carbon @@ -24,6 +24,7 @@ fn F() { // CHECK:STDOUT: --- fail_base_misplaced.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_base_modifiers.carbon b/toolchain/check/testdata/class/fail_base_modifiers.carbon index 576199f43771..b67b1ca4d101 100644 --- a/toolchain/check/testdata/class/fail_base_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_base_modifiers.carbon @@ -46,24 +46,33 @@ class C4 { // CHECK:STDOUT: --- fail_base_modifiers.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %C1: type = class_type @C1 [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: B} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type C1, B [template] +// CHECK:STDOUT: %.5: type = struct_type {.base: B} [template] +// CHECK:STDOUT: %C2: type = class_type @C2 [template] +// CHECK:STDOUT: %.6: type = unbound_element_type C2, B [template] +// CHECK:STDOUT: %C3: type = class_type @C3 [template] +// CHECK:STDOUT: %.7: type = unbound_element_type C3, B [template] +// CHECK:STDOUT: %C4: type = class_type @C4 [template] +// CHECK:STDOUT: %.8: type = unbound_element_type C4, B [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.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: %B: type = class_type @B [template] +// CHECK:STDOUT: %B: type = class_type @B [template = constants.%B] // CHECK:STDOUT: %C1.decl = class_decl @C1, () -// CHECK:STDOUT: %C1: type = class_type @C1 [template] +// CHECK:STDOUT: %C1: type = class_type @C1 [template = constants.%C1] // CHECK:STDOUT: %C2.decl = class_decl @C2, () -// CHECK:STDOUT: %C2: type = class_type @C2 [template] +// CHECK:STDOUT: %C2: type = class_type @C2 [template = constants.%C2] // CHECK:STDOUT: %C3.decl = class_decl @C3, () -// CHECK:STDOUT: %C3: type = class_type @C3 [template] +// CHECK:STDOUT: %C3: type = class_type @C3 [template = constants.%C3] // CHECK:STDOUT: %C4.decl = class_decl @C4, () -// CHECK:STDOUT: %C4: type = class_type @C4 [template] +// CHECK:STDOUT: %C4: type = class_type @C4 [template = constants.%C4] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { @@ -72,8 +81,8 @@ class C4 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C1 { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc13_25.1: type = unbound_element_type C1, B [template] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = constants.%B] +// CHECK:STDOUT: %.loc13_25.1: type = unbound_element_type C1, B [template = constants.%.4] // CHECK:STDOUT: %.loc13_25.2: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -82,8 +91,8 @@ class C4 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C2 { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc23_19.1: type = unbound_element_type C2, B [template] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = constants.%B] +// CHECK:STDOUT: %.loc23_19.1: type = unbound_element_type C2, B [template = constants.%.6] // CHECK:STDOUT: %.loc23_19.2: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -91,8 +100,8 @@ class C4 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C3 { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc33_25.1: type = unbound_element_type C3, B [template] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = constants.%B] +// CHECK:STDOUT: %.loc33_25.1: type = unbound_element_type C3, B [template = constants.%.7] // CHECK:STDOUT: %.loc33_25.2: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -101,8 +110,8 @@ class C4 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C4 { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc43_24.1: type = unbound_element_type C4, B [template] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = constants.%B] +// CHECK:STDOUT: %.loc43_24.1: type = unbound_element_type C4, B [template = constants.%.8] // CHECK:STDOUT: %.loc43_24.2: = 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 a507fc96f648..c7b13be2bd04 100644 --- a/toolchain/check/testdata/class/fail_base_no_extend.carbon +++ b/toolchain/check/testdata/class/fail_base_no_extend.carbon @@ -16,18 +16,21 @@ class C { // CHECK:STDOUT: --- fail_base_no_extend.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: B} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type C, B [template] +// CHECK:STDOUT: %.5: type = struct_type {.base: B} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B = %B.decl, .C = %C.decl} [template] // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %B: type = class_type @B [template = constants.%B] // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @C [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { @@ -36,8 +39,8 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc13_10.1: type = unbound_element_type C, B [template] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = constants.%B] +// CHECK:STDOUT: %.loc13_10.1: type = unbound_element_type C, B [template = constants.%.4] // CHECK:STDOUT: %.loc13_10.2: = 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 bd75efb09217..1853aef68436 100644 --- a/toolchain/check/testdata/class/fail_base_repeated.carbon +++ b/toolchain/check/testdata/class/fail_base_repeated.carbon @@ -33,22 +33,28 @@ class D { // CHECK:STDOUT: --- fail_base_repeated.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %B1: type = class_type @B1 [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %B2: type = class_type @B2 [template] +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: B1} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type C, B1 [template] +// CHECK:STDOUT: %.5: type = struct_type {.base: B1} [template] +// CHECK:STDOUT: %D: type = class_type @D [template] +// CHECK:STDOUT: %.6: type = unbound_element_type D, B1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B1 = %B1.decl, .B2 = %B2.decl, .C = %C.decl, .D = %D.decl} [template] // CHECK:STDOUT: %B1.decl = class_decl @B1, () -// CHECK:STDOUT: %B1: type = class_type @B1 [template] +// CHECK:STDOUT: %B1: type = class_type @B1 [template = constants.%B1] // CHECK:STDOUT: %B2.decl = class_decl @B2, () -// CHECK:STDOUT: %B2: type = class_type @B2 [template] +// CHECK:STDOUT: %B2: type = class_type @B2 [template = constants.%B2] // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @C [template = constants.%C] // CHECK:STDOUT: %D.decl = class_decl @D, () -// CHECK:STDOUT: %D: type = class_type @D [template] +// CHECK:STDOUT: %D: type = class_type @D [template = constants.%D] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B1 { @@ -62,10 +68,10 @@ class D { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B1.ref: type = name_ref B1, file.%B1 [template = file.%B1] -// CHECK:STDOUT: %.loc11_18.1: type = unbound_element_type C, B1 [template] +// CHECK:STDOUT: %B1.ref: type = name_ref B1, file.%B1 [template = constants.%B1] +// CHECK:STDOUT: %.loc11_18.1: type = unbound_element_type C, B1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_18.2: = base_decl B1, element0 [template] -// CHECK:STDOUT: %B2.ref: type = name_ref B2, file.%B2 [template = file.%B2] +// CHECK:STDOUT: %B2.ref: type = name_ref B2, file.%B2 [template = constants.%B2] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc11_18.2 @@ -73,10 +79,10 @@ class D { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { -// CHECK:STDOUT: %B1.ref.loc23: type = name_ref B1, file.%B1 [template = file.%B1] -// CHECK:STDOUT: %.loc23_18.1: type = unbound_element_type D, B1 [template] +// CHECK:STDOUT: %B1.ref.loc23: type = name_ref B1, file.%B1 [template = constants.%B1] +// CHECK:STDOUT: %.loc23_18.1: type = unbound_element_type D, B1 [template = constants.%.6] // CHECK:STDOUT: %.loc23_18.2: = base_decl B1, element0 [template] -// CHECK:STDOUT: %B1.ref.loc30: type = name_ref B1, file.%B1 [template = file.%B1] +// CHECK:STDOUT: %B1.ref.loc30: type = name_ref B1, file.%B1 [template = constants.%B1] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc23_18.2 diff --git a/toolchain/check/testdata/class/fail_base_unbound.carbon b/toolchain/check/testdata/class/fail_base_unbound.carbon index d6f95dac5d10..433389f407aa 100644 --- a/toolchain/check/testdata/class/fail_base_unbound.carbon +++ b/toolchain/check/testdata/class/fail_base_unbound.carbon @@ -18,20 +18,23 @@ let b: B = C.base; // CHECK:STDOUT: --- fail_base_unbound.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: B} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type C, B [template] +// CHECK:STDOUT: %.5: type = struct_type {.base: B} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B = %B.decl, .C = %C.decl} [template] // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %B: type = class_type @B [template = constants.%B] // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %B.ref: type = name_ref B, %B [template = %B] -// CHECK:STDOUT: %C.ref: type = name_ref C, %C [template = %C] +// CHECK:STDOUT: %C: type = class_type @C [template = constants.%C] +// CHECK:STDOUT: %B.ref: type = name_ref B, %B [template = constants.%B] +// CHECK:STDOUT: %C.ref: type = name_ref C, %C [template = constants.%C] // CHECK:STDOUT: %base.ref: = name_ref base, @C.%.loc10_17.2 [template = @C.%.loc10_17.2] // CHECK:STDOUT: %b: B = bind_name b, // CHECK:STDOUT: } @@ -42,8 +45,8 @@ let b: B = C.base; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = file.%B] -// CHECK:STDOUT: %.loc10_17.1: type = unbound_element_type C, B [template] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B [template = constants.%B] +// CHECK:STDOUT: %.loc10_17.1: type = unbound_element_type C, B [template = constants.%.4] // CHECK:STDOUT: %.loc10_17.2: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/fail_derived_to_base.carbon b/toolchain/check/testdata/class/fail_derived_to_base.carbon index bf11012d25a5..ad5f8db76f99 100644 --- a/toolchain/check/testdata/class/fail_derived_to_base.carbon +++ b/toolchain/check/testdata/class/fail_derived_to_base.carbon @@ -32,30 +32,42 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: --- fail_derived_to_base.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.3: type = struct_type {.base: A2, .b: i32} [template] -// CHECK:STDOUT: %.4: type = struct_type {.base: {.a: i32}*, .b: i32} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.base: {.a: i32}*, .b: i32} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.base: A2, .b: i32} [template] +// CHECK:STDOUT: %A1: type = class_type @A1 [template] +// CHECK:STDOUT: %.1: type = unbound_element_type A1, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %A2: type = class_type @A2 [template] +// CHECK:STDOUT: %.3: type = unbound_element_type A2, i32 [template] +// CHECK:STDOUT: %B2: type = class_type @B2 [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.5: type = unbound_element_type B2, A2 [template] +// CHECK:STDOUT: %.6: type = unbound_element_type B2, i32 [template] +// CHECK:STDOUT: %.7: type = struct_type {.base: A2, .b: i32} [template] +// CHECK:STDOUT: %.8: type = ptr_type B2 [template] +// CHECK:STDOUT: %.9: type = ptr_type A1 [template] +// CHECK:STDOUT: %.10: type = struct_type {.base: {.a: i32}*, .b: i32} [template] +// CHECK:STDOUT: %.11: type = ptr_type {.base: {.a: i32}*, .b: i32} [template] +// CHECK:STDOUT: %.12: type = ptr_type {.base: A2, .b: i32} [template] +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] +// CHECK:STDOUT: %.13: type = ptr_type Incomplete [template] +// CHECK:STDOUT: %.14: type = ptr_type A2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.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: %A1: type = class_type @A1 [template] +// CHECK:STDOUT: %A1: type = class_type @A1 [template = constants.%A1] // CHECK:STDOUT: %A2.decl = class_decl @A2, () -// CHECK:STDOUT: %A2: type = class_type @A2 [template] +// CHECK:STDOUT: %A2: type = class_type @A2 [template = constants.%A2] // CHECK:STDOUT: %B2.decl = class_decl @B2, () -// CHECK:STDOUT: %B2: type = class_type @B2 [template] +// CHECK:STDOUT: %B2: type = class_type @B2 [template = constants.%B2] // CHECK:STDOUT: %ConvertUnrelated: = fn_decl @ConvertUnrelated [template] // CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template = constants.%Incomplete] // CHECK:STDOUT: %ConvertIncomplete: = fn_decl @ConvertIncomplete [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A1 { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type A1, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type A1, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 [template = %.loc8_8.2] // CHECK:STDOUT: @@ -64,7 +76,7 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A2 { -// CHECK:STDOUT: %.loc12_8.1: type = unbound_element_type A2, i32 [template] +// CHECK:STDOUT: %.loc12_8.1: type = unbound_element_type A2, i32 [template = constants.%.3] // CHECK:STDOUT: %.loc12_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc12_8.2 [template = %.loc12_8.2] // CHECK:STDOUT: @@ -73,10 +85,10 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B2 { -// CHECK:STDOUT: %A2.ref: type = name_ref A2, file.%A2 [template = file.%A2] -// CHECK:STDOUT: %.loc16_18.1: type = unbound_element_type B2, A2 [template] +// CHECK:STDOUT: %A2.ref: type = name_ref A2, file.%A2 [template = constants.%A2] +// CHECK:STDOUT: %.loc16_18.1: type = unbound_element_type B2, A2 [template = constants.%.5] // CHECK:STDOUT: %.loc16_18.2: = base_decl A2, element0 [template] -// CHECK:STDOUT: %.loc17_8.1: type = unbound_element_type B2, i32 [template] +// CHECK:STDOUT: %.loc17_8.1: type = unbound_element_type B2, i32 [template = constants.%.6] // CHECK:STDOUT: %.loc17_8.2: = field_decl b, element1 [template] // CHECK:STDOUT: %b: = bind_name b, %.loc17_8.2 [template = %.loc17_8.2] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_field_modifiers.carbon b/toolchain/check/testdata/class/fail_field_modifiers.carbon index 87ea65069773..a208e68616ad 100644 --- a/toolchain/check/testdata/class/fail_field_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_field_modifiers.carbon @@ -30,28 +30,30 @@ class Class { // CHECK:STDOUT: --- fail_field_modifiers.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: type = struct_type {.j: i32, .k: i32} [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: type = struct_type {.j: i32, .k: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc12_16.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc12_16.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc12_16.2: = field_decl j, element0 [template] // CHECK:STDOUT: %j: = bind_name j, %.loc12_16.2 [template = %.loc12_16.2] -// CHECK:STDOUT: %.loc17_14.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc17_14.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc17_14.2: = field_decl k, element1 [template] // CHECK:STDOUT: %k: = bind_name k, %.loc17_14.2 [template = %.loc17_14.2] -// CHECK:STDOUT: %.loc22: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %l: i32 = bind_name l, %.loc22 [template = constants.%.1] -// CHECK:STDOUT: %.loc27: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %m: i32 = bind_name m, %.loc27 [template = constants.%.2] +// CHECK:STDOUT: %.loc22: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %l: i32 = bind_name l, %.loc22 [template = constants.%.2] +// CHECK:STDOUT: %.loc27: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %m: i32 = bind_name m, %.loc27 [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .j = %j diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index 882c49dbb629..329a0c39d52f 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -118,17 +118,19 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: --- fail_incomplete.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] +// CHECK:STDOUT: %.2: type = ptr_type Class [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.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: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %.loc15: = fn_decl @.1 [template] // CHECK:STDOUT: %CallClassFunction: = fn_decl @CallClassFunction [template] -// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class [template = %Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class [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] @@ -150,7 +152,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallClassFunction() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = constants.%Class] // CHECK:STDOUT: %Function.ref: = name_ref Function, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -177,7 +179,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Let(%p: Class*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [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 60fb734112da..624b4b83563d 100644 --- a/toolchain/check/testdata/class/fail_init.carbon +++ b/toolchain/check/testdata/class/fail_init.carbon @@ -27,31 +27,30 @@ fn F() { // CHECK:STDOUT: --- fail_init.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.6: i32 = int_literal 2 [template] // CHECK:STDOUT: %.7: type = struct_type {.a: i32, .c: i32} [template] -// CHECK:STDOUT: %.8: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.9: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.10: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.11: type = struct_type {.a: i32, .b: i32, .c: i32} [template] +// CHECK:STDOUT: %.8: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.9: type = struct_type {.a: i32, .b: i32, .c: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .F = %F} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 [template = %.loc8_8.2] -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1 [template] // CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2 [template = %.loc9_8.2] // CHECK:STDOUT: @@ -62,26 +61,26 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc16_9: i32 = int_literal 1 [template = constants.%.2] +// 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, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class [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.%.5] +// 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, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref.loc20: type = name_ref Class, file.%Class [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 // CHECK:STDOUT: %.loc20_18.5: ref Class = temporary %.loc20_18.2, // CHECK:STDOUT: %.loc20_18.6: ref Class = converted %.loc20_18.1, %.loc20_18.5 -// CHECK:STDOUT: %.loc24_9: i32 = int_literal 1 [template = constants.%.8] -// CHECK:STDOUT: %.loc24_17: i32 = int_literal 2 [template = constants.%.9] -// CHECK:STDOUT: %.loc24_25: i32 = int_literal 3 [template = constants.%.10] +// CHECK:STDOUT: %.loc24_9: i32 = int_literal 1 [template = constants.%.3] +// 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, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref.loc24: type = name_ref Class, file.%Class [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 7d351b7ec530..2e2c1717988c 100644 --- a/toolchain/check/testdata/class/fail_init_as_inplace.carbon +++ b/toolchain/check/testdata/class/fail_init_as_inplace.carbon @@ -25,26 +25,29 @@ fn F() { // CHECK:STDOUT: --- fail_init_as_inplace.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.5: type = tuple_type () [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: type = ptr_type Class [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.7: type = tuple_type () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .G = %G, .F = %F} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 [template = %.loc8_8.2] -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1 [template] // CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2 [template = %.loc9_8.2] // CHECK:STDOUT: @@ -57,13 +60,13 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref.loc21_10: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref.loc21_10: type = name_ref Class, file.%Class [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.%.3] -// CHECK:STDOUT: %.loc21_32: i32 = int_literal 2 [template = constants.%.4] +// 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, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref.loc21_38: type = name_ref Class, file.%Class [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 diff --git a/toolchain/check/testdata/class/fail_memaccess_category.carbon b/toolchain/check/testdata/class/fail_memaccess_category.carbon index dfcc09e583bf..428c3067cd2e 100644 --- a/toolchain/check/testdata/class/fail_memaccess_category.carbon +++ b/toolchain/check/testdata/class/fail_memaccess_category.carbon @@ -36,20 +36,25 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: --- fail_memaccess_category.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: A} [template] -// CHECK:STDOUT: %.5: type = struct_type {.a: {}*} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.a: A} [template] +// CHECK:STDOUT: %A: type = class_type @A [template] +// CHECK:STDOUT: %.1: type = ptr_type A [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %.4: type = ptr_type {} [template] +// CHECK:STDOUT: %.5: type = unbound_element_type B, A [template] +// CHECK:STDOUT: %.6: type = struct_type {.a: A} [template] +// CHECK:STDOUT: %.7: type = struct_type {.a: A} [template] +// CHECK:STDOUT: %.8: type = struct_type {.a: {}*} [template] +// CHECK:STDOUT: %.9: type = ptr_type {.a: A} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A.decl, .B = %B.decl, .F = %F} [template] // CHECK:STDOUT: %A.decl = class_decl @A, () -// CHECK:STDOUT: %A: type = class_type @A [template] +// CHECK:STDOUT: %A: type = class_type @A [template = constants.%A] // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %B: type = class_type @B [template = constants.%B] // CHECK:STDOUT: %F: = fn_decl @F.2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -61,8 +66,8 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc12_8.1: type = unbound_element_type B, A [template] +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A [template = constants.%A] +// CHECK:STDOUT: %.loc12_8.1: type = unbound_element_type B, A [template = constants.%.5] // CHECK:STDOUT: %.loc12_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc12_8.2 [template = %.loc12_8.2] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_member_of_let.carbon b/toolchain/check/testdata/class/fail_member_of_let.carbon index 258d84b7215e..e18f9ca0a2fd 100644 --- a/toolchain/check/testdata/class/fail_member_of_let.carbon +++ b/toolchain/check/testdata/class/fail_member_of_let.carbon @@ -21,15 +21,16 @@ fn T.F() {} // CHECK:STDOUT: --- fail_member_of_let.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] -// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class [template = %Class] -// CHECK:STDOUT: %T: type = bind_name T, %Class.ref [template = %Class] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class [template = constants.%Class] +// CHECK:STDOUT: %T: type = bind_name T, %Class.ref [template = constants.%Class] // CHECK:STDOUT: %.loc19: = fn_decl @.1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_method.carbon b/toolchain/check/testdata/class/fail_method.carbon index 15dcf4b82fa6..f3406dd5f56e 100644 --- a/toolchain/check/testdata/class/fail_method.carbon +++ b/toolchain/check/testdata/class/fail_method.carbon @@ -33,6 +33,7 @@ fn F(c: Class) { // CHECK:STDOUT: --- fail_method.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] @@ -41,7 +42,7 @@ fn F(c: Class) { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .F = %F} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -66,13 +67,13 @@ fn F(c: Class) { // CHECK:STDOUT: %c.ref.loc14: Class = name_ref c, %c // CHECK:STDOUT: %.loc14_4: = bound_method %c.ref.loc14, @Class.%WithSelf // CHECK:STDOUT: %.loc14_13: init () = call %.loc14_4(%c.ref.loc14) -// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class [template = constants.%Class] // CHECK:STDOUT: %NoSelf.ref.loc16: = name_ref NoSelf, @Class.%NoSelf [template = @Class.%NoSelf] // CHECK:STDOUT: %.loc16: init () = call %NoSelf.ref.loc16() -// CHECK:STDOUT: %Class.ref.loc23: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref.loc23: type = name_ref Class, file.%Class [template = constants.%Class] // CHECK:STDOUT: %WithSelf.ref.loc23: = name_ref WithSelf, @Class.%WithSelf [template = @Class.%WithSelf] // CHECK:STDOUT: %.loc23: init () = call %WithSelf.ref.loc23() -// CHECK:STDOUT: %Class.ref.loc30: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref.loc30: type = name_ref Class, file.%Class [template = constants.%Class] // CHECK:STDOUT: %WithSelf.ref.loc30: = name_ref WithSelf, @Class.%WithSelf [template = @Class.%WithSelf] // CHECK:STDOUT: %c.ref.loc30: Class = name_ref c, %c // CHECK:STDOUT: %.loc30: init () = call %WithSelf.ref.loc30() diff --git a/toolchain/check/testdata/class/fail_method_modifiers.carbon b/toolchain/check/testdata/class/fail_method_modifiers.carbon index 1a75fc2954ef..740538c3fff2 100644 --- a/toolchain/check/testdata/class/fail_method_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_method_modifiers.carbon @@ -50,17 +50,20 @@ base class BaseClass { // CHECK:STDOUT: --- fail_method_modifiers.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %FinalClass: type = class_type @FinalClass [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %AbstractClass: type = class_type @AbstractClass [template] +// CHECK:STDOUT: %BaseClass: type = class_type @BaseClass [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.FinalClass = %FinalClass.decl, .AbstractClass = %AbstractClass.decl, .BaseClass = %BaseClass.decl} [template] // CHECK:STDOUT: %FinalClass.decl = class_decl @FinalClass, () -// CHECK:STDOUT: %FinalClass: type = class_type @FinalClass [template] +// CHECK:STDOUT: %FinalClass: type = class_type @FinalClass [template = constants.%FinalClass] // CHECK:STDOUT: %AbstractClass.decl = class_decl @AbstractClass, () -// CHECK:STDOUT: %AbstractClass: type = class_type @AbstractClass [template] +// CHECK:STDOUT: %AbstractClass: type = class_type @AbstractClass [template = constants.%AbstractClass] // CHECK:STDOUT: %BaseClass.decl = class_decl @BaseClass, () -// CHECK:STDOUT: %BaseClass: type = class_type @BaseClass [template] +// CHECK:STDOUT: %BaseClass: type = class_type @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 72534296f9a5..011e60eb1246 100644 --- a/toolchain/check/testdata/class/fail_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_modifiers.carbon @@ -67,23 +67,29 @@ abstract base class AbstractAndBase {} // CHECK:STDOUT: --- fail_modifiers.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %DuplicatePrivate: type = class_type @DuplicatePrivate [template] +// CHECK:STDOUT: %TwoAccess: type = class_type @TwoAccess [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %TwoAbstract: type = class_type @TwoAbstract [template] +// CHECK:STDOUT: %Virtual: type = class_type @Virtual [template] +// CHECK:STDOUT: %WrongOrder: type = class_type @WrongOrder [template] +// CHECK:STDOUT: %AbstractAndBase: type = class_type @AbstractAndBase [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.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: %DuplicatePrivate: type = class_type @DuplicatePrivate [template] +// CHECK:STDOUT: %DuplicatePrivate: type = class_type @DuplicatePrivate [template = constants.%DuplicatePrivate] // CHECK:STDOUT: %TwoAccess.decl = class_decl @TwoAccess, () -// CHECK:STDOUT: %TwoAccess: type = class_type @TwoAccess [template] +// CHECK:STDOUT: %TwoAccess: type = class_type @TwoAccess [template = constants.%TwoAccess] // CHECK:STDOUT: %TwoAbstract.decl = class_decl @TwoAbstract, () -// CHECK:STDOUT: %TwoAbstract: type = class_type @TwoAbstract [template] +// CHECK:STDOUT: %TwoAbstract: type = class_type @TwoAbstract [template = constants.%TwoAbstract] // CHECK:STDOUT: %Virtual.decl = class_decl @Virtual, () -// CHECK:STDOUT: %Virtual: type = class_type @Virtual [template] +// CHECK:STDOUT: %Virtual: type = class_type @Virtual [template = constants.%Virtual] // CHECK:STDOUT: %WrongOrder.decl = class_decl @WrongOrder, () -// CHECK:STDOUT: %WrongOrder: type = class_type @WrongOrder [template] +// CHECK:STDOUT: %WrongOrder: type = class_type @WrongOrder [template = constants.%WrongOrder] // CHECK:STDOUT: %AbstractAndBase.decl = class_decl @AbstractAndBase, () -// CHECK:STDOUT: %AbstractAndBase: type = class_type @AbstractAndBase [template] +// CHECK:STDOUT: %AbstractAndBase: type = class_type @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 86075f6c03cc..094e5b980bf6 100644 --- a/toolchain/check/testdata/class/fail_out_of_line_decl.carbon +++ b/toolchain/check/testdata/class/fail_out_of_line_decl.carbon @@ -14,13 +14,14 @@ fn C.F() {} // CHECK:STDOUT: --- fail_out_of_line_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.C = %C.decl} [template] // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @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 d6816da3e735..feb762a783d6 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon @@ -77,31 +77,38 @@ base class G; // CHECK:STDOUT: --- fail_redeclaration_introducer.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = class_type @A [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %D: type = class_type @D [template] +// CHECK:STDOUT: %E: type = class_type @E [template] +// CHECK:STDOUT: %F: type = class_type @F [template] +// CHECK:STDOUT: %G: type = class_type @G [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.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: type = class_type @A [template] +// CHECK:STDOUT: %A: type = class_type @A [template = constants.%A] // CHECK:STDOUT: %A.decl.loc14 = class_decl @A, () // CHECK:STDOUT: %B.decl.loc16 = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %B: type = class_type @B [template = constants.%B] // CHECK:STDOUT: %B.decl.loc23 = class_decl @B, () // CHECK:STDOUT: %C.decl.loc25 = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @C [template = constants.%C] // CHECK:STDOUT: %C.decl.loc32 = class_decl @C, () // CHECK:STDOUT: %D.decl.loc34 = class_decl @D, () -// CHECK:STDOUT: %D: type = class_type @D [template] +// CHECK:STDOUT: %D: type = class_type @D [template = constants.%D] // CHECK:STDOUT: %D.decl.loc41 = class_decl @D, () // CHECK:STDOUT: %E.decl.loc43 = class_decl @E, () -// CHECK:STDOUT: %E: type = class_type @E [template] +// CHECK:STDOUT: %E: type = class_type @E [template = constants.%E] // CHECK:STDOUT: %E.decl.loc50 = class_decl @E, () // CHECK:STDOUT: %F.decl.loc52 = class_decl @F, () -// CHECK:STDOUT: %F: type = class_type @F [template] +// CHECK:STDOUT: %F: type = class_type @F [template = constants.%F] // CHECK:STDOUT: %F.decl.loc59 = class_decl @F, () // CHECK:STDOUT: %G.decl.loc61 = class_decl @G, () -// CHECK:STDOUT: %G: type = class_type @G [template] +// CHECK:STDOUT: %G: type = class_type @G [template = constants.%G] // CHECK:STDOUT: %G.decl.loc68 = class_decl @G, () // CHECK:STDOUT: %G.decl.loc75 = class_decl @G, () // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon index 3ab00d98fab5..45208bb94a20 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon @@ -24,23 +24,30 @@ class Y { // CHECK:STDOUT: --- fail_redeclaration_scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %A.1: type = class_type @A.1 [template] +// CHECK:STDOUT: %X: type = class_type @X [template] +// CHECK:STDOUT: %A.2: type = class_type @A.2 [template] +// CHECK:STDOUT: %B.1: type = class_type @B.1 [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %B.2: type = class_type @B.2 [template] +// CHECK:STDOUT: %Y: type = class_type @Y [template] +// CHECK:STDOUT: %.2: type = class_type @.1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A.decl.loc7, .X = %X.decl, .Y = %Y.decl} [template] // CHECK:STDOUT: %A.decl.loc7 = class_decl @A.1, () -// CHECK:STDOUT: %A: type = class_type @A.1 [template] +// CHECK:STDOUT: %A: type = class_type @A.1 [template = constants.%A.1] // CHECK:STDOUT: %X.decl = class_decl @X, () -// CHECK:STDOUT: %X: type = class_type @X [template] +// CHECK:STDOUT: %X: type = class_type @X [template = constants.%X] // CHECK:STDOUT: %A.decl.loc15 = class_decl @A.1, () // CHECK:STDOUT: %Y.decl = class_decl @Y, () -// CHECK:STDOUT: %Y: type = class_type @Y [template] +// CHECK:STDOUT: %Y: type = class_type @Y [template = constants.%Y] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A.1 { // CHECK:STDOUT: %B.decl = class_decl @B.2, () -// CHECK:STDOUT: %B: type = class_type @B.2 [template] +// CHECK:STDOUT: %B: type = class_type @B.2 [template = constants.%B.2] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .B = %B.decl @@ -48,7 +55,7 @@ class Y { // CHECK:STDOUT: // CHECK:STDOUT: class @X { // CHECK:STDOUT: %A.decl = class_decl @A.2, () -// CHECK:STDOUT: %A: type = class_type @A.2 [template] +// CHECK:STDOUT: %A: type = class_type @A.2 [template = constants.%A.2] // CHECK:STDOUT: %B.decl = class_decl @B.1, () // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -57,7 +64,7 @@ class Y { // CHECK:STDOUT: // CHECK:STDOUT: class @A.2 { // CHECK:STDOUT: %B.decl = class_decl @B.1, () -// CHECK:STDOUT: %B: type = class_type @B.1 [template] +// CHECK:STDOUT: %B: type = class_type @B.1 [template = constants.%B.1] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .B = %B.decl @@ -72,7 +79,7 @@ class Y { // CHECK:STDOUT: // CHECK:STDOUT: class @Y { // CHECK:STDOUT: %.decl = class_decl @.1, () -// CHECK:STDOUT: %.loc21: type = class_type @.1 [template] +// CHECK:STDOUT: %.loc21: type = class_type @.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 4a844a0bd23a..6a4d925fbba0 100644 --- a/toolchain/check/testdata/class/fail_redefinition.carbon +++ b/toolchain/check/testdata/class/fail_redefinition.carbon @@ -27,13 +27,14 @@ fn Class.H() {} // CHECK:STDOUT: --- fail_redefinition.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl.loc7} [template] // CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %Class.decl.loc18 = class_decl @Class, () // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] @@ -45,8 +46,8 @@ fn Class.H() {} // CHECK:STDOUT: %H: = fn_decl @H [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = -// CHECK:STDOUT: .H = +// CHECK:STDOUT: .F = +// CHECK:STDOUT: .H = // CHECK:STDOUT: .G = %G // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_reorder.carbon b/toolchain/check/testdata/class/fail_reorder.carbon index a07381bf8832..b8f7ce60375d 100644 --- a/toolchain/check/testdata/class/fail_reorder.carbon +++ b/toolchain/check/testdata/class/fail_reorder.carbon @@ -28,6 +28,7 @@ class Class { // CHECK:STDOUT: --- fail_reorder.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } @@ -35,7 +36,7 @@ class Class { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { @@ -49,7 +50,7 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = constants.%Class] // CHECK:STDOUT: %F.ref: = name_ref F, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_scope.carbon b/toolchain/check/testdata/class/fail_scope.carbon index 7b7189804ed9..d92522350742 100644 --- a/toolchain/check/testdata/class/fail_scope.carbon +++ b/toolchain/check/testdata/class/fail_scope.carbon @@ -20,6 +20,7 @@ fn G() -> i32 { // CHECK:STDOUT: --- fail_scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } @@ -27,7 +28,7 @@ fn G() -> i32 { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .G = %G} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @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 38fb97862dbe..76339e80b1e5 100644 --- a/toolchain/check/testdata/class/fail_self.carbon +++ b/toolchain/check/testdata/class/fail_self.carbon @@ -53,19 +53,21 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: --- fail_self.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] +// CHECK:STDOUT: %WrongSelf: type = class_type @WrongSelf [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .WrongSelf = %WrongSelf.decl, .CallWrongSelf = %CallWrongSelf} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @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: type = class_type @WrongSelf [template] +// CHECK:STDOUT: %WrongSelf: type = class_type @WrongSelf [template = constants.%WrongSelf] // CHECK:STDOUT: %CallWrongSelf: = fn_decl @CallWrongSelf [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -92,7 +94,7 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> %return: Class { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [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 ed4f3c5ba91c..9e4dce6091d3 100644 --- a/toolchain/check/testdata/class/fail_todo_generic.carbon +++ b/toolchain/check/testdata/class/fail_todo_generic.carbon @@ -14,10 +14,14 @@ class C[](); // CHECK:STDOUT: --- fail_todo_generic.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.C = %C.decl} [template] // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @C [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C; diff --git a/toolchain/check/testdata/class/fail_todo_modifiers.carbon b/toolchain/check/testdata/class/fail_todo_modifiers.carbon index 8b33bbe8e033..1d32b83e641a 100644 --- a/toolchain/check/testdata/class/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_todo_modifiers.carbon @@ -61,27 +61,31 @@ abstract class Abstract { // CHECK:STDOUT: --- fail_todo_modifiers.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.k: i32, .l: i32} [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] +// CHECK:STDOUT: %Access: type = class_type @Access [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Access, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.k: i32, .l: i32} [template] +// CHECK:STDOUT: %Base: type = class_type @Base [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] +// CHECK:STDOUT: %Abstract: type = class_type @Abstract [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Access = %Access.decl, .Base = %Base.decl, .Abstract = %Abstract.decl} [template] // CHECK:STDOUT: %Access.decl = class_decl @Access, () -// CHECK:STDOUT: %Access: type = class_type @Access [template] +// CHECK:STDOUT: %Access: type = class_type @Access [template = constants.%Access] // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base [template] +// CHECK:STDOUT: %Base: type = class_type @Base [template = constants.%Base] // CHECK:STDOUT: %Abstract.decl = class_decl @Abstract, () -// CHECK:STDOUT: %Abstract: type = class_type @Abstract [template] +// CHECK:STDOUT: %Abstract: type = class_type @Abstract [template = constants.%Abstract] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Access { // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %.loc22_16.1: type = unbound_element_type Access, i32 [template] +// CHECK:STDOUT: %.loc22_16.1: type = unbound_element_type Access, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc22_16.2: = field_decl k, element0 [template] // CHECK:STDOUT: %k: = bind_name k, %.loc22_16.2 [template = %.loc22_16.2] -// CHECK:STDOUT: %.loc27_18.1: type = unbound_element_type Access, i32 [template] +// CHECK:STDOUT: %.loc27_18.1: type = unbound_element_type Access, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc27_18.2: = field_decl l, element1 [template] // CHECK:STDOUT: %l: = bind_name l, %.loc27_18.2 [template = %.loc27_18.2] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_unbound_field.carbon b/toolchain/check/testdata/class/fail_unbound_field.carbon index bf21b91cb0e3..1d80acda2f2a 100644 --- a/toolchain/check/testdata/class/fail_unbound_field.carbon +++ b/toolchain/check/testdata/class/fail_unbound_field.carbon @@ -24,18 +24,20 @@ fn G() -> i32 { // CHECK:STDOUT: --- fail_unbound_field.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.field: i32} [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.field: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .G = %G} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_12.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc8_12.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_12.2: = field_decl field, element0 [template] // CHECK:STDOUT: %field: = bind_name field, %.loc8_12.2 [template = %.loc8_12.2] // CHECK:STDOUT: %F: = fn_decl @F [template] @@ -53,7 +55,7 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = constants.%Class] // CHECK:STDOUT: %field.ref: = name_ref field, @Class.%field [template = @Class.%.loc8_12.2] // 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 1ddffa2342ba..7174d7fa3b9f 100644 --- a/toolchain/check/testdata/class/fail_unknown_member.carbon +++ b/toolchain/check/testdata/class/fail_unknown_member.carbon @@ -19,19 +19,21 @@ fn G(c: Class) -> i32 { // CHECK:STDOUT: --- fail_unknown_member.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.n: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.n: i32} [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.n: i32} [template] +// CHECK:STDOUT: %.3: type = ptr_type {.n: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .G = %G} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl n, element0 [template] // CHECK:STDOUT: %n: = bind_name n, %.loc8_8.2 [template = %.loc8_8.2] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/field_access.carbon b/toolchain/check/testdata/class/field_access.carbon index 65d950010851..f35d1010e231 100644 --- a/toolchain/check/testdata/class/field_access.carbon +++ b/toolchain/check/testdata/class/field_access.carbon @@ -20,24 +20,26 @@ fn Run() { // CHECK:STDOUT: --- field_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.j: i32, .k: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.j: i32, .k: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.j: i32, .k: i32} [template] +// CHECK:STDOUT: %.3: type = ptr_type {.j: i32, .k: i32} [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .Run = %Run} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %Run: = fn_decl @Run [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl j, element0 [template] // CHECK:STDOUT: %j: = bind_name j, %.loc8_8.2 [template = %.loc8_8.2] -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc9_8.2: = field_decl k, element1 [template] // CHECK:STDOUT: %k: = bind_name k, %.loc9_8.2 [template = %.loc9_8.2] // CHECK:STDOUT: @@ -48,16 +50,16 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [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 // CHECK:STDOUT: %.loc14_4: ref i32 = class_element_access %c.ref.loc14, element0 -// CHECK:STDOUT: %.loc14_9: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_9: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: assign %.loc14_4, %.loc14_9 // CHECK:STDOUT: %c.ref.loc15: ref Class = name_ref c, %c // CHECK:STDOUT: %.loc15_4: ref i32 = class_element_access %c.ref.loc15, element1 -// CHECK:STDOUT: %.loc15_9: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc15_9: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: assign %.loc15_4, %.loc15_9 // CHECK:STDOUT: %cj.var: ref i32 = var cj // CHECK:STDOUT: %cj: ref i32 = bind_name cj, %cj.var diff --git a/toolchain/check/testdata/class/field_access_in_value.carbon b/toolchain/check/testdata/class/field_access_in_value.carbon index 614c1913af3a..e5d29b787c85 100644 --- a/toolchain/check/testdata/class/field_access_in_value.carbon +++ b/toolchain/check/testdata/class/field_access_in_value.carbon @@ -21,24 +21,26 @@ fn Test() { // CHECK:STDOUT: --- field_access_in_value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.j: i32, .k: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.j: i32, .k: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.j: i32, .k: i32} [template] +// CHECK:STDOUT: %.3: type = ptr_type {.j: i32, .k: i32} [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .Test = %Test} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %Test: = fn_decl @Test [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl j, element0 [template] // CHECK:STDOUT: %j: = bind_name j, %.loc8_8.2 [template = %.loc8_8.2] -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc9_8.2: = field_decl k, element1 [template] // CHECK:STDOUT: %k: = bind_name k, %.loc9_8.2 [template = %.loc9_8.2] // CHECK:STDOUT: @@ -49,18 +51,18 @@ fn Test() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Test() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref.loc13: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref.loc13: type = name_ref Class, file.%Class [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 // CHECK:STDOUT: %.loc14_5: ref i32 = class_element_access %cv.ref.loc14, element0 -// CHECK:STDOUT: %.loc14_10: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_10: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: assign %.loc14_5, %.loc14_10 // CHECK:STDOUT: %cv.ref.loc15: ref Class = name_ref cv, %cv // CHECK:STDOUT: %.loc15_5: ref i32 = class_element_access %cv.ref.loc15, element1 -// CHECK:STDOUT: %.loc15_10: i32 = int_literal 2 [template = constants.%.4] +// 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, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class [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 e8a685694f0d..33d6d8edeb11 100644 --- a/toolchain/check/testdata/class/forward_declared.carbon +++ b/toolchain/check/testdata/class/forward_declared.carbon @@ -10,10 +10,15 @@ fn F(p: Class*) -> Class* { return p; } // CHECK:STDOUT: --- forward_declared.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = ptr_type Class [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .F = %F} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/init.carbon b/toolchain/check/testdata/class/init.carbon index 50eb2c313f3d..18427b60ef08 100644 --- a/toolchain/check/testdata/class/init.carbon +++ b/toolchain/check/testdata/class/init.carbon @@ -20,26 +20,30 @@ fn MakeReorder(n: i32, next: Class*) -> Class { // CHECK:STDOUT: --- init.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.n: i32, .next: Class*} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.n: i32, .next: Class*} [template] -// CHECK:STDOUT: %.3: type = struct_type {.next: Class*, .n: i32} [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.2: type = ptr_type Class [template] +// CHECK:STDOUT: %.3: type = unbound_element_type Class, Class* [template] +// CHECK:STDOUT: %.4: type = struct_type {.n: i32, .next: Class*} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.n: i32, .next: Class*} [template] +// CHECK:STDOUT: %.6: type = struct_type {.next: Class*, .n: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .Make = %Make, .MakeReorder = %MakeReorder} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @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_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl n, element0 [template] // CHECK:STDOUT: %n: = bind_name n, %.loc8_8.2 [template = %.loc8_8.2] -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = file.%Class] -// CHECK:STDOUT: %.loc9_18: type = ptr_type Class [template] -// CHECK:STDOUT: %.loc9_11.1: type = unbound_element_type Class, Class* [template] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc9_18: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc9_11.1: type = unbound_element_type Class, Class* [template = constants.%.3] // CHECK:STDOUT: %.loc9_11.2: = field_decl next, element1 [template] // CHECK:STDOUT: %next: = bind_name next, %.loc9_11.2 [template = %.loc9_11.2] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/init_as.carbon b/toolchain/check/testdata/class/init_as.carbon index 29b24de7c253..35b9d13d4234 100644 --- a/toolchain/check/testdata/class/init_as.carbon +++ b/toolchain/check/testdata/class/init_as.carbon @@ -16,24 +16,26 @@ fn F() -> i32 { // CHECK:STDOUT: --- init_as.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.5: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .F = %F} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 [template = %.loc8_8.2] -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1 [template] // CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2 [template = %.loc9_8.2] // CHECK:STDOUT: @@ -44,10 +46,10 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13_17: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc13_25: i32 = int_literal 2 [template = constants.%.3] +// 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, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [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 diff --git a/toolchain/check/testdata/class/init_nested.carbon b/toolchain/check/testdata/class/init_nested.carbon index 74d146edcb90..9c2736025d18 100644 --- a/toolchain/check/testdata/class/init_nested.carbon +++ b/toolchain/check/testdata/class/init_nested.carbon @@ -23,29 +23,33 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: --- init_nested.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: type = struct_type {.c: Inner, .d: Inner} [template] -// CHECK:STDOUT: %.4: type = struct_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.c: Inner, .d: Inner} [template] +// CHECK:STDOUT: %Inner: type = class_type @Inner [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Inner, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %Outer: type = class_type @Outer [template] +// CHECK:STDOUT: %.4: type = unbound_element_type Outer, Inner [template] +// CHECK:STDOUT: %.5: type = struct_type {.c: Inner, .d: Inner} [template] +// CHECK:STDOUT: %.6: type = struct_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} [template] +// CHECK:STDOUT: %.7: type = ptr_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} [template] +// CHECK:STDOUT: %.8: type = ptr_type {.c: Inner, .d: Inner} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Inner = %Inner.decl, .MakeInner = %MakeInner, .Outer = %Outer.decl, .MakeOuter = %MakeOuter} [template] // CHECK:STDOUT: %Inner.decl = class_decl @Inner, () -// CHECK:STDOUT: %Inner: type = class_type @Inner [template] +// CHECK:STDOUT: %Inner: type = class_type @Inner [template = constants.%Inner] // CHECK:STDOUT: %MakeInner: = fn_decl @MakeInner [template] // CHECK:STDOUT: %Outer.decl = class_decl @Outer, () -// CHECK:STDOUT: %Outer: type = class_type @Outer [template] +// CHECK:STDOUT: %Outer: type = class_type @Outer [template = constants.%Outer] // CHECK:STDOUT: %MakeOuter: = fn_decl @MakeOuter [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Inner, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Inner, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 [template = %.loc8_8.2] -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Inner, i32 [template] +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Inner, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1 [template] // CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2 [template = %.loc9_8.2] // CHECK:STDOUT: @@ -55,12 +59,12 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Outer { -// CHECK:STDOUT: %Inner.ref.loc15: type = name_ref Inner, file.%Inner [template = file.%Inner] -// CHECK:STDOUT: %.loc15_8.1: type = unbound_element_type Outer, Inner [template] +// CHECK:STDOUT: %Inner.ref.loc15: type = name_ref Inner, file.%Inner [template = constants.%Inner] +// CHECK:STDOUT: %.loc15_8.1: type = unbound_element_type Outer, Inner [template = constants.%.4] // CHECK:STDOUT: %.loc15_8.2: = field_decl c, element0 [template] // CHECK:STDOUT: %c: = bind_name c, %.loc15_8.2 [template = %.loc15_8.2] -// CHECK:STDOUT: %Inner.ref.loc16: type = name_ref Inner, file.%Inner [template = file.%Inner] -// CHECK:STDOUT: %.loc16_8.1: type = unbound_element_type Outer, Inner [template] +// CHECK:STDOUT: %Inner.ref.loc16: type = name_ref Inner, file.%Inner [template = constants.%Inner] +// CHECK:STDOUT: %.loc16_8.1: type = unbound_element_type Outer, Inner [template = constants.%.4] // CHECK:STDOUT: %.loc16_8.2: = field_decl d, element1 [template] // CHECK:STDOUT: %d: = bind_name d, %.loc16_8.2 [template = %.loc16_8.2] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/method.carbon b/toolchain/check/testdata/class/method.carbon index a139f2136d5b..f4bf559d7b2e 100644 --- a/toolchain/check/testdata/class/method.carbon +++ b/toolchain/check/testdata/class/method.carbon @@ -51,15 +51,18 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: --- method.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.k: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.k: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = ptr_type Class [template] +// CHECK:STDOUT: %.2: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.k: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.k: i32} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .Call = %Call, .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: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %Call: = fn_decl @Call [template] // CHECK:STDOUT: %CallOnConstBoundMethod: = fn_decl @CallOnConstBoundMethod [template] @@ -74,7 +77,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %.loc11_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc11_8.1: type = unbound_element_type Class, i32 [template = constants.%.2] // CHECK:STDOUT: %.loc11_8.2: = field_decl k, element0 [template] // CHECK:STDOUT: %k: = bind_name k, %.loc11_8.2 [template = %.loc11_8.2] // CHECK:STDOUT: @@ -106,9 +109,9 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallOnConstBoundMethod() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc25_17: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc25_17: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %.loc25_18.1: {.k: i32} = struct_literal (%.loc25_17) -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = constants.%Class] // CHECK:STDOUT: %.loc25_18.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc25_18.3: ref i32 = class_element_access %.loc25_18.2, element0 // CHECK:STDOUT: %.loc25_18.4: init i32 = initialize_from %.loc25_17 to %.loc25_18.3 @@ -125,7 +128,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallWithAddr() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [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 b928ac72649a..9bf8d515ec69 100644 --- a/toolchain/check/testdata/class/nested.carbon +++ b/toolchain/check/testdata/class/nested.carbon @@ -31,35 +31,43 @@ fn F(a: Outer*) { // CHECK:STDOUT: --- nested.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.pi: Inner*, .po: Outer*, .qi: Inner*} [template] -// CHECK:STDOUT: %.2: type = struct_type {.po: Outer*, .qo: Outer*, .pi: Inner*} [template] -// CHECK:STDOUT: %.3: type = ptr_type {.po: Outer*, .qo: Outer*, .pi: Inner*} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.pi: Inner*, .po: Outer*, .qi: Inner*} [template] +// CHECK:STDOUT: %Outer: type = class_type @Outer [template] +// CHECK:STDOUT: %Inner: type = class_type @Inner [template] +// CHECK:STDOUT: %.1: type = ptr_type Inner [template] +// CHECK:STDOUT: %.2: type = unbound_element_type Inner, Inner* [template] +// CHECK:STDOUT: %.3: type = ptr_type Outer [template] +// CHECK:STDOUT: %.4: type = unbound_element_type Inner, Outer* [template] +// CHECK:STDOUT: %.5: type = struct_type {.pi: Inner*, .po: Outer*, .qi: Inner*} [template] +// CHECK:STDOUT: %.6: type = unbound_element_type Outer, Outer* [template] +// CHECK:STDOUT: %.7: type = unbound_element_type Outer, Inner* [template] +// CHECK:STDOUT: %.8: type = struct_type {.po: Outer*, .qo: Outer*, .pi: Inner*} [template] +// CHECK:STDOUT: %.9: type = ptr_type {.po: Outer*, .qo: Outer*, .pi: Inner*} [template] +// CHECK:STDOUT: %.10: type = ptr_type {.pi: Inner*, .po: Outer*, .qi: Inner*} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Outer = %Outer.decl, .F = %F} [template] // CHECK:STDOUT: %Outer.decl = class_decl @Outer, () -// CHECK:STDOUT: %Outer: type = class_type @Outer [template] +// CHECK:STDOUT: %Outer: type = class_type @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: type = class_type @Inner [template] -// CHECK:STDOUT: %Self.ref: type = name_ref Self, file.%Outer [template = file.%Outer] -// CHECK:STDOUT: %.loc14_15: type = ptr_type Outer [template] -// CHECK:STDOUT: %.loc14_9.1: type = unbound_element_type Outer, Outer* [template] +// CHECK:STDOUT: %Inner: type = class_type @Inner [template = constants.%Inner] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, file.%Outer [template = constants.%Outer] +// CHECK:STDOUT: %.loc14_15: type = ptr_type Outer [template = constants.%.3] +// CHECK:STDOUT: %.loc14_9.1: type = unbound_element_type Outer, Outer* [template = constants.%.6] // CHECK:STDOUT: %.loc14_9.2: = field_decl po, element0 [template] // CHECK:STDOUT: %po: = bind_name po, %.loc14_9.2 [template = %.loc14_9.2] -// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer [template = file.%Outer] -// CHECK:STDOUT: %.loc15_16: type = ptr_type Outer [template] -// CHECK:STDOUT: %.loc15_9.1: type = unbound_element_type Outer, Outer* [template] +// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer [template = constants.%Outer] +// CHECK:STDOUT: %.loc15_16: type = ptr_type Outer [template = constants.%.3] +// CHECK:STDOUT: %.loc15_9.1: type = unbound_element_type Outer, Outer* [template = constants.%.6] // CHECK:STDOUT: %.loc15_9.2: = field_decl qo, element1 [template] // CHECK:STDOUT: %qo: = bind_name qo, %.loc15_9.2 [template = %.loc15_9.2] -// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, %Inner [template = %Inner] -// CHECK:STDOUT: %.loc16_16: type = ptr_type Inner [template] -// CHECK:STDOUT: %.loc16_9.1: type = unbound_element_type Outer, Inner* [template] +// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, %Inner [template = constants.%Inner] +// CHECK:STDOUT: %.loc16_16: type = ptr_type Inner [template = constants.%.1] +// CHECK:STDOUT: %.loc16_9.1: type = unbound_element_type Outer, Inner* [template = constants.%.7] // CHECK:STDOUT: %.loc16_9.2: = field_decl pi, element2 [template] // CHECK:STDOUT: %pi: = bind_name pi, %.loc16_9.2 [template = %.loc16_9.2] // CHECK:STDOUT: @@ -71,19 +79,19 @@ fn F(a: Outer*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @Outer.%Inner [template = @Outer.%Inner] -// CHECK:STDOUT: %.loc9_17: type = ptr_type Inner [template] -// CHECK:STDOUT: %.loc9_11.1: type = unbound_element_type Inner, Inner* [template] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @Outer.%Inner [template = constants.%Inner] +// CHECK:STDOUT: %.loc9_17: type = ptr_type Inner [template = constants.%.1] +// CHECK:STDOUT: %.loc9_11.1: type = unbound_element_type Inner, Inner* [template = constants.%.2] // CHECK:STDOUT: %.loc9_11.2: = field_decl pi, element0 [template] // CHECK:STDOUT: %pi: = bind_name pi, %.loc9_11.2 [template = %.loc9_11.2] -// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer [template = file.%Outer] -// CHECK:STDOUT: %.loc10_18: type = ptr_type Outer [template] -// CHECK:STDOUT: %.loc10_11.1: type = unbound_element_type Inner, Outer* [template] +// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer [template = constants.%Outer] +// CHECK:STDOUT: %.loc10_18: type = ptr_type Outer [template = constants.%.3] +// CHECK:STDOUT: %.loc10_11.1: type = unbound_element_type Inner, Outer* [template = constants.%.4] // CHECK:STDOUT: %.loc10_11.2: = field_decl po, element1 [template] // CHECK:STDOUT: %po: = bind_name po, %.loc10_11.2 [template = %.loc10_11.2] -// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner [template = @Outer.%Inner] -// CHECK:STDOUT: %.loc11_18: type = ptr_type Inner [template] -// CHECK:STDOUT: %.loc11_11.1: type = unbound_element_type Inner, Inner* [template] +// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner [template = constants.%Inner] +// CHECK:STDOUT: %.loc11_18: type = ptr_type Inner [template = constants.%.1] +// CHECK:STDOUT: %.loc11_11.1: type = unbound_element_type Inner, Inner* [template = constants.%.2] // CHECK:STDOUT: %.loc11_11.2: = field_decl qi, element2 [template] // CHECK:STDOUT: %qi: = bind_name qi, %.loc11_11.2 [template = %.loc11_11.2] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/nested_name.carbon b/toolchain/check/testdata/class/nested_name.carbon index 358e791ccd33..70d79b1406fc 100644 --- a/toolchain/check/testdata/class/nested_name.carbon +++ b/toolchain/check/testdata/class/nested_name.carbon @@ -21,31 +21,34 @@ fn G(o: Outer) { // CHECK:STDOUT: --- nested_name.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.n: i32} [template] -// CHECK:STDOUT: %.2: type = struct_type {} [template] -// CHECK:STDOUT: %.3: type = ptr_type {.n: i32} [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] -// CHECK:STDOUT: %.5: type = ptr_type {} [template] +// CHECK:STDOUT: %Outer: type = class_type @Outer [template] +// CHECK:STDOUT: %Inner: type = class_type @Inner [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Inner, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.n: i32} [template] +// CHECK:STDOUT: %.3: type = struct_type {} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.n: i32} [template] +// CHECK:STDOUT: %.5: type = tuple_type () [template] +// CHECK:STDOUT: %.6: type = ptr_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Outer = %Outer.decl, .F = %F, .G = %G} [template] // CHECK:STDOUT: %Outer.decl = class_decl @Outer, () -// CHECK:STDOUT: %Outer: type = class_type @Outer [template] +// CHECK:STDOUT: %Outer: type = class_type @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: type = class_type @Inner [template] +// CHECK:STDOUT: %Inner: type = class_type @Inner [template = constants.%Inner] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Inner = %Inner.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { -// CHECK:STDOUT: %.loc9_10.1: type = unbound_element_type Inner, i32 [template] +// CHECK:STDOUT: %.loc9_10.1: type = unbound_element_type Inner, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc9_10.2: = field_decl n, element0 [template] // CHECK:STDOUT: %n: = bind_name n, %.loc9_10.2 [template = %.loc9_10.2] // CHECK:STDOUT: @@ -64,7 +67,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, @Outer.%Inner [template = @Outer.%Inner] +// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner [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 bb99b3830615..f145978a47b6 100644 --- a/toolchain/check/testdata/class/raw_self.carbon +++ b/toolchain/check/testdata/class/raw_self.carbon @@ -21,17 +21,20 @@ fn Class.G[self: Class](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: --- raw_self.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.4: type = struct_type {.n: i32} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.n: i32} [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = ptr_type Class [template] +// CHECK:STDOUT: %.2: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.5: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.6: type = struct_type {.n: i32} [template] +// CHECK:STDOUT: %.7: type = ptr_type {.n: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } @@ -39,7 +42,7 @@ fn Class.G[self: Class](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %.loc10_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc10_8.1: type = unbound_element_type Class, i32 [template = constants.%.5] // CHECK:STDOUT: %.loc10_8.2: = field_decl n, element0 [template] // CHECK:STDOUT: %n: = bind_name n, %.loc10_8.2 [template = %.loc10_8.2] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/raw_self_type.carbon b/toolchain/check/testdata/class/raw_self_type.carbon index 184998575c40..e52be59decea 100644 --- a/toolchain/check/testdata/class/raw_self_type.carbon +++ b/toolchain/check/testdata/class/raw_self_type.carbon @@ -14,13 +14,15 @@ class Class { // CHECK:STDOUT: --- raw_self_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = ptr_type Class [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { @@ -32,12 +34,12 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, file.%Class [template = file.%Class] -// CHECK:STDOUT: %.loc9: type = ptr_type Class [template] +// CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, file.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc9: type = ptr_type Class [template = constants.%.1] // CHECK:STDOUT: %Self.var: ref Class* = var r#Self // CHECK:STDOUT: %Self: ref Class* = bind_name r#Self, %Self.var -// CHECK:STDOUT: %Self.ref.loc10_12: type = name_ref Self, file.%Class [template = file.%Class] -// CHECK:STDOUT: %.loc10_16: type = ptr_type Class [template] +// CHECK:STDOUT: %Self.ref.loc10_12: type = name_ref Self, file.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc10_16: type = ptr_type Class [template = constants.%.1] // CHECK:STDOUT: %p.var: ref Class* = var p // CHECK:STDOUT: %p: ref Class* = bind_name p, %p.var // CHECK:STDOUT: %Self.ref.loc10_20: ref Class* = name_ref r#Self, %Self diff --git a/toolchain/check/testdata/class/redeclaration.carbon b/toolchain/check/testdata/class/redeclaration.carbon index a55aa296bd1c..454b2bbdf6de 100644 --- a/toolchain/check/testdata/class/redeclaration.carbon +++ b/toolchain/check/testdata/class/redeclaration.carbon @@ -15,13 +15,14 @@ fn Class.F() {} // CHECK:STDOUT: --- redeclaration.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl.loc7} [template] // CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %Class.decl.loc9 = class_decl @Class, () // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/redeclaration_introducer.carbon b/toolchain/check/testdata/class/redeclaration_introducer.carbon index 1d43c07f25a9..e1b361635846 100644 --- a/toolchain/check/testdata/class/redeclaration_introducer.carbon +++ b/toolchain/check/testdata/class/redeclaration_introducer.carbon @@ -15,17 +15,20 @@ abstract class C {} // CHECK:STDOUT: --- redeclaration_introducer.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %A: type = class_type @A [template] +// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A.decl.loc7, .B = %B.decl.loc8, .C = %C.decl.loc9} [template] // CHECK:STDOUT: %A.decl.loc7 = class_decl @A, () -// CHECK:STDOUT: %A: type = class_type @A [template] +// CHECK:STDOUT: %A: type = class_type @A [template = constants.%A] // CHECK:STDOUT: %B.decl.loc8 = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B [template] +// CHECK:STDOUT: %B: type = class_type @B [template = constants.%B] // CHECK:STDOUT: %C.decl.loc9 = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @C [template = constants.%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, () diff --git a/toolchain/check/testdata/class/reenter_scope.carbon b/toolchain/check/testdata/class/reenter_scope.carbon index 867f411e9c2b..f712d5cc2f95 100644 --- a/toolchain/check/testdata/class/reenter_scope.carbon +++ b/toolchain/check/testdata/class/reenter_scope.carbon @@ -16,13 +16,14 @@ fn Class.F() -> i32 { // CHECK:STDOUT: --- reenter_scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @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 26f127c7bbc3..a67448868512 100644 --- a/toolchain/check/testdata/class/scope.carbon +++ b/toolchain/check/testdata/class/scope.carbon @@ -26,6 +26,7 @@ fn Run() { // CHECK:STDOUT: --- scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] // CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: %.3: i32 = int_literal 2 [template] @@ -34,7 +35,7 @@ fn Run() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .F = %F, .Run = %Run} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F.2 [template] // CHECK:STDOUT: %Run: = fn_decl @Run [template] // CHECK:STDOUT: } @@ -78,7 +79,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, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [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 31c2c913847c..4dd3f2b90881 100644 --- a/toolchain/check/testdata/class/self.carbon +++ b/toolchain/check/testdata/class/self.carbon @@ -22,14 +22,17 @@ fn Class.G[addr self: Class*]() -> i32 { // CHECK:STDOUT: --- self.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.n: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.n: i32} [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = ptr_type Class [template] +// CHECK:STDOUT: %.2: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.3: type = struct_type {.n: i32} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.n: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } @@ -37,7 +40,7 @@ fn Class.G[addr self: Class*]() -> i32 { // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] -// CHECK:STDOUT: %.loc11_8.1: type = unbound_element_type Class, i32 [template] +// CHECK:STDOUT: %.loc11_8.1: type = unbound_element_type Class, i32 [template = constants.%.2] // CHECK:STDOUT: %.loc11_8.2: = field_decl n, element0 [template] // CHECK:STDOUT: %n: = bind_name n, %.loc11_8.2 [template = %.loc11_8.2] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/self_conversion.carbon b/toolchain/check/testdata/class/self_conversion.carbon index e6f1aa6d2842..c1d5bb28623d 100644 --- a/toolchain/check/testdata/class/self_conversion.carbon +++ b/toolchain/check/testdata/class/self_conversion.carbon @@ -31,28 +31,34 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: --- self_conversion.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.3: type = struct_type {.base: Base} [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: type = struct_type {.base: {.a: i32}*} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.base: Base} [template] -// CHECK:STDOUT: %.7: type = tuple_type () [template] +// CHECK:STDOUT: %Base: type = class_type @Base [template] +// CHECK:STDOUT: %.1: type = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %Derived: type = class_type @Derived [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32} [template] +// CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %.5: type = ptr_type Base [template] +// CHECK:STDOUT: %.6: type = struct_type {.base: Base} [template] +// CHECK:STDOUT: %.7: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.8: type = ptr_type Derived [template] +// CHECK:STDOUT: %.9: type = struct_type {.base: {.a: i32}*} [template] +// CHECK:STDOUT: %.10: type = ptr_type {.base: Base} [template] +// CHECK:STDOUT: %.11: type = tuple_type () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Base = %Base.decl, .Derived = %Derived.decl, .Call = %Call} [template] // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base [template] +// CHECK:STDOUT: %Base: type = class_type @Base [template = constants.%Base] // CHECK:STDOUT: %Derived.decl = class_decl @Derived, () -// CHECK:STDOUT: %Derived: type = class_type @Derived [template] +// CHECK:STDOUT: %Derived: type = class_type @Derived [template = constants.%Derived] // CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase [template] // CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase [template] // CHECK:STDOUT: %Call: = fn_decl @Call [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 [template = %.loc8_8.2] // CHECK:STDOUT: @@ -61,8 +67,8 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base [template = file.%Base] -// CHECK:STDOUT: %.loc12_20.1: type = unbound_element_type Derived, Base [template] +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base [template = constants.%Base] +// CHECK:STDOUT: %.loc12_20.1: type = unbound_element_type Derived, Base [template = constants.%.4] // CHECK:STDOUT: %.loc12_20.2: = base_decl Base, element0 [template] // CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase [template] // CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase [template] @@ -87,7 +93,7 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: %self.ref: Base* = name_ref self, %self // CHECK:STDOUT: %.loc23_4: ref Base = deref %self.ref // CHECK:STDOUT: %.loc23_10: ref i32 = class_element_access %.loc23_4, element0 -// CHECK:STDOUT: %.loc23_15: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc23_15: i32 = int_literal 1 [template = constants.%.7] // CHECK:STDOUT: assign %.loc23_10, %.loc23_15 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/self_type.carbon b/toolchain/check/testdata/class/self_type.carbon index b80d154aa42d..2980d50adf67 100644 --- a/toolchain/check/testdata/class/self_type.carbon +++ b/toolchain/check/testdata/class/self_type.carbon @@ -19,22 +19,25 @@ fn Class.F[self: Class]() -> i32 { // CHECK:STDOUT: --- self_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.p: Class*} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.p: Class*} [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %.1: type = ptr_type Class [template] +// CHECK:STDOUT: %.2: type = unbound_element_type Class, Class* [template] +// CHECK:STDOUT: %.3: type = struct_type {.p: Class*} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.p: Class*} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F: = fn_decl @F [template] -// CHECK:STDOUT: %Self.ref: type = name_ref Self, file.%Class [template = file.%Class] -// CHECK:STDOUT: %.loc9_14: type = ptr_type Class [template] -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, Class* [template] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, file.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc9_14: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, Class* [template = constants.%.2] // CHECK:STDOUT: %.loc9_8.2: = field_decl p, element0 [template] // CHECK:STDOUT: %p: = bind_name p, %.loc9_8.2 [template = %.loc9_8.2] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/static_method.carbon b/toolchain/check/testdata/class/static_method.carbon index c28c25af1604..d20f32efe71d 100644 --- a/toolchain/check/testdata/class/static_method.carbon +++ b/toolchain/check/testdata/class/static_method.carbon @@ -16,6 +16,7 @@ fn Run() -> i32 { // CHECK:STDOUT: --- static_method.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] @@ -24,7 +25,7 @@ fn Run() -> i32 { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .Run = %Run} [template] // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %Run: = fn_decl @Run [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -39,7 +40,7 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [template = file.%Class] +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class [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/const/collapse.carbon b/toolchain/check/testdata/const/collapse.carbon index 05682a3e15f9..d93710d26d07 100644 --- a/toolchain/check/testdata/const/collapse.carbon +++ b/toolchain/check/testdata/const/collapse.carbon @@ -14,6 +14,13 @@ fn F(p: const i32**) -> const (const i32)** { // CHECK:STDOUT: --- collapse.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = const_type i32 [template] +// CHECK:STDOUT: %.2: type = ptr_type const i32 [template] +// CHECK:STDOUT: %.3: type = ptr_type const i32* [template] +// CHECK:STDOUT: %.4: type = const_type const i32 [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} [template] // CHECK:STDOUT: %F: = fn_decl @F [template] diff --git a/toolchain/check/testdata/const/fail_collapse.carbon b/toolchain/check/testdata/const/fail_collapse.carbon index 564cf20f5e47..8200c78753ef 100644 --- a/toolchain/check/testdata/const/fail_collapse.carbon +++ b/toolchain/check/testdata/const/fail_collapse.carbon @@ -16,6 +16,15 @@ fn G(p: const (const i32)**) -> i32** { // CHECK:STDOUT: --- fail_collapse.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = const_type i32 [template] +// CHECK:STDOUT: %.2: type = const_type const i32 [template] +// CHECK:STDOUT: %.3: type = ptr_type const i32 [template] +// CHECK:STDOUT: %.4: type = ptr_type const i32* [template] +// CHECK:STDOUT: %.5: type = ptr_type i32 [template] +// CHECK:STDOUT: %.6: type = ptr_type i32* [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.G = %G} [template] // CHECK:STDOUT: %G: = fn_decl @G [template] diff --git a/toolchain/check/testdata/function/call/fail_param_count.carbon b/toolchain/check/testdata/function/call/fail_param_count.carbon index 31c6ecfc8b42..a99a7a959e68 100644 --- a/toolchain/check/testdata/function/call/fail_param_count.carbon +++ b/toolchain/check/testdata/function/call/fail_param_count.carbon @@ -61,10 +61,6 @@ fn Main() { // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -97,18 +93,18 @@ fn Main() { // CHECK:STDOUT: %.loc18_7: init () = call %Run0.ref.loc18() // CHECK:STDOUT: %Run0.ref.loc25: = name_ref Run0, file.%Run0 [template = file.%Run0] // CHECK:STDOUT: %.loc25_8: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc25_11: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc25_11: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc25_7: init () = call %Run0.ref.loc25() // CHECK:STDOUT: %Run1.ref.loc33: = name_ref Run1, file.%Run1 [template = file.%Run1] // CHECK:STDOUT: %.loc33: init () = call %Run1.ref.loc33() // CHECK:STDOUT: %Run1.ref.loc40: = name_ref Run1, file.%Run1 [template = file.%Run1] -// CHECK:STDOUT: %.loc40_8: i32 = int_literal 0 [template = constants.%.5] -// CHECK:STDOUT: %.loc40_11: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc40_8: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc40_11: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc40_7: init () = call %Run1.ref.loc40() // CHECK:STDOUT: %Run2.ref.loc48: = name_ref Run2, file.%Run2 [template = file.%Run2] // CHECK:STDOUT: %.loc48: init () = call %Run2.ref.loc48() // CHECK:STDOUT: %Run2.ref.loc55: = name_ref Run2, file.%Run2 [template = file.%Run2] -// CHECK:STDOUT: %.loc55_8: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc55_8: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc55_7: init () = call %Run2.ref.loc55() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/params_one_comma.carbon b/toolchain/check/testdata/function/call/params_one_comma.carbon index 144017a99fc5..0993666fd705 100644 --- a/toolchain/check/testdata/function/call/params_one_comma.carbon +++ b/toolchain/check/testdata/function/call/params_one_comma.carbon @@ -16,7 +16,6 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -36,7 +35,7 @@ fn Main() { // CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc10_6: init () = call %Foo.ref.loc10(%.loc10_7) // CHECK:STDOUT: %Foo.ref.loc11: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc11_6: init () = call %Foo.ref.loc11(%.loc11_7) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/params_two_comma.carbon b/toolchain/check/testdata/function/call/params_two_comma.carbon index 5e239124624e..815e05e818a9 100644 --- a/toolchain/check/testdata/function/call/params_two_comma.carbon +++ b/toolchain/check/testdata/function/call/params_two_comma.carbon @@ -17,8 +17,6 @@ fn Main() { // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] // CHECK:STDOUT: %.2: i32 = int_literal 2 [template] // CHECK:STDOUT: %.3: type = tuple_type () [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -39,8 +37,8 @@ fn Main() { // CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: %.loc10_6: init () = call %Foo.ref.loc10(%.loc10_7, %.loc10_10) // CHECK:STDOUT: %Foo.ref.loc11: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc11_10: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_10: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: %.loc11_6: init () = call %Foo.ref.loc11(%.loc11_7, %.loc11_10) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon b/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon index 86e79a0573b7..71301ec3590a 100644 --- a/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon +++ b/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon @@ -14,6 +14,10 @@ fn F(T:! type, U:! type) { // CHECK:STDOUT: --- fail_type_param_mismatch.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = ptr_type T [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} [template] // CHECK:STDOUT: %F: = fn_decl @F [template] @@ -22,7 +26,7 @@ fn F(T:! type, U:! type) { // CHECK:STDOUT: fn @F(%T: type, %U: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref: type = name_ref T, %T [symbolic = %T] -// CHECK:STDOUT: %.loc8: type = ptr_type T [template] +// CHECK:STDOUT: %.loc8: type = ptr_type T [template = constants.%.1] // CHECK:STDOUT: %p.var: ref T* = var p // CHECK:STDOUT: %p: ref T* = bind_name p, %p.var // CHECK:STDOUT: %U.ref: type = name_ref U, %U [symbolic = %U] diff --git a/toolchain/check/testdata/function/generic/type_param.carbon b/toolchain/check/testdata/function/generic/type_param.carbon index 55fd48266423..57aff347cfee 100644 --- a/toolchain/check/testdata/function/generic/type_param.carbon +++ b/toolchain/check/testdata/function/generic/type_param.carbon @@ -11,6 +11,10 @@ fn F(T:! type) { // CHECK:STDOUT: --- type_param.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = ptr_type T [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} [template] // CHECK:STDOUT: %F: = fn_decl @F [template] @@ -19,7 +23,7 @@ fn F(T:! type) { // CHECK:STDOUT: fn @F(%T: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref.loc8: type = name_ref T, %T [symbolic = %T] -// CHECK:STDOUT: %.loc8: type = ptr_type T [template] +// CHECK:STDOUT: %.loc8: type = ptr_type T [template = constants.%.1] // CHECK:STDOUT: %p.var: ref T* = var p // CHECK:STDOUT: %p: ref T* = bind_name p, %p.var // CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T [symbolic = %T] diff --git a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon index 6048439f2cd3..e3f9820c4449 100644 --- a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon @@ -38,7 +38,6 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] // CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -84,7 +83,7 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc29: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc29: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: return %.loc29 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: 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 c0d2efac1877..9141184e3874 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -39,7 +39,8 @@ class C { // CHECK:STDOUT: %.1: bool = bool_literal true [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.4: bool = bool_literal true [template] +// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %.4: type = unbound_element_type C, [template] // CHECK:STDOUT: %.5: type = struct_type {.n: } [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -47,14 +48,14 @@ class C { // CHECK:STDOUT: %.loc17: i32 = block_arg // CHECK:STDOUT: %x: i32 = bind_name x, %.loc17 // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @C [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc33: bool = bool_literal true [template = constants.%.4] +// CHECK:STDOUT: %.loc33: bool = bool_literal true [template = constants.%.1] // CHECK:STDOUT: if %.loc33 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .n = +// CHECK:STDOUT: .n = // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/struct.carbon b/toolchain/check/testdata/if_expr/struct.carbon index 2f7aa48ac615..349f3a42cbe9 100644 --- a/toolchain/check/testdata/if_expr/struct.carbon +++ b/toolchain/check/testdata/if_expr/struct.carbon @@ -14,10 +14,11 @@ fn F(cond: bool) { // CHECK:STDOUT: --- struct.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.4: type = tuple_type () [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.5: type = tuple_type () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -30,11 +31,11 @@ fn F(cond: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%cond: bool) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] // CHECK:STDOUT: %a.var: ref {.a: i32, .b: i32} = var a // CHECK:STDOUT: %a: ref {.a: i32, .b: i32} = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_45: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_45: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: %.loc10_46.1: {.a: i32, .b: i32} = struct_literal (%.loc10_37, %.loc10_45) // CHECK:STDOUT: %.loc10_46.2: ref i32 = struct_access %a.var, element0 // CHECK:STDOUT: %.loc10_46.3: init i32 = initialize_from %.loc10_37 to %.loc10_46.2 diff --git a/toolchain/check/testdata/index/expr_category.carbon b/toolchain/check/testdata/index/expr_category.carbon index 9a923a6c5639..ca6fc0dd4a6b 100644 --- a/toolchain/check/testdata/index/expr_category.carbon +++ b/toolchain/check/testdata/index/expr_category.carbon @@ -30,33 +30,15 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: %.1: i32 = int_literal 3 [template] // CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] // CHECK:STDOUT: %.3: type = ptr_type [i32; 3] [template] -// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.7: type = array_type %.6, i32 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.6: type = tuple_type (i32, i32, i32) [template] +// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] // CHECK:STDOUT: %.8: i32 = int_literal 1 [template] // CHECK:STDOUT: %.9: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.10: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.11: type = tuple_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.12: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.13: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.14: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.15: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.16: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.17: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.18: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.19: type = array_type %.18, i32 [template] -// CHECK:STDOUT: %.20: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.21: type = array_type %.20, i32 [template] -// CHECK:STDOUT: %.22: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.23: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.24: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.25: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.26: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.27: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.28: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.29: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.30: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.10: type = ptr_type i32 [template] +// CHECK:STDOUT: %.11: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.12: i32 = int_literal 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -70,76 +52,76 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%b: [i32; 3]) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 3 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32 [template = constants.%.7] +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32 [template = constants.%.2] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_22: i32 = int_literal 1 [template = constants.%.8] -// CHECK:STDOUT: %.loc10_25: i32 = int_literal 2 [template = constants.%.9] -// CHECK:STDOUT: %.loc10_28: i32 = int_literal 3 [template = constants.%.10] +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_25: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_28: i32 = int_literal 3 [template = constants.%.1] // CHECK:STDOUT: %.loc10_29.1: (i32, i32, i32) = tuple_literal (%.loc10_22, %.loc10_25, %.loc10_28) -// CHECK:STDOUT: %.loc10_29.2: i32 = int_literal 0 [template = constants.%.12] +// CHECK:STDOUT: %.loc10_29.2: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %.loc10_29.3: ref i32 = array_index %a.var, %.loc10_29.2 // CHECK:STDOUT: %.loc10_29.4: init i32 = initialize_from %.loc10_22 to %.loc10_29.3 -// CHECK:STDOUT: %.loc10_29.5: i32 = int_literal 1 [template = constants.%.13] +// CHECK:STDOUT: %.loc10_29.5: i32 = int_literal 1 [template = constants.%.8] // CHECK:STDOUT: %.loc10_29.6: ref i32 = array_index %a.var, %.loc10_29.5 // CHECK:STDOUT: %.loc10_29.7: init i32 = initialize_from %.loc10_25 to %.loc10_29.6 -// CHECK:STDOUT: %.loc10_29.8: i32 = int_literal 2 [template = constants.%.14] +// CHECK:STDOUT: %.loc10_29.8: i32 = int_literal 2 [template = constants.%.9] // CHECK:STDOUT: %.loc10_29.9: ref i32 = array_index %a.var, %.loc10_29.8 // CHECK:STDOUT: %.loc10_29.10: init i32 = initialize_from %.loc10_28 to %.loc10_29.9 // CHECK:STDOUT: %.loc10_29.11: init [i32; 3] = array_init (%.loc10_29.4, %.loc10_29.7, %.loc10_29.10) to %a.var // CHECK:STDOUT: %.loc10_29.12: init [i32; 3] = converted %.loc10_29.1, %.loc10_29.11 // CHECK:STDOUT: assign %a.var, %.loc10_29.12 -// CHECK:STDOUT: %.loc13_14: type = ptr_type i32 [template] +// CHECK:STDOUT: %.loc13_14: type = ptr_type i32 [template = constants.%.10] // CHECK:STDOUT: %pa.var: ref i32* = var pa // CHECK:STDOUT: %pa: ref i32* = bind_name pa, %pa.var // CHECK:STDOUT: %a.ref.loc13: ref [i32; 3] = name_ref a, %a -// CHECK:STDOUT: %.loc13_21: i32 = int_literal 0 [template = constants.%.15] +// CHECK:STDOUT: %.loc13_21: i32 = int_literal 0 [template = constants.%.11] // CHECK:STDOUT: %.loc13_22: ref i32 = array_index %a.ref.loc13, %.loc13_21 // CHECK:STDOUT: %.loc13_18: i32* = addr_of %.loc13_22 // CHECK:STDOUT: assign %pa.var, %.loc13_18 // CHECK:STDOUT: %a.ref.loc14: ref [i32; 3] = name_ref a, %a -// CHECK:STDOUT: %.loc14_5: i32 = int_literal 0 [template = constants.%.16] +// CHECK:STDOUT: %.loc14_5: i32 = int_literal 0 [template = constants.%.11] // CHECK:STDOUT: %.loc14_6: ref i32 = array_index %a.ref.loc14, %.loc14_5 -// CHECK:STDOUT: %.loc14_10: i32 = int_literal 4 [template = constants.%.17] +// CHECK:STDOUT: %.loc14_10: i32 = int_literal 4 [template = constants.%.12] // CHECK:STDOUT: assign %.loc14_6, %.loc14_10 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ValueBinding(%b: [i32; 3]) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_16: i32 = int_literal 3 [template = constants.%.20] -// CHECK:STDOUT: %.loc18_17: type = array_type %.loc18_16, i32 [template = constants.%.21] +// CHECK:STDOUT: %.loc18_16: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_17: type = array_type %.loc18_16, i32 [template = constants.%.2] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var -// CHECK:STDOUT: %.loc18_22: i32 = int_literal 1 [template = constants.%.22] -// CHECK:STDOUT: %.loc18_25: i32 = int_literal 2 [template = constants.%.23] -// CHECK:STDOUT: %.loc18_28: i32 = int_literal 3 [template = constants.%.24] +// CHECK:STDOUT: %.loc18_22: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc18_25: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc18_28: i32 = int_literal 3 [template = constants.%.1] // CHECK:STDOUT: %.loc18_29.1: (i32, i32, i32) = tuple_literal (%.loc18_22, %.loc18_25, %.loc18_28) -// CHECK:STDOUT: %.loc18_29.2: i32 = int_literal 0 [template = constants.%.25] +// CHECK:STDOUT: %.loc18_29.2: i32 = int_literal 0 [template = constants.%.7] // CHECK:STDOUT: %.loc18_29.3: ref i32 = array_index %a.var, %.loc18_29.2 // CHECK:STDOUT: %.loc18_29.4: init i32 = initialize_from %.loc18_22 to %.loc18_29.3 -// CHECK:STDOUT: %.loc18_29.5: i32 = int_literal 1 [template = constants.%.26] +// CHECK:STDOUT: %.loc18_29.5: i32 = int_literal 1 [template = constants.%.8] // CHECK:STDOUT: %.loc18_29.6: ref i32 = array_index %a.var, %.loc18_29.5 // CHECK:STDOUT: %.loc18_29.7: init i32 = initialize_from %.loc18_25 to %.loc18_29.6 -// CHECK:STDOUT: %.loc18_29.8: i32 = int_literal 2 [template = constants.%.27] +// CHECK:STDOUT: %.loc18_29.8: i32 = int_literal 2 [template = constants.%.9] // CHECK:STDOUT: %.loc18_29.9: ref i32 = array_index %a.var, %.loc18_29.8 // CHECK:STDOUT: %.loc18_29.10: init i32 = initialize_from %.loc18_28 to %.loc18_29.9 // CHECK:STDOUT: %.loc18_29.11: init [i32; 3] = array_init (%.loc18_29.4, %.loc18_29.7, %.loc18_29.10) to %a.var // CHECK:STDOUT: %.loc18_29.12: init [i32; 3] = converted %.loc18_29.1, %.loc18_29.11 // CHECK:STDOUT: assign %a.var, %.loc18_29.12 // CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, %a -// CHECK:STDOUT: %.loc22_5: i32 = int_literal 0 [template = constants.%.28] +// CHECK:STDOUT: %.loc22_5: i32 = int_literal 0 [template = constants.%.11] // CHECK:STDOUT: %.loc22_6: ref i32 = array_index %a.ref, %.loc22_5 // CHECK:STDOUT: %b.ref: [i32; 3] = name_ref b, %b -// CHECK:STDOUT: %.loc23_5: i32 = int_literal 0 [template = constants.%.29] +// CHECK:STDOUT: %.loc23_5: i32 = int_literal 0 [template = constants.%.11] // CHECK:STDOUT: %.loc23_6.1: ref [i32; 3] = value_as_ref %b.ref // CHECK:STDOUT: %.loc23_6.2: ref i32 = array_index %.loc23_6.1, %.loc23_5 // CHECK:STDOUT: %.loc23_6.3: i32 = bind_value %.loc23_6.2 // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc24_4.1: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %.loc24_4.2: init [i32; 3] = call %F.ref() to %.loc24_4.1 -// CHECK:STDOUT: %.loc24_7: i32 = int_literal 0 [template = constants.%.30] +// CHECK:STDOUT: %.loc24_7: i32 = int_literal 0 [template = constants.%.11] // CHECK:STDOUT: %.loc24_4.3: ref [i32; 3] = temporary %.loc24_4.1, %.loc24_4.2 // CHECK:STDOUT: %.loc24_8.1: ref i32 = array_index %.loc24_4.3, %.loc24_7 // CHECK:STDOUT: %.loc24_8.2: i32 = bind_value %.loc24_8.1 diff --git a/toolchain/check/testdata/index/fail_expr_category.carbon b/toolchain/check/testdata/index/fail_expr_category.carbon index 86dd868d3214..cd0808e92880 100644 --- a/toolchain/check/testdata/index/fail_expr_category.carbon +++ b/toolchain/check/testdata/index/fail_expr_category.carbon @@ -35,14 +35,9 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: %.1: i32 = int_literal 3 [template] // CHECK:STDOUT: %.2: type = array_type %.1, i32 [template] // CHECK:STDOUT: %.3: type = ptr_type [i32; 3] [template] -// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.5: type = array_type %.4, i32 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.8: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.9: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.10: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.11: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.4: type = ptr_type i32 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -55,30 +50,30 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%b: [i32; 3]) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_14: type = ptr_type i32 [template] +// CHECK:STDOUT: %.loc14_14: type = ptr_type i32 [template = constants.%.4] // CHECK:STDOUT: %pb.var: ref i32* = var pb // CHECK:STDOUT: %pb: ref i32* = bind_name pb, %pb.var // CHECK:STDOUT: %b.ref.loc14: [i32; 3] = name_ref b, %b -// CHECK:STDOUT: %.loc14_21: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_21: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc14_22.1: ref [i32; 3] = value_as_ref %b.ref.loc14 // CHECK:STDOUT: %.loc14_22.2: ref i32 = array_index %.loc14_22.1, %.loc14_21 // CHECK:STDOUT: %.loc14_22.3: i32 = bind_value %.loc14_22.2 // CHECK:STDOUT: %.loc14_18: i32* = addr_of %.loc14_22.3 // CHECK:STDOUT: assign %pb.var, %.loc14_18 // CHECK:STDOUT: %b.ref.loc18: [i32; 3] = name_ref b, %b -// CHECK:STDOUT: %.loc18_5: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc18_5: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc18_6.1: ref [i32; 3] = value_as_ref %b.ref.loc18 // CHECK:STDOUT: %.loc18_6.2: ref i32 = array_index %.loc18_6.1, %.loc18_5 // CHECK:STDOUT: %.loc18_6.3: i32 = bind_value %.loc18_6.2 -// CHECK:STDOUT: %.loc18_10: i32 = int_literal 4 [template = constants.%.8] +// CHECK:STDOUT: %.loc18_10: i32 = int_literal 4 [template = constants.%.6] // CHECK:STDOUT: assign %.loc18_6.3, %.loc18_10 -// CHECK:STDOUT: %.loc25_14: type = ptr_type i32 [template] +// CHECK:STDOUT: %.loc25_14: type = ptr_type i32 [template = constants.%.4] // CHECK:STDOUT: %pf.var: ref i32* = var pf // CHECK:STDOUT: %pf: ref i32* = bind_name pf, %pf.var // CHECK:STDOUT: %F.ref.loc25: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc25_20.1: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %.loc25_20.2: init [i32; 3] = call %F.ref.loc25() to %.loc25_20.1 -// CHECK:STDOUT: %.loc25_23: i32 = int_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc25_23: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc25_20.3: ref [i32; 3] = temporary %.loc25_20.1, %.loc25_20.2 // CHECK:STDOUT: %.loc25_24.1: ref i32 = array_index %.loc25_20.3, %.loc25_23 // CHECK:STDOUT: %.loc25_24.2: i32 = bind_value %.loc25_24.1 @@ -87,11 +82,11 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: %F.ref.loc29: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc29_4.1: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %.loc29_4.2: init [i32; 3] = call %F.ref.loc29() to %.loc29_4.1 -// CHECK:STDOUT: %.loc29_7: i32 = int_literal 0 [template = constants.%.10] +// CHECK:STDOUT: %.loc29_7: i32 = int_literal 0 [template = constants.%.5] // CHECK:STDOUT: %.loc29_4.3: ref [i32; 3] = temporary %.loc29_4.1, %.loc29_4.2 // CHECK:STDOUT: %.loc29_8.1: ref i32 = array_index %.loc29_4.3, %.loc29_7 // CHECK:STDOUT: %.loc29_8.2: i32 = bind_value %.loc29_8.1 -// CHECK:STDOUT: %.loc29_12: i32 = int_literal 4 [template = constants.%.11] +// CHECK:STDOUT: %.loc29_12: i32 = int_literal 4 [template = constants.%.6] // CHECK:STDOUT: assign %.loc29_8.2, %.loc29_12 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_invalid_base.carbon b/toolchain/check/testdata/index/fail_invalid_base.carbon index ef460003fb77..a857a67040da 100644 --- a/toolchain/check/testdata/index/fail_invalid_base.carbon +++ b/toolchain/check/testdata/index/fail_invalid_base.carbon @@ -35,13 +35,11 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 0 [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.5: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.7: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.8: {.a: i32, .b: i32} = struct_value (%.3, %.4) [template] -// CHECK:STDOUT: %.9: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.6: {.a: i32, .b: i32} = struct_value (%.2, %.3) [template] +// CHECK:STDOUT: %.7: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -60,17 +58,17 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: assign %b.var, // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var -// CHECK:STDOUT: %.loc26_20: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc26_28: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc26_20: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc26_28: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %.loc26_29.1: {.a: i32, .b: i32} = struct_literal (%.loc26_20, %.loc26_28) -// CHECK:STDOUT: %.loc26_31: i32 = int_literal 0 [template = constants.%.6] -// CHECK:STDOUT: %.loc26_29.2: {.a: i32, .b: i32} = struct_value (%.loc26_20, %.loc26_28) [template = constants.%.8] -// CHECK:STDOUT: %.loc26_29.3: {.a: i32, .b: i32} = converted %.loc26_29.1, %.loc26_29.2 [template = constants.%.8] +// CHECK:STDOUT: %.loc26_31: i32 = int_literal 0 [template = constants.%.1] +// CHECK:STDOUT: %.loc26_29.2: {.a: i32, .b: i32} = struct_value (%.loc26_20, %.loc26_28) [template = constants.%.6] +// CHECK:STDOUT: %.loc26_29.3: {.a: i32, .b: i32} = converted %.loc26_29.1, %.loc26_29.2 [template = constants.%.6] // CHECK:STDOUT: assign %c.var, // CHECK:STDOUT: %d.var: ref i32 = var d // CHECK:STDOUT: %d: ref i32 = bind_name d, %d.var -// CHECK:STDOUT: %.loc31_31: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.loc31_33: i32 = int_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc31_31: type = struct_type {.a: i32, .b: i32} [template = constants.%.7] +// CHECK:STDOUT: %.loc31_33: i32 = int_literal 0 [template = constants.%.1] // CHECK:STDOUT: assign %d.var, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/tuple_return_value_access.carbon b/toolchain/check/testdata/index/tuple_return_value_access.carbon index c86daea87062..ce722449049a 100644 --- a/toolchain/check/testdata/index/tuple_return_value_access.carbon +++ b/toolchain/check/testdata/index/tuple_return_value_access.carbon @@ -17,7 +17,6 @@ fn Run() -> i32 { // CHECK:STDOUT: %.2: type = tuple_type (i32) [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] // CHECK:STDOUT: %.4: (i32,) = tuple_value (%.3) [template] -// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -39,7 +38,7 @@ fn Run() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc10_11.1: init (i32,) = call %F.ref() -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: %.loc10_11.2: ref (i32,) = temporary_storage // CHECK:STDOUT: %.loc10_11.3: ref (i32,) = temporary %.loc10_11.2, %.loc10_11.1 // CHECK:STDOUT: %.loc10_15.1: ref i32 = tuple_index %.loc10_11.3, %.loc10_14 diff --git a/toolchain/check/testdata/interface/fail_duplicate.carbon b/toolchain/check/testdata/interface/fail_duplicate.carbon index bb58a2ca128c..fa9f26e2862b 100644 --- a/toolchain/check/testdata/interface/fail_duplicate.carbon +++ b/toolchain/check/testdata/interface/fail_duplicate.carbon @@ -38,6 +38,10 @@ interface Class { } // CHECK:STDOUT: --- fail_duplicate.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Interface = %Interface.decl.loc7, .Function = %Function, .Class = %Class.decl} [template] // CHECK:STDOUT: %Interface.decl.loc7 = interface_decl @Interface, () @@ -45,7 +49,7 @@ interface Class { } // CHECK:STDOUT: %Function: = fn_decl @Function [template] // CHECK:STDOUT: %.decl.loc27 = interface_decl @.1, () // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class [template] +// CHECK:STDOUT: %Class: type = class_type @Class [template = constants.%Class] // CHECK:STDOUT: %.decl.loc37 = interface_decl @.2, () // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon index 92ace0eb24a9..fca4be9fbaf8 100644 --- a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon +++ b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon @@ -11,8 +11,7 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: bool = bool_literal true [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: bool = bool_literal true [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -33,13 +32,13 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: br !if.else.loc7_18 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc7_18: -// CHECK:STDOUT: %.loc7_44: bool = bool_literal true [template = constants.%.3] +// CHECK:STDOUT: %.loc7_44: bool = bool_literal true [template = constants.%.1] // CHECK:STDOUT: if %.loc7_44 br !if.then.loc7_48 else br !if.else.loc7_48 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc7_48: // CHECK:STDOUT: %n.var.loc7_56: ref i32 = var n // CHECK:STDOUT: %n.loc7_56: ref i32 = bind_name n, %n.var.loc7_56 -// CHECK:STDOUT: %.loc7_65: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc7_65: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: assign %n.var.loc7_56, %.loc7_65 // CHECK:STDOUT: br !if.else.loc7_48 // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/convert.carbon b/toolchain/check/testdata/let/convert.carbon index 990d532aa5c6..52acda0338e9 100644 --- a/toolchain/check/testdata/let/convert.carbon +++ b/toolchain/check/testdata/let/convert.carbon @@ -20,7 +20,6 @@ fn F() -> i32 { // CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: %.5: i32 = int_literal 2 [template] // CHECK:STDOUT: %.6: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -60,7 +59,7 @@ fn F() -> i32 { // CHECK:STDOUT: %.loc10_28.8: (i32, i32, i32) = converted %v.ref, %.loc10_28.7 // CHECK:STDOUT: %w: (i32, i32, i32) = bind_name w, %.loc10_28.8 // CHECK:STDOUT: %w.ref: (i32, i32, i32) = name_ref w, %w -// CHECK:STDOUT: %.loc11_12: i32 = int_literal 1 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_12: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc11_13: i32 = tuple_index %w.ref, %.loc11_12 // CHECK:STDOUT: return %.loc11_13 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/fail_modifiers.carbon b/toolchain/check/testdata/let/fail_modifiers.carbon index 9667a003283e..e20d6a69fa43 100644 --- a/toolchain/check/testdata/let/fail_modifiers.carbon +++ b/toolchain/check/testdata/let/fail_modifiers.carbon @@ -72,32 +72,25 @@ protected protected let i: i32 = 1; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.8: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {} [template] // CHECK:STDOUT: %.loc10: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %b: i32 = bind_name b, %.loc10 [template = constants.%.1] -// CHECK:STDOUT: %.loc15: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %c: i32 = bind_name c, %.loc15 [template = constants.%.2] -// CHECK:STDOUT: %.loc20: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %d: i32 = bind_name d, %.loc20 [template = constants.%.3] -// CHECK:STDOUT: %.loc25: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %e: i32 = bind_name e, %.loc25 [template = constants.%.4] -// CHECK:STDOUT: %.loc36: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %f: i32 = bind_name f, %.loc36 [template = constants.%.5] -// CHECK:STDOUT: %.loc47: i32 = int_literal 1 [template = constants.%.6] -// CHECK:STDOUT: %g: i32 = bind_name g, %.loc47 [template = constants.%.6] -// CHECK:STDOUT: %.loc58: i32 = int_literal 1 [template = constants.%.7] -// CHECK:STDOUT: %h: i32 = bind_name h, %.loc58 [template = constants.%.7] -// CHECK:STDOUT: %.loc69: i32 = int_literal 1 [template = constants.%.8] -// CHECK:STDOUT: %i: i32 = bind_name i, %.loc69 [template = constants.%.8] +// CHECK:STDOUT: %.loc15: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %c: i32 = bind_name c, %.loc15 [template = constants.%.1] +// CHECK:STDOUT: %.loc20: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %d: i32 = bind_name d, %.loc20 [template = constants.%.1] +// CHECK:STDOUT: %.loc25: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %e: i32 = bind_name e, %.loc25 [template = constants.%.1] +// CHECK:STDOUT: %.loc36: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %f: i32 = bind_name f, %.loc36 [template = constants.%.1] +// CHECK:STDOUT: %.loc47: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %g: i32 = bind_name g, %.loc47 [template = constants.%.1] +// CHECK:STDOUT: %.loc58: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %h: i32 = bind_name h, %.loc58 [template = constants.%.1] +// CHECK:STDOUT: %.loc69: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %i: i32 = bind_name i, %.loc69 [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/generic.carbon b/toolchain/check/testdata/let/generic.carbon index 29e47b0a1607..d09b82d46e7a 100644 --- a/toolchain/check/testdata/let/generic.carbon +++ b/toolchain/check/testdata/let/generic.carbon @@ -12,6 +12,10 @@ fn F() { // CHECK:STDOUT: --- generic.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = ptr_type T [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} [template] // CHECK:STDOUT: %F: = fn_decl @F [template] @@ -21,7 +25,7 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T: type = bind_symbolic_name T, i32 [symbolic] // CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T [symbolic = %T] -// CHECK:STDOUT: %.loc9: type = ptr_type T [template] +// CHECK:STDOUT: %.loc9: type = ptr_type T [template = constants.%.1] // CHECK:STDOUT: %p.var: ref T* = var p // CHECK:STDOUT: %p: ref T* = bind_name p, %p.var // CHECK:STDOUT: %T.ref.loc10: type = name_ref T, %T [symbolic = %T] diff --git a/toolchain/check/testdata/namespace/shadow.carbon b/toolchain/check/testdata/namespace/shadow.carbon index 5cd1fcead696..0c1be891f25f 100644 --- a/toolchain/check/testdata/namespace/shadow.carbon +++ b/toolchain/check/testdata/namespace/shadow.carbon @@ -29,7 +29,6 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: %.1: type = tuple_type () [template] // CHECK:STDOUT: %.2: bool = bool_literal true [template] // CHECK:STDOUT: %.3: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -62,7 +61,7 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: return %.loc21 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc23: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc23: i32 = int_literal 0 [template = constants.%.3] // CHECK:STDOUT: return %.loc23 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/and.carbon b/toolchain/check/testdata/operators/and.carbon index 5a9b3cc36fe8..6a39a616de5a 100644 --- a/toolchain/check/testdata/operators/and.carbon +++ b/toolchain/check/testdata/operators/and.carbon @@ -15,8 +15,7 @@ fn And() -> bool { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: bool = bool_literal true [template] -// CHECK:STDOUT: %.3: bool = bool_literal false [template] +// CHECK:STDOUT: %.2: bool = bool_literal false [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -34,7 +33,7 @@ fn And() -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.1] // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -44,7 +43,7 @@ fn And() -> bool { // CHECK:STDOUT: %.loc11_11.1: init bool = call %F.ref() // CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %.loc11_11.1 // CHECK:STDOUT: %.loc11_11.2: bool = converted %.loc11_11.1, %.loc11_14.1 -// CHECK:STDOUT: %.loc11_14.2: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc11_14.2: bool = bool_literal false [template = constants.%.2] // CHECK:STDOUT: if %.loc11_11.2 br !and.rhs else br !and.result(%.loc11_14.2) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: diff --git a/toolchain/check/testdata/operators/assignment.carbon b/toolchain/check/testdata/operators/assignment.carbon index cade3fcfd1e0..4b278a4eab97 100644 --- a/toolchain/check/testdata/operators/assignment.carbon +++ b/toolchain/check/testdata/operators/assignment.carbon @@ -34,16 +34,13 @@ fn Main() { // CHECK:STDOUT: %.7: i32 = int_literal 2 [template] // CHECK:STDOUT: %.8: i32 = int_literal 0 [template] // CHECK:STDOUT: %.9: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.10: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.11: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.10: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.11: type = struct_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.12: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.13: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.14: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.15: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.16: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.17: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.18: bool = bool_literal true [template] -// CHECK:STDOUT: %.19: i32 = int_literal 10 [template] +// CHECK:STDOUT: %.13: type = ptr_type i32 [template] +// CHECK:STDOUT: %.14: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.15: bool = bool_literal true [template] +// CHECK:STDOUT: %.16: i32 = int_literal 10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -80,15 +77,15 @@ fn Main() { // CHECK:STDOUT: %.loc12_10: i32 = int_literal 3 [template = constants.%.9] // CHECK:STDOUT: assign %.loc12_6, %.loc12_10 // CHECK:STDOUT: %b.ref.loc13: ref (i32, i32) = name_ref b, %b -// CHECK:STDOUT: %.loc13_5: i32 = int_literal 1 [template = constants.%.10] +// CHECK:STDOUT: %.loc13_5: i32 = int_literal 1 [template = constants.%.6] // CHECK:STDOUT: %.loc13_6: ref i32 = tuple_index %b.ref.loc13, %.loc13_5 -// CHECK:STDOUT: %.loc13_10: i32 = int_literal 4 [template = constants.%.11] +// CHECK:STDOUT: %.loc13_10: i32 = int_literal 4 [template = constants.%.10] // CHECK:STDOUT: assign %.loc13_6, %.loc13_10 -// CHECK:STDOUT: %.loc15_27: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.loc15_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.11] // CHECK:STDOUT: %c.var: ref {.a: i32, .b: i32} = var c // CHECK:STDOUT: %c: ref {.a: i32, .b: i32} = bind_name c, %c.var -// CHECK:STDOUT: %.loc15_37: i32 = int_literal 1 [template = constants.%.13] -// CHECK:STDOUT: %.loc15_45: i32 = int_literal 2 [template = constants.%.14] +// CHECK:STDOUT: %.loc15_37: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc15_45: i32 = int_literal 2 [template = constants.%.7] // CHECK:STDOUT: %.loc15_46.1: {.a: i32, .b: i32} = struct_literal (%.loc15_37, %.loc15_45) // CHECK:STDOUT: %.loc15_46.2: ref i32 = struct_access %c.var, element0 // CHECK:STDOUT: %.loc15_46.3: init i32 = initialize_from %.loc15_37 to %.loc15_46.2 @@ -99,13 +96,13 @@ fn Main() { // CHECK:STDOUT: assign %c.var, %.loc15_46.7 // CHECK:STDOUT: %c.ref.loc16: ref {.a: i32, .b: i32} = name_ref c, %c // CHECK:STDOUT: %.loc16_4: ref i32 = struct_access %c.ref.loc16, element0 -// CHECK:STDOUT: %.loc16_9: i32 = int_literal 3 [template = constants.%.15] +// CHECK:STDOUT: %.loc16_9: i32 = int_literal 3 [template = constants.%.9] // CHECK:STDOUT: assign %.loc16_4, %.loc16_9 // CHECK:STDOUT: %c.ref.loc17: ref {.a: i32, .b: i32} = name_ref c, %c // CHECK:STDOUT: %.loc17_4: ref i32 = struct_access %c.ref.loc17, element1 -// CHECK:STDOUT: %.loc17_9: i32 = int_literal 4 [template = constants.%.16] +// CHECK:STDOUT: %.loc17_9: i32 = int_literal 4 [template = constants.%.10] // CHECK:STDOUT: assign %.loc17_4, %.loc17_9 -// CHECK:STDOUT: %.loc19_13: type = ptr_type i32 [template] +// CHECK:STDOUT: %.loc19_13: type = ptr_type i32 [template = constants.%.13] // CHECK:STDOUT: %p.var: ref i32* = var p // CHECK:STDOUT: %p: ref i32* = bind_name p, %p.var // CHECK:STDOUT: %a.ref.loc19: ref i32 = name_ref a, %a @@ -114,9 +111,9 @@ fn Main() { // CHECK:STDOUT: %p.ref.loc20: ref i32* = name_ref p, %p // CHECK:STDOUT: %.loc20_4: i32* = bind_value %p.ref.loc20 // CHECK:STDOUT: %.loc20_3: ref i32 = deref %.loc20_4 -// CHECK:STDOUT: %.loc20_8: i32 = int_literal 5 [template = constants.%.17] +// CHECK:STDOUT: %.loc20_8: i32 = int_literal 5 [template = constants.%.14] // CHECK:STDOUT: assign %.loc20_3, %.loc20_8 -// CHECK:STDOUT: %.loc22_8: bool = bool_literal true [template = constants.%.18] +// CHECK:STDOUT: %.loc22_8: bool = bool_literal true [template = constants.%.15] // CHECK:STDOUT: if %.loc22_8 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: @@ -132,7 +129,7 @@ fn Main() { // CHECK:STDOUT: !if.expr.result: // CHECK:STDOUT: %.loc22_5: i32* = block_arg !if.expr.result // CHECK:STDOUT: %.loc22_3: ref i32 = deref %.loc22_5 -// CHECK:STDOUT: %.loc22_31: i32 = int_literal 10 [template = constants.%.19] +// CHECK:STDOUT: %.loc22_31: i32 = int_literal 10 [template = constants.%.16] // CHECK:STDOUT: assign %.loc22_3, %.loc22_31 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/fail_assignment_to_error.carbon b/toolchain/check/testdata/operators/fail_assignment_to_error.carbon index a1f03eff9a08..06d4f8780fc7 100644 --- a/toolchain/check/testdata/operators/fail_assignment_to_error.carbon +++ b/toolchain/check/testdata/operators/fail_assignment_to_error.carbon @@ -19,7 +19,6 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 42 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 42 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -34,7 +33,7 @@ fn Main() { // CHECK:STDOUT: assign %undeclared.ref, // CHECK:STDOUT: %also_undeclared.ref: = name_ref also_undeclared, // CHECK:STDOUT: %.loc15_3: ref = deref -// CHECK:STDOUT: %.loc15_22: i32 = int_literal 42 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_22: i32 = int_literal 42 [template = constants.%.1] // CHECK:STDOUT: assign %.loc15_3, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon b/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon index 91ad53d9525f..c9201fadf376 100644 --- a/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon +++ b/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon @@ -50,30 +50,18 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] // CHECK:STDOUT: %.2: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.6: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.7: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.8: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.9: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.10: (i32, i32) = tuple_value (%.4, %.5) [template] -// CHECK:STDOUT: %.11: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.12: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.13: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.14: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.15: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.16: type = struct_type {.x: i32, .y: i32} [template] -// CHECK:STDOUT: %.17: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.18: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.19: type = ptr_type {.x: i32, .y: i32} [template] -// CHECK:STDOUT: %.20: {.x: i32, .y: i32} = struct_value (%.14, %.15) [template] -// CHECK:STDOUT: %.21: bool = bool_literal true [template] -// CHECK:STDOUT: %.22: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.23: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.24: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.25: bool = bool_literal true [template] -// CHECK:STDOUT: %.26: i32 = int_literal 10 [template] +// CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.6: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.7: (i32, i32) = tuple_value (%.1, %.2) [template] +// CHECK:STDOUT: %.8: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.9: type = ptr_type i32 [template] +// CHECK:STDOUT: %.10: type = struct_type {.x: i32, .y: i32} [template] +// CHECK:STDOUT: %.11: type = ptr_type {.x: i32, .y: i32} [template] +// CHECK:STDOUT: %.12: {.x: i32, .y: i32} = struct_value (%.1, %.2) [template] +// CHECK:STDOUT: %.13: bool = bool_literal true [template] +// CHECK:STDOUT: %.14: i32 = int_literal 10 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -91,13 +79,13 @@ fn Main() { // CHECK:STDOUT: assign %.loc13_3, %.loc13_7 // CHECK:STDOUT: %F.ref: = name_ref F, file.%F [template = file.%F] // CHECK:STDOUT: %.loc17_4: init i32 = call %F.ref() -// CHECK:STDOUT: %.loc17_9: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc17_9: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: assign %.loc17_4, %.loc17_9 -// CHECK:STDOUT: %.loc21_4: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc21_7: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc21_4: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc21_7: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: %.loc21_8.1: (i32, i32) = tuple_literal (%.loc21_4, %.loc21_7) -// CHECK:STDOUT: %.loc21_13: i32 = int_literal 3 [template = constants.%.7] -// CHECK:STDOUT: %.loc21_16: i32 = int_literal 4 [template = constants.%.8] +// CHECK:STDOUT: %.loc21_13: i32 = int_literal 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc21_16: i32 = int_literal 4 [template = constants.%.5] // CHECK:STDOUT: %.loc21_17.1: (i32, i32) = tuple_literal (%.loc21_13, %.loc21_16) // CHECK:STDOUT: %.loc21_17.2: i32 = tuple_access %.loc21_8.1, element0 // CHECK:STDOUT: %.loc21_17.3: init i32 = initialize_from %.loc21_13 to %.loc21_17.2 @@ -106,17 +94,17 @@ fn Main() { // CHECK:STDOUT: %.loc21_17.6: init (i32, i32) = tuple_init (%.loc21_17.3, %.loc21_17.5) to %.loc21_8.1 // CHECK:STDOUT: %.loc21_17.7: init (i32, i32) = converted %.loc21_17.1, %.loc21_17.6 // CHECK:STDOUT: assign %.loc21_8.1, %.loc21_17.7 -// CHECK:STDOUT: %.loc21_8.2: (i32, i32) = tuple_value (%.loc21_4, %.loc21_7) [template = constants.%.10] -// CHECK:STDOUT: %.loc21_8.3: (i32, i32) = converted %.loc21_8.1, %.loc21_8.2 [template = constants.%.10] +// CHECK:STDOUT: %.loc21_8.2: (i32, i32) = tuple_value (%.loc21_4, %.loc21_7) [template = constants.%.7] +// CHECK:STDOUT: %.loc21_8.3: (i32, i32) = converted %.loc21_8.1, %.loc21_8.2 [template = constants.%.7] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc22: i32 = int_literal 0 [template = constants.%.11] +// CHECK:STDOUT: %.loc22: i32 = int_literal 0 [template = constants.%.8] // CHECK:STDOUT: assign %n.var, %.loc22 // CHECK:STDOUT: %n.ref.loc26_4: ref i32 = name_ref n, %n // CHECK:STDOUT: %n.ref.loc26_7: ref i32 = name_ref n, %n // CHECK:STDOUT: %.loc26_8.1: (i32, i32) = tuple_literal (%n.ref.loc26_4, %n.ref.loc26_7) -// CHECK:STDOUT: %.loc26_13: i32 = int_literal 1 [template = constants.%.12] -// CHECK:STDOUT: %.loc26_16: i32 = int_literal 2 [template = constants.%.13] +// CHECK:STDOUT: %.loc26_13: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc26_16: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: %.loc26_17.1: (i32, i32) = tuple_literal (%.loc26_13, %.loc26_16) // CHECK:STDOUT: %.loc26_17.2: i32 = tuple_access %.loc26_8.1, element0 // CHECK:STDOUT: %.loc26_17.3: init i32 = initialize_from %.loc26_13 to %.loc26_17.2 @@ -129,13 +117,13 @@ fn Main() { // CHECK:STDOUT: %.loc26_7: i32 = bind_value %n.ref.loc26_7 // CHECK:STDOUT: %.loc26_8.2: (i32, i32) = tuple_value (%.loc26_4, %.loc26_7) // CHECK:STDOUT: %.loc26_8.3: (i32, i32) = converted %.loc26_8.1, %.loc26_8.2 -// CHECK:STDOUT: %.loc30: type = ptr_type i32 [template] +// CHECK:STDOUT: %.loc30: type = ptr_type i32 [template = constants.%.9] // CHECK:STDOUT: assign i32, %.loc30 -// CHECK:STDOUT: %.loc34_9: i32 = int_literal 1 [template = constants.%.14] -// CHECK:STDOUT: %.loc34_17: i32 = int_literal 2 [template = constants.%.15] +// CHECK:STDOUT: %.loc34_9: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc34_17: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: %.loc34_18.1: {.x: i32, .y: i32} = struct_literal (%.loc34_9, %.loc34_17) -// CHECK:STDOUT: %.loc34_28: i32 = int_literal 3 [template = constants.%.17] -// CHECK:STDOUT: %.loc34_36: i32 = int_literal 4 [template = constants.%.18] +// CHECK:STDOUT: %.loc34_28: i32 = int_literal 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc34_36: i32 = int_literal 4 [template = constants.%.5] // CHECK:STDOUT: %.loc34_37.1: {.x: i32, .y: i32} = struct_literal (%.loc34_28, %.loc34_36) // CHECK:STDOUT: %.loc34_37.2: i32 = struct_access %.loc34_18.1, element0 // CHECK:STDOUT: %.loc34_37.3: init i32 = initialize_from %.loc34_28 to %.loc34_37.2 @@ -144,26 +132,26 @@ fn Main() { // CHECK:STDOUT: %.loc34_37.6: init {.x: i32, .y: i32} = struct_init (%.loc34_37.3, %.loc34_37.5) to %.loc34_18.1 // CHECK:STDOUT: %.loc34_37.7: init {.x: i32, .y: i32} = converted %.loc34_37.1, %.loc34_37.6 // CHECK:STDOUT: assign %.loc34_18.1, %.loc34_37.7 -// CHECK:STDOUT: %.loc34_18.2: {.x: i32, .y: i32} = struct_value (%.loc34_9, %.loc34_17) [template = constants.%.20] -// CHECK:STDOUT: %.loc34_18.3: {.x: i32, .y: i32} = converted %.loc34_18.1, %.loc34_18.2 [template = constants.%.20] -// CHECK:STDOUT: %.loc38_7: bool = bool_literal true [template = constants.%.21] +// CHECK:STDOUT: %.loc34_18.2: {.x: i32, .y: i32} = struct_value (%.loc34_9, %.loc34_17) [template = constants.%.12] +// CHECK:STDOUT: %.loc34_18.3: {.x: i32, .y: i32} = converted %.loc34_18.1, %.loc34_18.2 [template = constants.%.12] +// CHECK:STDOUT: %.loc38_7: bool = bool_literal true [template = constants.%.13] // CHECK:STDOUT: if %.loc38_7 br !if.expr.then.loc38 else br !if.expr.else.loc38 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc38: -// CHECK:STDOUT: %.loc38_17: i32 = int_literal 1 [template = constants.%.22] +// CHECK:STDOUT: %.loc38_17: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: br !if.expr.result.loc38(%.loc38_17) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc38: -// CHECK:STDOUT: %.loc38_24: i32 = int_literal 2 [template = constants.%.23] +// CHECK:STDOUT: %.loc38_24: i32 = int_literal 2 [template = constants.%.2] // CHECK:STDOUT: br !if.expr.result.loc38(%.loc38_24) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc38: // CHECK:STDOUT: %.loc38_4: i32 = block_arg !if.expr.result.loc38 -// CHECK:STDOUT: %.loc38_29: i32 = int_literal 3 [template = constants.%.24] +// CHECK:STDOUT: %.loc38_29: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: assign %.loc38_4, %.loc38_29 // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc45_7: bool = bool_literal true [template = constants.%.25] +// CHECK:STDOUT: %.loc45_7: bool = bool_literal true [template = constants.%.13] // CHECK:STDOUT: if %.loc45_7 br !if.expr.then.loc45 else br !if.expr.else.loc45 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc45: @@ -178,7 +166,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc45: // CHECK:STDOUT: %.loc45_4: i32 = block_arg !if.expr.result.loc45 -// CHECK:STDOUT: %.loc45_29: i32 = int_literal 10 [template = constants.%.26] +// CHECK:STDOUT: %.loc45_29: i32 = int_literal 10 [template = constants.%.14] // CHECK:STDOUT: assign %.loc45_4, %.loc45_29 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/or.carbon b/toolchain/check/testdata/operators/or.carbon index 251e7f1fc29c..c3d550115820 100644 --- a/toolchain/check/testdata/operators/or.carbon +++ b/toolchain/check/testdata/operators/or.carbon @@ -15,8 +15,6 @@ fn Or() -> bool { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: bool = bool_literal true [template] -// CHECK:STDOUT: %.2: bool = bool_literal true [template] -// CHECK:STDOUT: %.3: bool = bool_literal true [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -34,7 +32,7 @@ fn Or() -> bool { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.1] // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -45,7 +43,7 @@ fn Or() -> bool { // CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %.loc11_11.1 // CHECK:STDOUT: %.loc11_11.2: bool = converted %.loc11_11.1, %.loc11_14.1 // CHECK:STDOUT: %.loc11_14.2: bool = not %.loc11_11.2 -// CHECK:STDOUT: %.loc11_14.3: bool = bool_literal true [template = constants.%.3] +// CHECK:STDOUT: %.loc11_14.3: bool = bool_literal true [template = constants.%.1] // CHECK:STDOUT: if %.loc11_14.2 br !or.rhs else br !or.result(%.loc11_14.3) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs: diff --git a/toolchain/check/testdata/operators/unary_op.carbon b/toolchain/check/testdata/operators/unary_op.carbon index 27a3aaa84e32..79f9774ae302 100644 --- a/toolchain/check/testdata/operators/unary_op.carbon +++ b/toolchain/check/testdata/operators/unary_op.carbon @@ -16,8 +16,6 @@ let not_false: bool = not false; // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: bool = bool_literal true [template] // CHECK:STDOUT: %.2: bool = bool_literal false [template] -// CHECK:STDOUT: %.3: bool = bool_literal false [template] -// CHECK:STDOUT: %.4: bool = bool_literal true [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -26,9 +24,9 @@ let not_false: bool = not false; // CHECK:STDOUT: %.loc11_26: bool = bool_literal true [template = constants.%.1] // CHECK:STDOUT: %.loc11_22: bool = not %.loc11_26 [template = constants.%.2] // CHECK:STDOUT: %not_true: bool = bind_name not_true, %.loc11_22 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_27: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: %.loc12_23: bool = not %.loc12_27 [template = constants.%.4] -// CHECK:STDOUT: %not_false: bool = bind_name not_false, %.loc12_23 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_27: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc12_23: bool = not %.loc12_27 [template = constants.%.1] +// CHECK:STDOUT: %not_false: bool = bind_name not_false, %.loc12_23 [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Not(%b: bool) -> bool { diff --git a/toolchain/check/testdata/package_expr/syntax.carbon b/toolchain/check/testdata/package_expr/syntax.carbon index 5ccd6852feac..00945811053c 100644 --- a/toolchain/check/testdata/package_expr/syntax.carbon +++ b/toolchain/check/testdata/package_expr/syntax.carbon @@ -107,6 +107,7 @@ fn Main() { // CHECK:STDOUT: --- namespace.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: } @@ -115,7 +116,7 @@ fn Main() { // CHECK:STDOUT: package: = namespace package, {.NS = %.loc4, .Main = %Main} [template] // CHECK:STDOUT: %.loc4: = namespace NS, {.C = %C.decl} [template] // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @C [template = constants.%C] // CHECK:STDOUT: %Main: = fn_decl @Main [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -135,7 +136,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, file.%C [template = file.%C] +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C [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/pointer/address_of_lvalue.carbon b/toolchain/check/testdata/pointer/address_of_lvalue.carbon index bb771043d99e..05a823ad76c8 100644 --- a/toolchain/check/testdata/pointer/address_of_lvalue.carbon +++ b/toolchain/check/testdata/pointer/address_of_lvalue.carbon @@ -19,16 +19,15 @@ fn F() { // CHECK:STDOUT: --- address_of_lvalue.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.4: type = tuple_type (type, type) [template] -// CHECK:STDOUT: %.5: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.6: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.7: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.8: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.5: type = ptr_type i32 [template] +// CHECK:STDOUT: %.6: type = tuple_type (type, type) [template] +// CHECK:STDOUT: %.7: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.8: type = ptr_type (i32, i32) [template] // CHECK:STDOUT: %.9: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.10: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -38,11 +37,11 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_27: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.loc8_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] // CHECK:STDOUT: %s.var: ref {.a: i32, .b: i32} = var s // CHECK:STDOUT: %s: ref {.a: i32, .b: i32} = bind_name s, %s.var -// CHECK:STDOUT: %.loc8_37: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_45: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_37: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc8_45: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: %.loc8_46.1: {.a: i32, .b: i32} = struct_literal (%.loc8_37, %.loc8_45) // CHECK:STDOUT: %.loc8_46.2: ref i32 = struct_access %s.var, element0 // CHECK:STDOUT: %.loc8_46.3: init i32 = initialize_from %.loc8_37 to %.loc8_46.2 @@ -51,21 +50,21 @@ fn F() { // CHECK:STDOUT: %.loc8_46.6: init {.a: i32, .b: i32} = struct_init (%.loc8_46.3, %.loc8_46.5) to %s.var // CHECK:STDOUT: %.loc8_46.7: init {.a: i32, .b: i32} = converted %.loc8_46.1, %.loc8_46.6 // CHECK:STDOUT: assign %s.var, %.loc8_46.7 -// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.loc10_28: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] +// CHECK:STDOUT: %.loc10_28: type = ptr_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %p.var: ref {.a: i32, .b: i32}* = var p // CHECK:STDOUT: %p: ref {.a: i32, .b: i32}* = bind_name p, %p.var // CHECK:STDOUT: %s.ref.loc10: ref {.a: i32, .b: i32} = name_ref s, %s // CHECK:STDOUT: %.loc10_32: {.a: i32, .b: i32}* = addr_of %s.ref.loc10 // CHECK:STDOUT: assign %p.var, %.loc10_32 -// CHECK:STDOUT: %.loc11_13: type = ptr_type i32 [template] +// CHECK:STDOUT: %.loc11_13: type = ptr_type i32 [template = constants.%.5] // CHECK:STDOUT: %q.var: ref i32* = var q // CHECK:STDOUT: %q: ref i32* = bind_name q, %q.var // CHECK:STDOUT: %s.ref.loc11: ref {.a: i32, .b: i32} = name_ref s, %s // CHECK:STDOUT: %.loc11_19: ref i32 = struct_access %s.ref.loc11, element0 // CHECK:STDOUT: %.loc11_17: i32* = addr_of %.loc11_19 // CHECK:STDOUT: assign %q.var, %.loc11_17 -// CHECK:STDOUT: %.loc12_13: type = ptr_type i32 [template] +// CHECK:STDOUT: %.loc12_13: type = ptr_type i32 [template = constants.%.5] // CHECK:STDOUT: %r.var: ref i32* = var r // CHECK:STDOUT: %r: ref i32* = bind_name r, %r.var // CHECK:STDOUT: %s.ref.loc12: ref {.a: i32, .b: i32} = name_ref s, %s @@ -73,11 +72,11 @@ fn F() { // CHECK:STDOUT: %.loc12_17: i32* = addr_of %.loc12_19 // CHECK:STDOUT: assign %r.var, %.loc12_17 // CHECK:STDOUT: %.loc14_19.1: (type, type) = tuple_literal (i32, i32) -// CHECK:STDOUT: %.loc14_19.2: type = converted %.loc14_19.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_19.2: type = converted %.loc14_19.1, constants.%.7 [template = constants.%.7] // CHECK:STDOUT: %t.var: ref (i32, i32) = var t // CHECK:STDOUT: %t: ref (i32, i32) = bind_name t, %t.var -// CHECK:STDOUT: %.loc14_24: i32 = int_literal 1 [template = constants.%.7] -// CHECK:STDOUT: %.loc14_27: i32 = int_literal 2 [template = constants.%.8] +// CHECK:STDOUT: %.loc14_24: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_27: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: %.loc14_28.1: (i32, i32) = tuple_literal (%.loc14_24, %.loc14_27) // CHECK:STDOUT: %.loc14_28.2: ref i32 = tuple_access %t.var, element0 // CHECK:STDOUT: %.loc14_28.3: init i32 = initialize_from %.loc14_24 to %.loc14_28.2 @@ -86,7 +85,7 @@ fn F() { // CHECK:STDOUT: %.loc14_28.6: init (i32, i32) = tuple_init (%.loc14_28.3, %.loc14_28.5) to %t.var // CHECK:STDOUT: %.loc14_28.7: init (i32, i32) = converted %.loc14_28.1, %.loc14_28.6 // CHECK:STDOUT: assign %t.var, %.loc14_28.7 -// CHECK:STDOUT: %.loc15_14: type = ptr_type i32 [template] +// CHECK:STDOUT: %.loc15_14: type = ptr_type i32 [template = constants.%.5] // CHECK:STDOUT: %t0.var: ref i32* = var t0 // CHECK:STDOUT: %t0: ref i32* = bind_name t0, %t0.var // CHECK:STDOUT: %t.ref.loc15: ref (i32, i32) = name_ref t, %t @@ -94,11 +93,11 @@ fn F() { // CHECK:STDOUT: %.loc15_22: ref i32 = tuple_index %t.ref.loc15, %.loc15_21 // CHECK:STDOUT: %.loc15_18: i32* = addr_of %.loc15_22 // CHECK:STDOUT: assign %t0.var, %.loc15_18 -// CHECK:STDOUT: %.loc16_14: type = ptr_type i32 [template] +// CHECK:STDOUT: %.loc16_14: type = ptr_type i32 [template = constants.%.5] // CHECK:STDOUT: %t1.var: ref i32* = var t1 // CHECK:STDOUT: %t1: ref i32* = bind_name t1, %t1.var // CHECK:STDOUT: %t.ref.loc16: ref (i32, i32) = name_ref t, %t -// CHECK:STDOUT: %.loc16_21: i32 = int_literal 1 [template = constants.%.10] +// CHECK:STDOUT: %.loc16_21: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: %.loc16_22: ref i32 = tuple_index %t.ref.loc16, %.loc16_21 // CHECK:STDOUT: %.loc16_18: i32* = addr_of %.loc16_22 // CHECK:STDOUT: assign %t1.var, %.loc16_18 diff --git a/toolchain/check/testdata/pointer/basic.carbon b/toolchain/check/testdata/pointer/basic.carbon index 75ce968a1113..6ee8ed5894f3 100644 --- a/toolchain/check/testdata/pointer/basic.carbon +++ b/toolchain/check/testdata/pointer/basic.carbon @@ -15,6 +15,7 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.2: type = ptr_type i32 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -28,7 +29,7 @@ fn F() -> i32 { // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var // CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.1] // CHECK:STDOUT: assign %n.var, %.loc8 -// CHECK:STDOUT: %.loc9_13: type = ptr_type i32 [template] +// CHECK:STDOUT: %.loc9_13: type = ptr_type i32 [template = constants.%.2] // CHECK:STDOUT: %p.var: ref i32* = var p // CHECK:STDOUT: %p: ref i32* = bind_name p, %p.var // CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n diff --git a/toolchain/check/testdata/pointer/fail_address_of_value.carbon b/toolchain/check/testdata/pointer/fail_address_of_value.carbon index 45a3257618db..40c314555b92 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_value.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_value.carbon @@ -85,36 +85,32 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: --- fail_address_of_value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: type = ptr_type i32 [template] -// CHECK:STDOUT: %.3: i32* = addr_of %.1 [template] -// CHECK:STDOUT: %.4: bool = bool_literal true [template] -// CHECK:STDOUT: %.5: type = ptr_type bool [template] -// CHECK:STDOUT: %.6: bool* = addr_of %.4 [template] -// CHECK:STDOUT: %.7: f64 = real_literal 10e-1 [template] -// CHECK:STDOUT: %.8: type = ptr_type f64 [template] -// CHECK:STDOUT: %.9: f64* = addr_of %.7 [template] -// CHECK:STDOUT: %.10: type = ptr_type String [template] -// CHECK:STDOUT: %.11: String = string_literal "Hello" [template] -// CHECK:STDOUT: %.12: String* = addr_of %.11 [template] -// CHECK:STDOUT: %.13: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.14: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.15: type = tuple_type (i32, i32) [template] -// CHECK:STDOUT: %.16: type = ptr_type (i32, i32) [template] -// CHECK:STDOUT: %.17: i32 = int_literal 5 [template] -// CHECK:STDOUT: %.18: type = ptr_type {.a: i32} [template] -// CHECK:STDOUT: %.19: bool = bool_literal true [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] +// CHECK:STDOUT: %.3: type = ptr_type i32 [template] +// CHECK:STDOUT: %.4: i32* = addr_of %.2 [template] +// CHECK:STDOUT: %.5: bool = bool_literal true [template] +// CHECK:STDOUT: %.6: type = ptr_type bool [template] +// CHECK:STDOUT: %.7: bool* = addr_of %.5 [template] +// CHECK:STDOUT: %.8: f64 = real_literal 10e-1 [template] +// CHECK:STDOUT: %.9: type = ptr_type f64 [template] +// CHECK:STDOUT: %.10: f64* = addr_of %.8 [template] +// CHECK:STDOUT: %.11: type = ptr_type String [template] +// CHECK:STDOUT: %.12: String = string_literal "Hello" [template] +// CHECK:STDOUT: %.13: String* = addr_of %.12 [template] +// CHECK:STDOUT: %.14: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.15: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.16: type = tuple_type (i32, i32) [template] +// CHECK:STDOUT: %.17: type = ptr_type (i32, i32) [template] +// CHECK:STDOUT: %.18: i32 = int_literal 5 [template] +// CHECK:STDOUT: %.19: type = ptr_type {.a: i32} [template] // CHECK:STDOUT: %.20: bool = bool_literal false [template] -// CHECK:STDOUT: %.21: bool = bool_literal false [template] -// CHECK:STDOUT: %.22: bool = bool_literal true [template] -// CHECK:STDOUT: %.23: bool = bool_literal false [template] -// CHECK:STDOUT: %.24: bool* = addr_of %.23 [template] -// CHECK:STDOUT: %.25: type = ptr_type type [template] -// CHECK:STDOUT: %.26: type* = addr_of @AddressOfType.%.loc68_14 [template] -// CHECK:STDOUT: %.27: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.28: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.29: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.30: (i32, i32) = tuple_value (%.27, %.28) [template] +// CHECK:STDOUT: %.21: bool* = addr_of %.20 [template] +// CHECK:STDOUT: %.22: type = ptr_type type [template] +// CHECK:STDOUT: %.23: type = const_type i32 [template] +// CHECK:STDOUT: %.24: type = ptr_type const i32 [template] +// CHECK:STDOUT: %.25: type* = addr_of %.24 [template] +// CHECK:STDOUT: %.26: (i32, i32) = tuple_value (%.14, %.15) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -135,19 +131,19 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfLiteral() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_4: i32 = int_literal 0 [template = constants.%.1] -// CHECK:STDOUT: %.loc15_3: i32* = addr_of %.loc15_4 [template = constants.%.3] -// CHECK:STDOUT: %.loc19_4: bool = bool_literal true [template = constants.%.4] -// CHECK:STDOUT: %.loc19_3: bool* = addr_of %.loc19_4 [template = constants.%.6] -// CHECK:STDOUT: %.loc23_4: f64 = real_literal 10e-1 [template = constants.%.7] -// CHECK:STDOUT: %.loc23_3: f64* = addr_of %.loc23_4 [template = constants.%.9] -// CHECK:STDOUT: %.loc27_4: String = string_literal "Hello" [template = constants.%.11] -// CHECK:STDOUT: %.loc27_3: String* = addr_of %.loc27_4 [template = constants.%.12] -// CHECK:STDOUT: %.loc31_5: i32 = int_literal 1 [template = constants.%.13] -// CHECK:STDOUT: %.loc31_8: i32 = int_literal 2 [template = constants.%.14] +// CHECK:STDOUT: %.loc15_4: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_3: i32* = addr_of %.loc15_4 [template = constants.%.4] +// CHECK:STDOUT: %.loc19_4: bool = bool_literal true [template = constants.%.5] +// CHECK:STDOUT: %.loc19_3: bool* = addr_of %.loc19_4 [template = constants.%.7] +// CHECK:STDOUT: %.loc23_4: f64 = real_literal 10e-1 [template = constants.%.8] +// CHECK:STDOUT: %.loc23_3: f64* = addr_of %.loc23_4 [template = constants.%.10] +// CHECK:STDOUT: %.loc27_4: String = string_literal "Hello" [template = constants.%.12] +// CHECK:STDOUT: %.loc27_3: String* = addr_of %.loc27_4 [template = constants.%.13] +// CHECK:STDOUT: %.loc31_5: i32 = int_literal 1 [template = constants.%.14] +// CHECK:STDOUT: %.loc31_8: i32 = int_literal 2 [template = constants.%.15] // CHECK:STDOUT: %.loc31_9: (i32, i32) = tuple_literal (%.loc31_5, %.loc31_8) // CHECK:STDOUT: %.loc31_3: (i32, i32)* = addr_of %.loc31_9 -// CHECK:STDOUT: %.loc35_10: i32 = int_literal 5 [template = constants.%.17] +// CHECK:STDOUT: %.loc35_10: i32 = int_literal 5 [template = constants.%.18] // CHECK:STDOUT: %.loc35_11: {.a: i32} = struct_literal (%.loc35_10) // CHECK:STDOUT: %.loc35_3: {.a: i32}* = addr_of %.loc35_11 // CHECK:STDOUT: return @@ -155,12 +151,12 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfOperator() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc42_5: bool = bool_literal true [template = constants.%.19] +// CHECK:STDOUT: %.loc42_5: bool = bool_literal true [template = constants.%.5] // CHECK:STDOUT: %.loc42_10.1: bool = bool_literal false [template = constants.%.20] // CHECK:STDOUT: if %.loc42_5 br !and.rhs else br !and.result(%.loc42_10.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %.loc42_14: bool = bool_literal false [template = constants.%.21] +// CHECK:STDOUT: %.loc42_14: bool = bool_literal false [template = constants.%.20] // CHECK:STDOUT: br !and.result(%.loc42_14) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: @@ -172,9 +168,9 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: %.loc46_5.3: ref {.a: i32} = temporary %.loc46_5.2, %.loc46_5.1 // CHECK:STDOUT: %.loc46_7: ref i32 = struct_access %.loc46_5.3, element0 // CHECK:STDOUT: %.loc46_3: i32* = addr_of %.loc46_7 -// CHECK:STDOUT: %.loc50_9: bool = bool_literal true [template = constants.%.22] -// CHECK:STDOUT: %.loc50_5: bool = not %.loc50_9 [template = constants.%.23] -// CHECK:STDOUT: %.loc50_3: bool* = addr_of %.loc50_5 [template = constants.%.24] +// CHECK:STDOUT: %.loc50_9: bool = bool_literal true [template = constants.%.5] +// CHECK:STDOUT: %.loc50_5: bool = not %.loc50_9 [template = constants.%.20] +// CHECK:STDOUT: %.loc50_3: bool* = addr_of %.loc50_5 [template = constants.%.21] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -189,20 +185,20 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: fn @AddressOfType() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc64: type* = addr_of i32 -// CHECK:STDOUT: %.loc68_5: type = const_type i32 [template] -// CHECK:STDOUT: %.loc68_14: type = ptr_type const i32 [template] -// CHECK:STDOUT: %.loc68_3: type* = addr_of %.loc68_14 [template = constants.%.26] +// CHECK:STDOUT: %.loc68_5: type = const_type i32 [template = constants.%.23] +// CHECK:STDOUT: %.loc68_14: type = ptr_type const i32 [template = constants.%.24] +// CHECK:STDOUT: %.loc68_3: type* = addr_of %.loc68_14 [template = constants.%.25] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfTupleElementValue() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc75_6: i32 = int_literal 1 [template = constants.%.27] -// CHECK:STDOUT: %.loc75_9: i32 = int_literal 2 [template = constants.%.28] +// CHECK:STDOUT: %.loc75_6: i32 = int_literal 1 [template = constants.%.14] +// CHECK:STDOUT: %.loc75_9: i32 = int_literal 2 [template = constants.%.15] // CHECK:STDOUT: %.loc75_10.1: (i32, i32) = tuple_literal (%.loc75_6, %.loc75_9) -// CHECK:STDOUT: %.loc75_12: i32 = int_literal 0 [template = constants.%.29] -// CHECK:STDOUT: %.loc75_10.2: (i32, i32) = tuple_value (%.loc75_6, %.loc75_9) [template = constants.%.30] -// CHECK:STDOUT: %.loc75_10.3: (i32, i32) = converted %.loc75_10.1, %.loc75_10.2 [template = constants.%.30] +// CHECK:STDOUT: %.loc75_12: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc75_10.2: (i32, i32) = tuple_value (%.loc75_6, %.loc75_9) [template = constants.%.26] +// CHECK:STDOUT: %.loc75_10.3: (i32, i32) = converted %.loc75_10.1, %.loc75_10.2 [template = constants.%.26] // CHECK:STDOUT: %.loc75_13: i32 = tuple_index %.loc75_10.3, %.loc75_12 // CHECK:STDOUT: %.loc75_3: i32* = addr_of %.loc75_13 // CHECK:STDOUT: return @@ -210,7 +206,7 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfParam(%param: i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc82_22: type = ptr_type i32 [template] +// CHECK:STDOUT: %.loc82_22: type = ptr_type i32 [template = constants.%.3] // CHECK:STDOUT: %param_addr.var: ref i32* = var param_addr // CHECK:STDOUT: %param_addr: ref i32* = bind_name param_addr, %param_addr.var // CHECK:STDOUT: %param.ref: i32 = name_ref param, %param diff --git a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon index 73fad6a844b1..f06645f85b21 100644 --- a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon @@ -15,6 +15,10 @@ fn ConstMismatch(p: const {}*) -> const ({}*) { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.2: type = const_type {} [template] +// CHECK:STDOUT: %.3: type = ptr_type const {} [template] +// CHECK:STDOUT: %.4: type = ptr_type {} [template] +// CHECK:STDOUT: %.5: type = const_type {}* [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/pointer/nested_const.carbon b/toolchain/check/testdata/pointer/nested_const.carbon index 148ef4ee84ba..407a3452ad2c 100644 --- a/toolchain/check/testdata/pointer/nested_const.carbon +++ b/toolchain/check/testdata/pointer/nested_const.carbon @@ -11,6 +11,14 @@ fn F(p: const (const (const i32*)*)) -> const i32 { // CHECK:STDOUT: --- nested_const.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = const_type i32 [template] +// CHECK:STDOUT: %.2: type = ptr_type const i32 [template] +// CHECK:STDOUT: %.3: type = const_type const i32* [template] +// CHECK:STDOUT: %.4: type = ptr_type const (const i32*) [template] +// CHECK:STDOUT: %.5: type = const_type const (const i32*)* [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} [template] // CHECK:STDOUT: %F: = fn_decl @F [template] diff --git a/toolchain/check/testdata/pointer/types.carbon b/toolchain/check/testdata/pointer/types.carbon index 686d8733a0f9..7bbbd0e9389a 100644 --- a/toolchain/check/testdata/pointer/types.carbon +++ b/toolchain/check/testdata/pointer/types.carbon @@ -14,6 +14,12 @@ fn ConstPtr(p: const i32*) -> (const i32)* { // CHECK:STDOUT: --- types.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = ptr_type i32 [template] +// CHECK:STDOUT: %.2: type = const_type i32 [template] +// CHECK:STDOUT: %.3: type = ptr_type const i32 [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Ptr = %Ptr, .ConstPtr = %ConstPtr} [template] // CHECK:STDOUT: %Ptr: = fn_decl @Ptr [template] 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 72ce1f595016..4f7ab8864940 100644 --- a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon @@ -32,9 +32,10 @@ fn G() -> C { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 0 [template] // CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %.3: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.a: i32, .b: i32} [template] // CHECK:STDOUT: %.6: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -42,15 +43,15 @@ fn G() -> C { // CHECK:STDOUT: package: = namespace package, {.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: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @C [template = constants.%C] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc18_16.1: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.loc18_16.1: type = unbound_element_type C, i32 [template = constants.%.3] // CHECK:STDOUT: %.loc18_16.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc18_16.2 [template = %.loc18_16.2] -// CHECK:STDOUT: %.loc18_28.1: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.loc18_28.1: type = unbound_element_type C, i32 [template = constants.%.3] // CHECK:STDOUT: %.loc18_28.2: = field_decl b, element1 [template] // CHECK:STDOUT: %b: = bind_name b, %.loc18_28.2 [template = %.loc18_28.2] // CHECK:STDOUT: @@ -71,9 +72,9 @@ fn G() -> C { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> %return: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C [template = file.%C] +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C [template = constants.%C] // CHECK:STDOUT: %c: ref C = bind_name c, %return -// CHECK:STDOUT: %.loc20_29: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc20_29: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc20_37: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc20_38.1: {.a: i32, .b: i32} = struct_literal (%.loc20_29, %.loc20_37) // CHECK:STDOUT: %.loc20_38.2: ref i32 = class_element_access %return, element0 diff --git a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon index b2ac40cf22af..edd459357aa5 100644 --- a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon @@ -40,12 +40,6 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: %.1: bool = bool_literal true [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.5: bool = bool_literal true [template] -// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.7: bool = bool_literal true [template] -// CHECK:STDOUT: %.8: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.9: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -71,27 +65,27 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc18: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc18: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: return %.loc18 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @DifferentScopes() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22: bool = bool_literal true [template = constants.%.5] +// CHECK:STDOUT: %.loc22: bool = bool_literal true [template = constants.%.1] // CHECK:STDOUT: if %.loc22 br !if.then.loc22 else br !if.else.loc22 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc22: // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc23: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc23: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign %v.var, %.loc23 -// CHECK:STDOUT: %.loc24: bool = bool_literal true [template = constants.%.7] +// CHECK:STDOUT: %.loc24: bool = bool_literal true [template = constants.%.1] // CHECK:STDOUT: if %.loc24 br !if.then.loc24 else br !if.else.loc24 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc24: // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc31: i32 = int_literal 1 [template = constants.%.8] +// CHECK:STDOUT: %.loc31: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: assign %w.var, %.loc31 // CHECK:STDOUT: br !if.else.loc24 // CHECK:STDOUT: @@ -99,7 +93,7 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: br !if.else.loc22 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc22: -// CHECK:STDOUT: %.loc34: i32 = int_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc34: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: return %.loc34 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/returned_var.carbon b/toolchain/check/testdata/return/returned_var.carbon index 07369efddcd1..850e5e5cd15d 100644 --- a/toolchain/check/testdata/return/returned_var.carbon +++ b/toolchain/check/testdata/return/returned_var.carbon @@ -22,26 +22,28 @@ fn G() -> i32 { // CHECK:STDOUT: --- returned_var.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] +// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %.1: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.C = %C.decl, .F = %F, .G = %G} [template] // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C [template] +// CHECK:STDOUT: %C: type = class_type @C [template = constants.%C] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: %G: = fn_decl @G [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type C, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 [template] // CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 [template = %.loc8_8.2] -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type C, i32 [template] +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type C, i32 [template = constants.%.1] // CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1 [template] // CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2 [template = %.loc9_8.2] // CHECK:STDOUT: @@ -52,10 +54,10 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C [template = file.%C] +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C [template = constants.%C] // CHECK:STDOUT: %result: ref C = bind_name result, %return -// CHECK:STDOUT: %.loc13_34: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc13_42: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_34: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_42: i32 = int_literal 2 [template = constants.%.5] // CHECK:STDOUT: %.loc13_43.1: {.a: i32, .b: i32} = struct_literal (%.loc13_34, %.loc13_42) // CHECK:STDOUT: %.loc13_43.2: ref i32 = class_element_access %return, element0 // CHECK:STDOUT: %.loc13_43.3: init i32 = initialize_from %.loc13_34 to %.loc13_43.2 @@ -71,7 +73,7 @@ fn G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %result.var: ref i32 = var result // CHECK:STDOUT: %result: ref i32 = bind_name result, %result.var -// CHECK:STDOUT: %.loc18_30: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc18_30: i32 = int_literal 0 [template = constants.%.6] // CHECK:STDOUT: assign %result.var, %.loc18_30 // CHECK:STDOUT: %.loc18_16: i32 = bind_value %result // CHECK:STDOUT: return %.loc18_16 diff --git a/toolchain/check/testdata/return/returned_var_scope.carbon b/toolchain/check/testdata/return/returned_var_scope.carbon index 4ede1d15699d..5dfde9e50e15 100644 --- a/toolchain/check/testdata/return/returned_var_scope.carbon +++ b/toolchain/check/testdata/return/returned_var_scope.carbon @@ -28,11 +28,7 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: bool = bool_literal true [template] // CHECK:STDOUT: %.2: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.3: bool = bool_literal true [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.7: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -54,18 +50,18 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: br !if.else.loc8 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc8: -// CHECK:STDOUT: %.loc11: bool = bool_literal true [template = constants.%.3] +// CHECK:STDOUT: %.loc11: bool = bool_literal true [template = constants.%.1] // CHECK:STDOUT: if %.loc11 br !if.then.loc11 else br !if.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc11: // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc12: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: assign %w.var, %.loc12 // CHECK:STDOUT: br !if.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc11: -// CHECK:STDOUT: %.loc14: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc14: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: return %.loc14 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -77,7 +73,7 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc19_27: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc19_27: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign %v.var, %.loc19_27 // CHECK:STDOUT: %.loc19_18: i32 = bind_value %v // CHECK:STDOUT: return %.loc19_18 @@ -85,7 +81,7 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: !if.else: // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 [template = constants.%.7] +// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: assign %w.var, %.loc22_25 // CHECK:STDOUT: %.loc22_16: i32 = bind_value %w // CHECK:STDOUT: return %.loc22_16 diff --git a/toolchain/check/testdata/return/struct.carbon b/toolchain/check/testdata/return/struct.carbon index 1caacc744202..cafe6c26fa32 100644 --- a/toolchain/check/testdata/return/struct.carbon +++ b/toolchain/check/testdata/return/struct.carbon @@ -11,8 +11,9 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: --- struct.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.2: {.a: i32} = struct_value (%.1) [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.2: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.3: {.a: i32} = struct_value (%.2) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -22,10 +23,10 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> {.a: i32} { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 3 [template = constants.%.1] +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 3 [template = constants.%.2] // CHECK:STDOUT: %.loc8_17.1: {.a: i32} = struct_literal (%.loc8_16) -// CHECK:STDOUT: %.loc8_17.2: {.a: i32} = struct_value (%.loc8_16) [template = constants.%.2] -// CHECK:STDOUT: %.loc8_17.3: {.a: i32} = converted %.loc8_17.1, %.loc8_17.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc8_17.2: {.a: i32} = struct_value (%.loc8_16) [template = constants.%.3] +// CHECK:STDOUT: %.loc8_17.3: {.a: i32} = converted %.loc8_17.1, %.loc8_17.2 [template = constants.%.3] // CHECK:STDOUT: return %.loc8_17.3 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/fail_assign_empty.carbon b/toolchain/check/testdata/struct/fail_assign_empty.carbon index d045df2b1690..2d1f657e919b 100644 --- a/toolchain/check/testdata/struct/fail_assign_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_empty.carbon @@ -12,12 +12,13 @@ var x: {.a: i32} = {}; // CHECK:STDOUT: --- fail_assign_empty.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = struct_type {} [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.2: type = struct_type {} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} [template] -// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template = constants.%.1] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var // CHECK:STDOUT: %.loc10_21: {} = struct_literal () diff --git a/toolchain/check/testdata/struct/fail_assign_nested.carbon b/toolchain/check/testdata/struct/fail_assign_nested.carbon index 2635cbc47330..bf9d8d9f84ae 100644 --- a/toolchain/check/testdata/struct/fail_assign_nested.carbon +++ b/toolchain/check/testdata/struct/fail_assign_nested.carbon @@ -13,16 +13,17 @@ var x: {.a: {}} = {.b = {}}; // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = struct_type {} [template] -// CHECK:STDOUT: %.2: type = tuple_type () [template] -// CHECK:STDOUT: %.3: type = struct_type {.a: ()} [template] -// CHECK:STDOUT: %.4: type = struct_type {.b: {}} [template] +// CHECK:STDOUT: %.2: type = struct_type {.a: {}} [template] +// CHECK:STDOUT: %.3: type = tuple_type () [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: ()} [template] +// CHECK:STDOUT: %.5: type = struct_type {.b: {}} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} [template] // CHECK:STDOUT: %.loc10_14.1: {} = struct_literal () // CHECK:STDOUT: %.loc10_14.2: type = converted %.loc10_14.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_15: type = struct_type {.a: {}} [template] +// CHECK:STDOUT: %.loc10_15: type = struct_type {.a: {}} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: {}} = var x // CHECK:STDOUT: %x: ref {.a: {}} = bind_name x, %x.var // CHECK:STDOUT: %.loc10_26: {} = struct_literal () diff --git a/toolchain/check/testdata/struct/fail_duplicate_name.carbon b/toolchain/check/testdata/struct/fail_duplicate_name.carbon index 4df2efbf6de4..f809697130e6 100644 --- a/toolchain/check/testdata/struct/fail_duplicate_name.carbon +++ b/toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -49,13 +49,12 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] // CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.7: type = ptr_type {.b: i32, .c: i32} [template] -// CHECK:STDOUT: %.8: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.9: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.5: type = struct_type {.b: i32, .c: i32} [template] +// CHECK:STDOUT: %.6: type = ptr_type {.b: i32, .c: i32} [template] +// CHECK:STDOUT: %.7: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.8: i32 = int_literal 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -64,20 +63,20 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: %.loc21_35: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %.loc21_36: {.a: i32} = struct_literal (%.loc21_35) // CHECK:STDOUT: %v: = bind_name v, -// CHECK:STDOUT: %.loc29_22: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc29_32: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc29_22: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc29_32: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %w: i32 = bind_name w, -// CHECK:STDOUT: %.loc37_16: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.loc37_16: type = struct_type {.a: i32} [template = constants.%.4] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc37_26: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc37_34: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc37_26: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc37_34: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: assign %x.var, -// CHECK:STDOUT: %.loc45_25: type = struct_type {.b: i32, .c: i32} [template] +// CHECK:STDOUT: %.loc45_25: type = struct_type {.b: i32, .c: i32} [template = constants.%.5] // CHECK:STDOUT: %y.var: ref {.b: i32, .c: i32} = var y // CHECK:STDOUT: %y: ref {.b: i32, .c: i32} = bind_name y, %y.var -// CHECK:STDOUT: %.loc45_35: i32 = int_literal 3 [template = constants.%.8] -// CHECK:STDOUT: %.loc45_43: i32 = int_literal 4 [template = constants.%.9] +// CHECK:STDOUT: %.loc45_35: i32 = int_literal 3 [template = constants.%.7] +// CHECK:STDOUT: %.loc45_43: i32 = int_literal 4 [template = constants.%.8] // CHECK:STDOUT: assign %y.var, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon index 3e2f683b37df..7a588fcb9a49 100644 --- a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon @@ -17,19 +17,21 @@ var y: {.b: i32} = x; // CHECK:STDOUT: --- fail_field_name_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: type = struct_type {.b: i32} [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: type = struct_type {.b: i32} [template] +// CHECK:STDOUT: %.4: type = struct_type {.b: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} [template] -// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template = constants.%.1] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_26: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_26: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %.loc10_27: {.b: i32} = struct_literal (%.loc10_26) // CHECK:STDOUT: assign %x.var, -// CHECK:STDOUT: %.loc15: type = struct_type {.b: i32} [template] +// CHECK:STDOUT: %.loc15: type = struct_type {.b: i32} [template = constants.%.4] // CHECK:STDOUT: %y.var: ref {.b: i32} = var y // CHECK:STDOUT: %y: ref {.b: i32} = bind_name y, %y.var // CHECK:STDOUT: %x.ref: ref {.a: i32} = name_ref x, %x diff --git a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon index 9495ae6e6cc5..2699614f7eee 100644 --- a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon @@ -12,16 +12,17 @@ var x: {.a: i32} = {.b = 1.0}; // CHECK:STDOUT: --- fail_field_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: f64 = real_literal 10e-1 [template] -// CHECK:STDOUT: %.2: type = struct_type {.b: f64} [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.2: f64 = real_literal 10e-1 [template] +// CHECK:STDOUT: %.3: type = struct_type {.b: f64} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} [template] -// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template = constants.%.1] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_26: f64 = real_literal 10e-1 [template = constants.%.1] +// CHECK:STDOUT: %.loc10_26: f64 = real_literal 10e-1 [template = constants.%.2] // CHECK:STDOUT: %.loc10_29: {.b: f64} = struct_literal (%.loc10_26) // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_member_access_type.carbon b/toolchain/check/testdata/struct/fail_member_access_type.carbon index 5af521652fc1..b1820d11f2a9 100644 --- a/toolchain/check/testdata/struct/fail_member_access_type.carbon +++ b/toolchain/check/testdata/struct/fail_member_access_type.carbon @@ -13,15 +13,16 @@ var y: i32 = x.b; // CHECK:STDOUT: --- fail_member_access_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: f64 = real_literal 40e-1 [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: f64} [template] +// CHECK:STDOUT: %.2: f64 = real_literal 40e-1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} [template] -// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: f64} [template] +// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: f64} [template = constants.%.1] // CHECK:STDOUT: %x.var: ref {.a: f64} = var x // CHECK:STDOUT: %x: ref {.a: f64} = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_26: f64 = real_literal 40e-1 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_26: f64 = real_literal 40e-1 [template = constants.%.2] // CHECK:STDOUT: %.loc7_29.1: {.a: f64} = struct_literal (%.loc7_26) // CHECK:STDOUT: %.loc7_29.2: init {.a: f64} = struct_init (%.loc7_26) to %x.var // CHECK:STDOUT: %.loc7_29.3: init {.a: f64} = converted %.loc7_29.1, %.loc7_29.2 diff --git a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon index 75dfaf5df659..905a58fbdfe2 100644 --- a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon @@ -22,19 +22,22 @@ var p: Incomplete* = &s.a; // CHECK:STDOUT: --- fail_nested_incomplete.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type [template] +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: Incomplete} [template] +// CHECK:STDOUT: %.2: type = ptr_type Incomplete [template] +// CHECK:STDOUT: %.3: type = ptr_type [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Incomplete = %Incomplete.decl, .s = %s, .p = %p} [template] // CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] -// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete [template = %Incomplete] -// CHECK:STDOUT: %.loc15: type = struct_type {.a: Incomplete} [template] +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete [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.loc20: type = name_ref Incomplete, %Incomplete [template = %Incomplete] -// CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete [template] +// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %.loc20_18: 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 // CHECK:STDOUT: %s.ref: ref = name_ref s, %s diff --git a/toolchain/check/testdata/struct/fail_non_member_access.carbon b/toolchain/check/testdata/struct/fail_non_member_access.carbon index 5097c55148c8..203e2f3e4372 100644 --- a/toolchain/check/testdata/struct/fail_non_member_access.carbon +++ b/toolchain/check/testdata/struct/fail_non_member_access.carbon @@ -13,15 +13,16 @@ var y: i32 = x.b; // CHECK:STDOUT: --- fail_non_member_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.2: i32 = int_literal 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} [template] -// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: i32} [template = constants.%.1] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 4 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 4 [template = constants.%.2] // CHECK:STDOUT: %.loc7_27.1: {.a: i32} = struct_literal (%.loc7_26) // CHECK:STDOUT: %.loc7_27.2: init {.a: i32} = struct_init (%.loc7_26) to %x.var // CHECK:STDOUT: %.loc7_27.3: init {.a: i32} = converted %.loc7_27.1, %.loc7_27.2 diff --git a/toolchain/check/testdata/struct/fail_too_few_values.carbon b/toolchain/check/testdata/struct/fail_too_few_values.carbon index 7c92f41b8a0e..9efa288daa46 100644 --- a/toolchain/check/testdata/struct/fail_too_few_values.carbon +++ b/toolchain/check/testdata/struct/fail_too_few_values.carbon @@ -12,17 +12,18 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: --- fail_too_few_values.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} [template] -// CHECK:STDOUT: %.loc10_25: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.loc10_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] // CHECK:STDOUT: %x.var: ref {.a: i32, .b: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32, .b: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_35: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_35: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: %.loc10_36: {.a: i32} = struct_literal (%.loc10_35) // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_type_assign.carbon b/toolchain/check/testdata/struct/fail_type_assign.carbon index e439bf0ad9e7..2e953dce3636 100644 --- a/toolchain/check/testdata/struct/fail_type_assign.carbon +++ b/toolchain/check/testdata/struct/fail_type_assign.carbon @@ -11,12 +11,16 @@ var x: {.a: i32} = {.a: i32}; // CHECK:STDOUT: --- fail_type_assign.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} [template] -// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template = constants.%.1] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_28: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.loc10_28: type = struct_type {.a: i32} [template = constants.%.1] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/literal_member_access.carbon b/toolchain/check/testdata/struct/literal_member_access.carbon index db4bac682c76..aeb9abfa45fc 100644 --- a/toolchain/check/testdata/struct/literal_member_access.carbon +++ b/toolchain/check/testdata/struct/literal_member_access.carbon @@ -13,12 +13,13 @@ fn F() -> i32 { // CHECK:STDOUT: --- literal_member_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type {.x: i32, .y: i32, .z: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 3 [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} [template] -// CHECK:STDOUT: %.5: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32} [template] -// CHECK:STDOUT: %.6: type = ptr_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32} [template] +// CHECK:STDOUT: %.1: type = struct_type {.x: i32, .y: i32, .z: i32} [template] +// CHECK:STDOUT: %.2: type = ptr_type {.x: i32, .y: i32, .z: i32} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 3 [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} [template] +// CHECK:STDOUT: %.6: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32} [template] +// CHECK:STDOUT: %.7: type = ptr_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -31,11 +32,11 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: %G.ref: = name_ref G, file.%G [template = file.%G] // CHECK:STDOUT: %.loc10_25.1: ref {.x: i32, .y: i32, .z: i32} = temporary_storage // CHECK:STDOUT: %.loc10_25.2: init {.x: i32, .y: i32, .z: i32} = call %G.ref() to %.loc10_25.1 -// CHECK:STDOUT: %.loc10_34: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_34: i32 = int_literal 3 [template = constants.%.4] // CHECK:STDOUT: %.loc10_35.1: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = struct_literal (%.loc10_16, %.loc10_25.2, %.loc10_34) // CHECK:STDOUT: %.loc10_25.3: ref {.x: i32, .y: i32, .z: i32} = temporary %.loc10_25.1, %.loc10_25.2 // CHECK:STDOUT: %.loc10_25.4: ref i32 = struct_access %.loc10_25.3, element0 diff --git a/toolchain/check/testdata/struct/member_access.carbon b/toolchain/check/testdata/struct/member_access.carbon index fa62bd6805ef..d0d5cb0c8022 100644 --- a/toolchain/check/testdata/struct/member_access.carbon +++ b/toolchain/check/testdata/struct/member_access.carbon @@ -11,18 +11,19 @@ var z: i32 = y; // CHECK:STDOUT: --- member_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type {.a: f64, .b: i32} [template] -// CHECK:STDOUT: %.2: f64 = real_literal 0e-1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: f64, .b: i32} [template] +// CHECK:STDOUT: %.2: type = ptr_type {.a: f64, .b: i32} [template] +// CHECK:STDOUT: %.3: f64 = real_literal 0e-1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y, .z = %z} [template] -// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: f64, .b: i32} [template] +// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: f64, .b: i32} [template = constants.%.1] // CHECK:STDOUT: %x.var: ref {.a: f64, .b: i32} = var x // CHECK:STDOUT: %x: ref {.a: f64, .b: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_35: f64 = real_literal 0e-1 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_45: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_35: f64 = real_literal 0e-1 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_45: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc7_46.1: {.a: f64, .b: i32} = struct_literal (%.loc7_35, %.loc7_45) // CHECK:STDOUT: %.loc7_46.2: ref f64 = struct_access %x.var, element0 // CHECK:STDOUT: %.loc7_46.3: init f64 = initialize_from %.loc7_35 to %.loc7_46.2 diff --git a/toolchain/check/testdata/struct/nested_struct_in_place.carbon b/toolchain/check/testdata/struct/nested_struct_in_place.carbon index bd6043b00bf2..2598a42f8b45 100644 --- a/toolchain/check/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/check/testdata/struct/nested_struct_in_place.carbon @@ -16,8 +16,9 @@ fn G() { // CHECK:STDOUT: %.1: type = tuple_type (type, type, type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32, i32, i32) [template] // CHECK:STDOUT: %.3: type = ptr_type (i32, i32, i32) [template] -// CHECK:STDOUT: %.4: type = struct_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} [template] -// CHECK:STDOUT: %.5: type = ptr_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} [template] +// CHECK:STDOUT: %.4: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template] +// CHECK:STDOUT: %.5: type = struct_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} [template] +// CHECK:STDOUT: %.6: type = ptr_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -34,7 +35,7 @@ fn G() { // CHECK:STDOUT: %.loc10_29.2: type = converted %.loc10_29.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %.loc10_50.1: (type, type, type) = tuple_literal (i32, i32, i32) // CHECK:STDOUT: %.loc10_50.2: type = converted %.loc10_50.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_51: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template] +// CHECK:STDOUT: %.loc10_51: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template = constants.%.4] // CHECK:STDOUT: %v.var: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = var v // CHECK:STDOUT: %v: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = bind_name v, %v.var // CHECK:STDOUT: %F.ref.loc10_61: = name_ref F, file.%F [template = file.%F] diff --git a/toolchain/check/testdata/struct/one_entry.carbon b/toolchain/check/testdata/struct/one_entry.carbon index a29fb6f10e0d..2c009e297ba6 100644 --- a/toolchain/check/testdata/struct/one_entry.carbon +++ b/toolchain/check/testdata/struct/one_entry.carbon @@ -10,20 +10,21 @@ var y: {.a: i32} = x; // CHECK:STDOUT: --- one_entry.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: i32 = int_literal 4 [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.2: i32 = int_literal 4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} [template] -// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: i32} [template = constants.%.1] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 4 [template = constants.%.1] +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 4 [template = constants.%.2] // CHECK:STDOUT: %.loc7_27.1: {.a: i32} = struct_literal (%.loc7_26) // CHECK:STDOUT: %.loc7_27.2: init {.a: i32} = struct_init (%.loc7_26) to %x.var // CHECK:STDOUT: %.loc7_27.3: init {.a: i32} = converted %.loc7_27.1, %.loc7_27.2 // CHECK:STDOUT: assign %x.var, %.loc7_27.3 -// CHECK:STDOUT: %.loc8_16: type = struct_type {.a: i32} [template] +// CHECK:STDOUT: %.loc8_16: type = struct_type {.a: i32} [template = constants.%.1] // CHECK:STDOUT: %y.var: ref {.a: i32} = var y // CHECK:STDOUT: %y: ref {.a: i32} = bind_name y, %y.var // CHECK:STDOUT: %x.ref: ref {.a: i32} = name_ref x, %x diff --git a/toolchain/check/testdata/struct/reorder_fields.carbon b/toolchain/check/testdata/struct/reorder_fields.carbon index 2fb9916c0773..93db04f9bfb0 100644 --- a/toolchain/check/testdata/struct/reorder_fields.carbon +++ b/toolchain/check/testdata/struct/reorder_fields.carbon @@ -16,9 +16,11 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: --- reorder_fields.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type {.a: i32, .b: f64} [template] -// CHECK:STDOUT: %.2: type = struct_type {.b: f64, .a: i32} [template] -// CHECK:STDOUT: %.3: type = ptr_type {.b: f64, .a: i32} [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: f64} [template] +// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: f64} [template] +// CHECK:STDOUT: %.3: type = struct_type {.b: f64, .a: i32} [template] +// CHECK:STDOUT: %.4: type = struct_type {.b: f64, .a: i32} [template] +// CHECK:STDOUT: %.5: type = ptr_type {.b: f64, .a: i32} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -34,7 +36,7 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: {.a: i32, .b: f64} { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_27: type = struct_type {.a: i32, .b: f64} [template] +// CHECK:STDOUT: %.loc11_27: type = struct_type {.a: i32, .b: f64} [template = constants.%.1] // CHECK:STDOUT: %MakeF64.ref: = name_ref MakeF64, file.%MakeF64 [template = file.%MakeF64] // CHECK:STDOUT: %.loc11_44.1: init f64 = call %MakeF64.ref() // CHECK:STDOUT: %MakeI32.ref: = name_ref MakeI32, file.%MakeI32 [template = file.%MakeI32] @@ -47,7 +49,7 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: %.loc11_62.4: {.a: i32, .b: f64} = struct_value (%.loc11_60.2, %.loc11_44.2) // CHECK:STDOUT: %.loc11_62.5: {.a: i32, .b: f64} = converted %.loc11_62.1, %.loc11_62.4 // CHECK:STDOUT: %x: {.a: i32, .b: f64} = bind_name x, %.loc11_62.5 -// CHECK:STDOUT: %.loc12_27: type = struct_type {.b: f64, .a: i32} [template] +// CHECK:STDOUT: %.loc12_27: type = struct_type {.b: f64, .a: i32} [template = constants.%.4] // CHECK:STDOUT: %x.ref: {.a: i32, .b: f64} = name_ref x, %x // CHECK:STDOUT: %.loc12_31.1: f64 = struct_access %x.ref, element1 // CHECK:STDOUT: %.loc12_31.2: i32 = struct_access %x.ref, element0 diff --git a/toolchain/check/testdata/struct/tuple_as_element.carbon b/toolchain/check/testdata/struct/tuple_as_element.carbon index fc67b6aa356b..52226fb37c2a 100644 --- a/toolchain/check/testdata/struct/tuple_as_element.carbon +++ b/toolchain/check/testdata/struct/tuple_as_element.carbon @@ -12,20 +12,21 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: type = tuple_type (type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32) [template] -// CHECK:STDOUT: %.3: type = ptr_type {.a: i32, .b: (i32,)} [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.5: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: (i32,)} [template] +// CHECK:STDOUT: %.4: type = ptr_type {.a: i32, .b: (i32,)} [template] +// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} [template] // CHECK:STDOUT: %.loc7_27.1: (type,) = tuple_literal (i32) // CHECK:STDOUT: %.loc7_27.2: type = converted %.loc7_27.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_28: type = struct_type {.a: i32, .b: (i32,)} [template] +// CHECK:STDOUT: %.loc7_28: type = struct_type {.a: i32, .b: (i32,)} [template = constants.%.3] // CHECK:STDOUT: %x.var: ref {.a: i32, .b: (i32,)} = var x // CHECK:STDOUT: %x: ref {.a: i32, .b: (i32,)} = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_38: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_47: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_38: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc7_47: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc7_49.1: (i32,) = tuple_literal (%.loc7_47) // CHECK:STDOUT: %.loc7_50.1: {.a: i32, .b: (i32,)} = struct_literal (%.loc7_38, %.loc7_49.1) // CHECK:STDOUT: %.loc7_50.2: ref i32 = struct_access %x.var, element0 @@ -39,7 +40,7 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: assign %x.var, %.loc7_50.7 // CHECK:STDOUT: %.loc8_27.1: (type,) = tuple_literal (i32) // CHECK:STDOUT: %.loc8_27.2: type = converted %.loc8_27.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_28: type = struct_type {.a: i32, .b: (i32,)} [template] +// CHECK:STDOUT: %.loc8_28: type = struct_type {.a: i32, .b: (i32,)} [template = constants.%.3] // CHECK:STDOUT: %y.var: ref {.a: i32, .b: (i32,)} = var y // CHECK:STDOUT: %y: ref {.a: i32, .b: (i32,)} = bind_name y, %y.var // CHECK:STDOUT: %x.ref: ref {.a: i32, .b: (i32,)} = name_ref x, %x diff --git a/toolchain/check/testdata/struct/two_entries.carbon b/toolchain/check/testdata/struct/two_entries.carbon index 0c9e3867d72d..4c2190a487be 100644 --- a/toolchain/check/testdata/struct/two_entries.carbon +++ b/toolchain/check/testdata/struct/two_entries.carbon @@ -13,31 +13,30 @@ var y: {.a: i32, .b: i32} = x; // CHECK:STDOUT: --- two_entries.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.3: i32 = int_literal 2 [template] -// CHECK:STDOUT: %.4: {.a: i32, .b: i32} = struct_value (%.2, %.3) [template] -// CHECK:STDOUT: %.5: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.6: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.1: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.2: type = ptr_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.4: i32 = int_literal 2 [template] +// CHECK:STDOUT: %.5: {.a: i32, .b: i32} = struct_value (%.3, %.4) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} [template] -// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_43: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] +// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc7_43: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: %.loc7_44.1: {.a: i32, .b: i32} = struct_literal (%.loc7_35, %.loc7_43) -// CHECK:STDOUT: %.loc7_44.2: {.a: i32, .b: i32} = struct_value (%.loc7_35, %.loc7_43) [template = constants.%.4] -// CHECK:STDOUT: %.loc7_44.3: {.a: i32, .b: i32} = converted %.loc7_44.1, %.loc7_44.2 [template = constants.%.4] -// CHECK:STDOUT: %v: {.a: i32, .b: i32} = bind_name v, %.loc7_44.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc8: type = struct_type {.a: i32, .b: i32} [template] -// CHECK:STDOUT: %v.ref: {.a: i32, .b: i32} = name_ref v, %v [template = constants.%.4] -// CHECK:STDOUT: %w: {.a: i32, .b: i32} = bind_name w, %v.ref [template = constants.%.4] -// CHECK:STDOUT: %.loc10_25: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.loc7_44.2: {.a: i32, .b: i32} = struct_value (%.loc7_35, %.loc7_43) [template = constants.%.5] +// CHECK:STDOUT: %.loc7_44.3: {.a: i32, .b: i32} = converted %.loc7_44.1, %.loc7_44.2 [template = constants.%.5] +// CHECK:STDOUT: %v: {.a: i32, .b: i32} = bind_name v, %.loc7_44.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc8: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] +// CHECK:STDOUT: %v.ref: {.a: i32, .b: i32} = name_ref v, %v [template = constants.%.5] +// CHECK:STDOUT: %w: {.a: i32, .b: i32} = bind_name w, %v.ref [template = constants.%.5] +// CHECK:STDOUT: %.loc10_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] // CHECK:STDOUT: %x.var: ref {.a: i32, .b: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32, .b: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_35: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_43: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc10_35: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc10_43: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: %.loc10_44.1: {.a: i32, .b: i32} = struct_literal (%.loc10_35, %.loc10_43) // CHECK:STDOUT: %.loc10_44.2: ref i32 = struct_access %x.var, element0 // CHECK:STDOUT: %.loc10_44.3: init i32 = initialize_from %.loc10_35 to %.loc10_44.2 @@ -46,7 +45,7 @@ var y: {.a: i32, .b: i32} = x; // CHECK:STDOUT: %.loc10_44.6: init {.a: i32, .b: i32} = struct_init (%.loc10_44.3, %.loc10_44.5) to %x.var // CHECK:STDOUT: %.loc10_44.7: init {.a: i32, .b: i32} = converted %.loc10_44.1, %.loc10_44.6 // CHECK:STDOUT: assign %x.var, %.loc10_44.7 -// CHECK:STDOUT: %.loc11_25: type = struct_type {.a: i32, .b: i32} [template] +// CHECK:STDOUT: %.loc11_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.1] // CHECK:STDOUT: %y.var: ref {.a: i32, .b: i32} = var y // CHECK:STDOUT: %y: ref {.a: i32, .b: i32} = bind_name y, %y.var // CHECK:STDOUT: %x.ref: ref {.a: i32, .b: i32} = name_ref x, %x diff --git a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon index 982ce684aa39..b7ad8ab5de46 100644 --- a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon @@ -22,27 +22,29 @@ var p: Incomplete* = &t[1]; // CHECK:STDOUT: --- fail_nested_incomplete.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] // CHECK:STDOUT: %.1: type = tuple_type (type, type) [template] // CHECK:STDOUT: %.2: type = tuple_type (i32, Incomplete) [template] -// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.4: type = ptr_type [template] +// CHECK:STDOUT: %.3: type = ptr_type Incomplete [template] +// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.5: type = ptr_type [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Incomplete = %Incomplete.decl, .t = %t, .p = %p} [template] // CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template] -// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete [template = %Incomplete] +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete [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.loc20: type = name_ref Incomplete, %Incomplete [template = %Incomplete] -// CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete [template] +// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete [template = constants.%Incomplete] +// CHECK:STDOUT: %.loc20_18: 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 // CHECK:STDOUT: %t.ref: ref = name_ref t, %t -// CHECK:STDOUT: %.loc20_25: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc20_25: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc20_22: * = addr_of // CHECK:STDOUT: assign %p.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/two_elements.carbon b/toolchain/check/testdata/tuples/two_elements.carbon index 8467e227fc5c..b84991fe722a 100644 --- a/toolchain/check/testdata/tuples/two_elements.carbon +++ b/toolchain/check/testdata/tuples/two_elements.carbon @@ -19,8 +19,6 @@ var y: (i32, i32) = x; // CHECK:STDOUT: %.4: i32 = int_literal 4 [template] // CHECK:STDOUT: %.5: i32 = int_literal 102 [template] // CHECK:STDOUT: %.6: (i32, i32) = tuple_value (%.4, %.5) [template] -// CHECK:STDOUT: %.7: i32 = int_literal 4 [template] -// CHECK:STDOUT: %.8: i32 = int_literal 102 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -41,8 +39,8 @@ var y: (i32, i32) = x; // CHECK:STDOUT: %.loc10_17.2: type = converted %.loc10_17.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %x.var: ref (i32, i32) = var x // CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_22: i32 = int_literal 4 [template = constants.%.7] -// CHECK:STDOUT: %.loc10_25: i32 = int_literal 102 [template = constants.%.8] +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 4 [template = constants.%.4] +// CHECK:STDOUT: %.loc10_25: i32 = int_literal 102 [template = constants.%.5] // CHECK:STDOUT: %.loc10_28.1: (i32, i32) = tuple_literal (%.loc10_22, %.loc10_25) // CHECK:STDOUT: %.loc10_28.2: ref i32 = tuple_access %x.var, element0 // CHECK:STDOUT: %.loc10_28.3: init i32 = initialize_from %.loc10_22 to %.loc10_28.2 diff --git a/toolchain/check/testdata/var/fail_duplicate_decl.carbon b/toolchain/check/testdata/var/fail_duplicate_decl.carbon index 2677b579fc6f..855247aced9f 100644 --- a/toolchain/check/testdata/var/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/var/fail_duplicate_decl.carbon @@ -20,7 +20,6 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -36,7 +35,7 @@ fn Main() { // CHECK:STDOUT: assign %x.var.loc9, %.loc9 // CHECK:STDOUT: %x.var.loc16: ref i32 = var x // CHECK:STDOUT: %x.loc16: ref i32 = bind_name x, %x.var.loc16 -// CHECK:STDOUT: %.loc16: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc16: i32 = int_literal 0 [template = constants.%.1] // CHECK:STDOUT: assign %x.var.loc16, %.loc16 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/fail_not_copyable.carbon b/toolchain/check/testdata/var/fail_not_copyable.carbon index daa9de6b2fd3..5d2182634cf3 100644 --- a/toolchain/check/testdata/var/fail_not_copyable.carbon +++ b/toolchain/check/testdata/var/fail_not_copyable.carbon @@ -25,6 +25,7 @@ fn F(x: X) { // CHECK:STDOUT: --- fail_not_copyable.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %X: type = class_type @X [template] // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] @@ -35,7 +36,7 @@ fn F(x: X) { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.X = %X.decl, .F = %F} [template] // CHECK:STDOUT: %X.decl = class_decl @X, () -// CHECK:STDOUT: %X: type = class_type @X [template] +// CHECK:STDOUT: %X: type = class_type @X [template = constants.%X] // CHECK:STDOUT: %F: = fn_decl @F [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -50,7 +51,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, file.%X [template = file.%X] +// CHECK:STDOUT: %X.ref: type = name_ref X, file.%X [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/check/testdata/var/fail_storage_is_literal.carbon b/toolchain/check/testdata/var/fail_storage_is_literal.carbon index 4d7e22adef22..b2af2147e6da 100644 --- a/toolchain/check/testdata/var/fail_storage_is_literal.carbon +++ b/toolchain/check/testdata/var/fail_storage_is_literal.carbon @@ -15,7 +15,6 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 1 [template] -// CHECK:STDOUT: %.2: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -28,7 +27,7 @@ fn Main() { // CHECK:STDOUT: %.loc11_10: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: %x.var: ref = var x // CHECK:STDOUT: %x: ref = bind_name x, %x.var -// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1 [template = constants.%.1] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/shadowing.carbon b/toolchain/check/testdata/var/shadowing.carbon index a71abe20097a..9f1a067e4093 100644 --- a/toolchain/check/testdata/var/shadowing.carbon +++ b/toolchain/check/testdata/var/shadowing.carbon @@ -19,8 +19,7 @@ fn Main() { // CHECK:STDOUT: constants { // CHECK:STDOUT: %.1: i32 = int_literal 0 [template] // CHECK:STDOUT: %.2: bool = bool_literal true [template] -// CHECK:STDOUT: %.3: i32 = int_literal 0 [template] -// CHECK:STDOUT: %.4: i32 = int_literal 1 [template] +// CHECK:STDOUT: %.3: i32 = int_literal 1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -40,10 +39,10 @@ fn Main() { // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %x.var.loc10: ref i32 = var x // CHECK:STDOUT: %x.loc10: ref i32 = bind_name x, %x.var.loc10 -// CHECK:STDOUT: %.loc10: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc10: i32 = int_literal 0 [template = constants.%.1] // CHECK:STDOUT: assign %x.var.loc10, %.loc10 // CHECK:STDOUT: %x.ref: ref i32 = name_ref x, %x.loc10 -// CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: assign %x.ref, %.loc13 // CHECK:STDOUT: br !if.else // CHECK:STDOUT: diff --git a/toolchain/sem_ir/BUILD b/toolchain/sem_ir/BUILD index e3092a11fb22..e06b57afcc02 100644 --- a/toolchain/sem_ir/BUILD +++ b/toolchain/sem_ir/BUILD @@ -62,18 +62,27 @@ cc_library( cc_library( name = "file", - srcs = ["file.cpp"], - hdrs = ["file.h"], + srcs = [ + "file.cpp", + "inst_profile.cpp", + "inst_profile.h", + "value_stores.cpp", + ], + hdrs = [ + "file.h", + "value_stores.h", + ], deps = [ ":builtin_kind", ":ids", ":inst", ":inst_kind", ":type_info", - ":value_stores", "//common:check", "//toolchain/base:value_store", "//toolchain/base:yaml", + "//toolchain/lex:token_kind", + "//toolchain/parse:node_kind", "@llvm-project//llvm:Support", ], ) @@ -113,21 +122,6 @@ cc_library( ], ) -cc_library( - name = "value_stores", - srcs = ["value_stores.cpp"], - hdrs = ["value_stores.h"], - deps = [ - ":inst", - ":type_info", - "//toolchain/base:value_store", - "//toolchain/base:yaml", - "//toolchain/lex:token_kind", - "//toolchain/parse:node_kind", - "@llvm-project//llvm:Support", - ], -) - cc_test( name = "typed_insts_test", size = "small", diff --git a/toolchain/sem_ir/file.cpp b/toolchain/sem_ir/file.cpp index 9fc981fe72cb..010b03939e12 100644 --- a/toolchain/sem_ir/file.cpp +++ b/toolchain/sem_ir/file.cpp @@ -64,7 +64,8 @@ File::File(SharedValueStores& value_stores) : value_stores_(&value_stores), filename_(""), type_blocks_(allocator_), - inst_blocks_(allocator_) { + inst_blocks_(allocator_), + constants_(*this, allocator_) { auto builtins_id = cross_ref_irs_.Add(this); CARBON_CHECK(builtins_id == CrossRefIRId::Builtins) << "Builtins must be the first IR, even if self-referential"; @@ -92,7 +93,8 @@ File::File(SharedValueStores& value_stores, std::string filename, : value_stores_(&value_stores), filename_(std::move(filename)), type_blocks_(allocator_), - inst_blocks_(allocator_) { + inst_blocks_(allocator_), + constants_(*this, allocator_) { CARBON_CHECK(builtins != nullptr); auto builtins_id = cross_ref_irs_.Add(builtins); CARBON_CHECK(builtins_id == CrossRefIRId::Builtins) diff --git a/toolchain/sem_ir/formatter.cpp b/toolchain/sem_ir/formatter.cpp index 6d0b8316e29a..7a86962bb597 100644 --- a/toolchain/sem_ir/formatter.cpp +++ b/toolchain/sem_ir/formatter.cpp @@ -50,7 +50,8 @@ class InstNamer { // Build the constants scope. GetScopeInfo(ScopeIndex::Constants).name = globals.AddNameUnchecked("constants"); - CollectNamesInBlock(ScopeIndex::Constants, sem_ir.constants().array_ref()); + CollectNamesInBlock(ScopeIndex::Constants, + sem_ir.constants().GetAsVector()); // Build the file scope. GetScopeInfo(ScopeIndex::File).name = globals.AddNameUnchecked("file"); @@ -592,7 +593,7 @@ class Formatter { llvm::SaveAndRestore constants_scope(scope_, InstNamer::ScopeIndex::Constants); out_ << "constants {\n"; - FormatCodeBlock(sem_ir_.constants().array_ref()); + FormatCodeBlock(sem_ir_.constants().GetAsVector()); out_ << "}\n\n"; } diff --git a/toolchain/sem_ir/inst.h b/toolchain/sem_ir/inst.h index 20d800a9ae72..9e6a678cdddf 100644 --- a/toolchain/sem_ir/inst.h +++ b/toolchain/sem_ir/inst.h @@ -205,6 +205,14 @@ class Inst : public Printable { // Gets the type of the value produced by evaluating this instruction. auto type_id() const -> TypeId { return type_id_; } + // Gets the first argument of the instruction. InvalidIndex if there is no + // such argument. + auto arg0() const -> int32_t { return arg0_; } + + // Gets the second argument of the instruction. InvalidIndex if there is no + // such argument. + auto arg1() const -> int32_t { return arg1_; } + auto Print(llvm::raw_ostream& out) const -> void; private: diff --git a/toolchain/sem_ir/inst_kind.h b/toolchain/sem_ir/inst_kind.h index 3e8efef29845..56a17695e846 100644 --- a/toolchain/sem_ir/inst_kind.h +++ b/toolchain/sem_ir/inst_kind.h @@ -59,6 +59,7 @@ class InstKind : public CARBON_ENUM_BASE(InstKind) { TerminatorKind terminator_kind = TerminatorKind::NotTerminator) const -> Definition; + using EnumBase::AsInt; using EnumBase::Create; // Returns the name to use for this instruction kind in Semantics IR. diff --git a/toolchain/sem_ir/inst_profile.cpp b/toolchain/sem_ir/inst_profile.cpp new file mode 100644 index 000000000000..1cb1c2651604 --- /dev/null +++ b/toolchain/sem_ir/inst_profile.cpp @@ -0,0 +1,118 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include "toolchain/sem_ir/inst_profile.h" + +#include "toolchain/sem_ir/file.h" +#include "toolchain/sem_ir/inst.h" +#include "toolchain/sem_ir/typed_insts.h" + +namespace Carbon::SemIR { + +// A function to profile an argument of an instruction. +using ProfileArgFunction = auto(llvm::FoldingSetNodeID&, const File& sem_ir, + int32_t arg) -> void; + +// Profiling for unused arguments. +static auto NullProfileArgFunction(llvm::FoldingSetNodeID& /*id*/, + const File& /*sem_ir*/, int32_t arg) + -> void { + CARBON_CHECK(arg == IdBase::InvalidIndex) + << "Unexpected value for unused argument."; +} + +// Profiling for ID arguments that should participate in the instruction's +// value. +static auto DefaultProfileArgFunction(llvm::FoldingSetNodeID& id, + const File& /*sem_ir*/, int32_t arg) + -> void { + id.AddInteger(arg); +} + +// Profiling for block ID arguments for which the content of the block should be +// included. +static auto InstBlockProfileArgFunction(llvm::FoldingSetNodeID& id, + const File& sem_ir, int32_t arg) + -> void { + for (auto inst_id : sem_ir.inst_blocks().Get(InstBlockId(arg))) { + id.AddInteger(inst_id.index); + } +} + +// Profiling for type block ID arguments for which the content of the block +// should be included. +static auto TypeBlockProfileArgFunction(llvm::FoldingSetNodeID& id, + const File& sem_ir, int32_t arg) + -> void { + for (auto type_id : sem_ir.type_blocks().Get(TypeBlockId(arg))) { + id.AddInteger(type_id.index); + } +} + +// Profiling for integer IDs. +static auto IntProfileArgFunction(llvm::FoldingSetNodeID& id, + const File& sem_ir, int32_t arg) -> void { + sem_ir.ints().Get(IntId(arg)).Profile(id); +} + +// Profiling for real number IDs. +static auto RealProfileArgFunction(llvm::FoldingSetNodeID& id, + const File& sem_ir, int32_t arg) -> void { + const auto& real = sem_ir.reals().Get(RealId(arg)); + // TODO: Profile the value rather than the syntactic form. + real.mantissa.Profile(id); + real.exponent.Profile(id); + id.AddBoolean(real.is_decimal); +} + +// Selects the function to use to profile argument N of instruction InstT. We +// compute this in advance so that we can reuse the profiling code for all +// instructions that are profiled in the same way. For example, all instructions +// that take two IDs that are profiled by value use the same profiling code, +// namely `ProfileArgs`. +template +static constexpr auto SelectProfileArgFunction() -> ProfileArgFunction* { + if constexpr (N >= InstLikeTypeInfo::NumArgs) { + // This argument is not used by this instruction; don't profile it. + return NullProfileArgFunction; + } else { + using ArgT = typename InstLikeTypeInfo::template ArgType; + if constexpr (std::is_same_v) { + return InstBlockProfileArgFunction; + } else if constexpr (std::is_same_v) { + return TypeBlockProfileArgFunction; + } else if constexpr (std::is_same_v) { + return IntProfileArgFunction; + } else if constexpr (std::is_same_v) { + return RealProfileArgFunction; + } else { + return DefaultProfileArgFunction; + } + } +} + +// Profiles the given instruction arguments using the specified functions. +template +static auto ProfileArgs(llvm::FoldingSetNodeID& id, const File& sem_ir, + int32_t arg0, int32_t arg1) -> void { + ProfileArg0(id, sem_ir, arg0); + ProfileArg1(id, sem_ir, arg1); +} + +auto ProfileConstant(llvm::FoldingSetNodeID& id, const File& sem_ir, Inst inst) + -> void { + using ProfileArgsFunction = + auto(llvm::FoldingSetNodeID&, const File&, int32_t, int32_t)->void; + static constexpr ProfileArgsFunction* ProfileFunctions[] = { +#define CARBON_SEM_IR_INST_KIND(KindName) \ + ProfileArgs(), \ + SelectProfileArgFunction()>, +#include "toolchain/sem_ir/inst_kind.def" + }; + + inst.kind().Profile(id); + ProfileFunctions[inst.kind().AsInt()](id, sem_ir, inst.arg0(), inst.arg1()); +} + +} // namespace Carbon::SemIR diff --git a/toolchain/sem_ir/inst_profile.h b/toolchain/sem_ir/inst_profile.h new file mode 100644 index 000000000000..382a379e87b9 --- /dev/null +++ b/toolchain/sem_ir/inst_profile.h @@ -0,0 +1,21 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#ifndef CARBON_TOOLCHAIN_SEM_IR_INST_PROFILE_H_ +#define CARBON_TOOLCHAIN_SEM_IR_INST_PROFILE_H_ + +#include "llvm/ADT/FoldingSet.h" +#include "toolchain/sem_ir/file.h" +#include "toolchain/sem_ir/inst.h" + +namespace Carbon::SemIR { + +// Computes a profile of the given constant instruction, for canonicalization / +// deduplication. +auto ProfileConstant(llvm::FoldingSetNodeID& id, const File& sem_ir, Inst inst) + -> void; + +} // namespace Carbon::SemIR + +#endif // CARBON_TOOLCHAIN_SEM_IR_INST_PROFILE_H_ diff --git a/toolchain/sem_ir/value_stores.cpp b/toolchain/sem_ir/value_stores.cpp index 7d6e880f9974..fa8acecc44ca 100644 --- a/toolchain/sem_ir/value_stores.cpp +++ b/toolchain/sem_ir/value_stores.cpp @@ -5,9 +5,48 @@ #include "toolchain/sem_ir/value_stores.h" #include "llvm/ADT/StringSwitch.h" +#include "toolchain/sem_ir/file.h" +#include "toolchain/sem_ir/inst_profile.h" namespace Carbon::SemIR { +auto ConstantStore::GetOrAdd(Inst inst) -> std::pair { + // Compute the instruction's profile. + ConstantNode node = {.inst = inst, .inst_id = InstId::Invalid}; + llvm::FoldingSetNodeID id; + node.Profile(id, constants_.getContext()); + + // Check if we have already created this constant. + void* insert_pos; + if (ConstantNode* found = constants_.FindNodeOrInsertPos(id, insert_pos)) { + return {found->inst_id, false}; + } + + // Create the new inst and insert the new node. + node.inst_id = constants_.getContext()->insts().AddInNoBlock( + ParseNodeAndInst::Untyped(Parse::NodeId::Invalid, inst)); + constants_.InsertNode(new (*allocator_) ConstantNode(node), insert_pos); + return {node.inst_id, true}; +} + +auto ConstantStore::GetAsVector() const -> llvm::SmallVector { + llvm::SmallVector result; + result.reserve(constants_.size()); + for (const ConstantNode& node : constants_) { + result.push_back(node.inst_id); + } + // For stability, put the results into index order. This happens to also be + // insertion order. + std::sort(result.begin(), result.end(), + [](InstId a, InstId b) { return a.index < b.index; }); + return result; +} + +auto ConstantStore::ConstantNode::Profile(llvm::FoldingSetNodeID& id, + File* sem_ir) -> void { + ProfileConstant(id, *sem_ir, inst); +} + // Get the spelling to use for a special name. static auto GetSpecialName(NameId name_id, bool for_ir) -> llvm::StringRef { switch (name_id.index) { diff --git a/toolchain/sem_ir/value_stores.h b/toolchain/sem_ir/value_stores.h index d609d6b2f0ef..6702b88e769a 100644 --- a/toolchain/sem_ir/value_stores.h +++ b/toolchain/sem_ir/value_stores.h @@ -146,17 +146,38 @@ class ConstantValueStore : public Yaml::Printable { llvm::SmallVector values_; }; -// Provides storage for instructions representing global constants. +// Provides storage for instructions representing deduplicated global constants. class ConstantStore { public: - // Add a constant instruction. - auto Add(InstId inst_id) -> void { values_.push_back(inst_id); } + explicit ConstantStore(File& sem_ir, llvm::BumpPtrAllocator& allocator) + : allocator_(&allocator), constants_(&sem_ir) {} - auto array_ref() const -> llvm::ArrayRef { return values_; } - auto size() const -> int { return values_.size(); } + // Adds a new constant instruction, or gets the existing constant with this + // value. Returns the instruction ID and a bool indicating whether a new + // instruction was added. + auto GetOrAdd(Inst inst) -> std::pair; + + // Returns a copy of the constant IDs as a vector, in an arbitrary but + // stable order. This should not be used anywhere performance-sensitive. + auto GetAsVector() const -> llvm::SmallVector; + + auto size() const -> int { return constants_.size(); } private: - llvm::SmallVector values_; + // TODO: We store two copies of each constant instruction: one in insts() and + // one here. We could avoid one of those copies and store just an InstId here, + // at the cost of some more indirection when recomputing profiles during + // lookup. Once we have a representative data set, we should measure the + // impact on compile time from that change. + struct ConstantNode : llvm::FoldingSetNode { + Inst inst; + InstId inst_id; + + auto Profile(llvm::FoldingSetNodeID& id, File* sem_ir) -> void; + }; + + llvm::BumpPtrAllocator* allocator_; + llvm::ContextualFoldingSet constants_; }; // Provides a ValueStore wrapper with an API specific to types.