From 5169a1862ec34fd5e531b5f96e5b6d5988ed3fae Mon Sep 17 00:00:00 2001 From: josh11b <15258583+josh11b@users.noreply.github.com> Date: Fri, 20 Dec 2024 09:00:53 -0800 Subject: [PATCH] Require a definition in the same file as an `impl` declaration (#4719) This PR detects the failures that #4709 fixes. --------- Co-authored-by: Josh L --- toolchain/check/check_unit.cpp | 7 +- toolchain/check/handle_impl.cpp | 54 +- toolchain/check/impl.cpp | 70 +- toolchain/check/impl.h | 7 +- toolchain/check/import_ref.cpp | 2 +- toolchain/check/testdata/as/overloaded.carbon | 28 +- .../testdata/class/access_modifers.carbon | 12 +- .../check/testdata/class/base_method.carbon | 4 +- .../class/fail_field_modifiers.carbon | 4 +- .../generic/complete_in_conversion.carbon | 4 +- .../testdata/class/generic/import.carbon | 4 +- toolchain/check/testdata/class/import.carbon | 2 +- .../testdata/class/inheritance_access.carbon | 18 +- toolchain/check/testdata/deduce/array.carbon | 8 +- .../no_prelude/call_from_operator.carbon | 48 +- .../testdata/function/generic/deduce.carbon | 8 +- .../function/generic/undefined.carbon | 4 +- .../if_expr/fail_not_in_function.carbon | 4 +- .../check/testdata/impl/declaration.carbon | 21 +- .../testdata/impl/extend_impl_generic.carbon | 2 - .../impl/fail_extend_impl_forall.carbon | 3 - .../impl/fail_extend_impl_type_as.carbon | 8 +- .../impl/fail_extend_non_interface.carbon | 10 +- ..._extend_partially_defined_interface.carbon | 10 +- .../fail_extend_undefined_interface.carbon | 18 +- .../impl/fail_impl_bad_interface.carbon | 2 +- .../lookup/fail_todo_undefined_impl.carbon | 4 + .../check/testdata/impl/lookup/generic.carbon | 8 - .../impl/lookup/no_prelude/impl_forall.carbon | 30 +- .../lookup/no_prelude/specific_args.carbon | 32 +- .../impl/no_prelude/import_generic.carbon | 841 ++++++++++++++---- .../impl/no_prelude/interface_args.carbon | 34 +- .../no_definition_in_impl_file.carbon | 114 ++- .../interface/no_prelude/generic.carbon | 16 +- .../no_prelude/generic_import.carbon | 16 +- .../no_prelude/import_interface_decl.carbon | 92 +- .../testdata/operators/overloaded/add.carbon | 2 +- .../operators/overloaded/bit_and.carbon | 2 +- .../operators/overloaded/bit_or.carbon | 2 +- .../operators/overloaded/bit_xor.carbon | 2 +- .../testdata/operators/overloaded/dec.carbon | 2 +- .../testdata/operators/overloaded/div.carbon | 2 +- .../overloaded/fail_assign_non_ref.carbon | 2 +- .../overloaded/fail_no_impl_for_arg.carbon | 2 +- .../operators/overloaded/implicit_as.carbon | 24 +- .../testdata/operators/overloaded/inc.carbon | 2 +- .../operators/overloaded/index.carbon | 36 +- .../operators/overloaded/left_shift.carbon | 2 +- .../testdata/operators/overloaded/mod.carbon | 2 +- .../testdata/operators/overloaded/mul.carbon | 2 +- .../overloaded/no_prelude/index.carbon | 20 +- .../operators/overloaded/right_shift.carbon | 2 +- .../testdata/operators/overloaded/sub.carbon | 2 +- .../fail_return_with_returned_var.carbon | 4 +- .../no_prelude/import_convert_function.carbon | 32 +- toolchain/check/testdata/struct/import.carbon | 10 +- toolchain/check/testdata/tuple/import.carbon | 10 +- toolchain/diagnostics/diagnostic_kind.def | 3 +- toolchain/sem_ir/impl.h | 3 +- 59 files changed, 1157 insertions(+), 562 deletions(-) diff --git a/toolchain/check/check_unit.cpp b/toolchain/check/check_unit.cpp index 87a6b830a579..68deb164e23c 100644 --- a/toolchain/check/check_unit.cpp +++ b/toolchain/check/check_unit.cpp @@ -395,8 +395,11 @@ auto CheckUnit::CheckRequiredDefinitions() -> void { break; } case CARBON_KIND(SemIR::ImplDecl impl_decl): { - if (!context_.impls().Get(impl_decl.impl_id).is_defined()) { - emitter_.Emit(decl_inst_id, MissingDefinitionInImpl); + auto& impl = context_.impls().Get(impl_decl.impl_id); + if (!impl.is_defined()) { + CARBON_DIAGNOSTIC(MissingImplDefinition, Error, + "impl declared but not defined"); + emitter_.Emit(decl_inst_id, MissingImplDefinition); } break; } diff --git a/toolchain/check/handle_impl.cpp b/toolchain/check/handle_impl.cpp index edae4e39bc36..0b90fa073955 100644 --- a/toolchain/check/handle_impl.cpp +++ b/toolchain/check/handle_impl.cpp @@ -125,7 +125,7 @@ auto HandleParseNode(Context& context, Parse::DefaultSelfImplAsId node_id) // Process an `extend impl` declaration by extending the impl scope with the // `impl`'s scope. static auto ExtendImpl(Context& context, Parse::NodeId extend_node, - Parse::AnyImplDeclId node_id, + Parse::AnyImplDeclId node_id, SemIR::ImplId impl_id, Parse::NodeId self_type_node, SemIR::TypeId self_type_id, Parse::NodeId params_node, SemIR::InstId constraint_inst_id, @@ -179,16 +179,10 @@ static auto ExtendImpl(Context& context, Parse::NodeId extend_node, parent_scope.set_has_error(); return; } - if (!context.RequireDefinedType(constraint_id, node_id, [&] { - CARBON_DIAGNOSTIC( - ExtendUndefinedInterface, Error, - "`extend impl` requires a definition for facet type {0}", - InstIdAsType); - return context.emitter().Build(node_id, ExtendUndefinedInterface, - constraint_inst_id); - })) { + const auto& impl = context.impls().Get(impl_id); + if (impl.witness_id == SemIR::ErrorInst::SingletonInstId) { parent_scope.set_has_error(); - }; + } parent_scope.AddExtendedScope(constraint_inst_id); } @@ -257,9 +251,28 @@ static auto MergeImplRedecl(Context& context, SemIR::Impl& new_impl, // NOLINTNEXTLINE(readability-simplify-boolean-expr) return false; } + return true; +} - // TODO: CheckIsAllowedRedecl. We don't have a suitable NameId; decide if we - // need to treat the `T as I` as a kind of name. +static auto IsValidImplRedecl(Context& context, SemIR::Impl& new_impl, + SemIR::ImplId prev_impl_id) -> bool { + auto& prev_impl = context.impls().Get(prev_impl_id); + + // TODO: Following #3763, disallow redeclarations in different scopes. + + // Following #4672, disallowing defining non-extern declarations in another + // file. + if (auto import_ref = + context.insts().TryGetAs(prev_impl.self_id)) { + // TODO: Handle extern. + CARBON_DIAGNOSTIC(RedeclImportedImpl, Error, + "redeclaration of imported impl"); + // TODO: Note imported declaration + context.emitter().Emit(new_impl.latest_decl_id(), RedeclImportedImpl); + return false; + } + + // TODO: Only allow redeclaration in a match_first/impl_priority block. // TODO: Merge information from the new declaration into the old one as // needed. @@ -313,10 +326,14 @@ static auto BuildImplDecl(Context& context, Parse::AnyImplDeclId node_id, {.self_id = self_inst_id, .constraint_id = constraint_inst_id}}; // Add the impl declaration. + bool valid_redeclaration = true; auto lookup_bucket_ref = context.impls().GetOrAddLookupBucket(impl_info); for (auto prev_impl_id : lookup_bucket_ref) { if (MergeImplRedecl(context, impl_info, prev_impl_id)) { - impl_decl.impl_id = prev_impl_id; + valid_redeclaration = IsValidImplRedecl(context, impl_info, prev_impl_id); + if (valid_redeclaration) { + impl_decl.impl_id = prev_impl_id; + } break; } } @@ -324,6 +341,7 @@ static auto BuildImplDecl(Context& context, Parse::AnyImplDeclId node_id, // Create a new impl if this isn't a valid redeclaration. if (!impl_decl.impl_id.is_valid()) { impl_info.generic_id = FinishGenericDecl(context, impl_decl_id); + impl_info.witness_id = ImplWitnessForDeclaration(context, impl_info); impl_decl.impl_id = context.impls().Add(impl_info); lookup_bucket_ref.push_back(impl_decl.impl_id); } else { @@ -346,12 +364,13 @@ static auto BuildImplDecl(Context& context, Parse::AnyImplDeclId node_id, .specific_id = context.generics().GetSelfSpecific(impl_info.generic_id)}); } - ExtendImpl(context, extend_node, node_id, self_type_node, self_type_id, - name.implicit_params_loc_id, constraint_inst_id, + ExtendImpl(context, extend_node, node_id, impl_decl.impl_id, self_type_node, + self_type_id, name.implicit_params_loc_id, constraint_inst_id, constraint_type_id); } - if (!is_definition && context.IsImplFile()) { + // Impl definitions are required in the same file as the declaration. + if (!is_definition && valid_redeclaration) { context.definitions_required().push_back(impl_decl_id); } @@ -416,7 +435,8 @@ auto HandleParseNode(Context& context, Parse::ImplDefinitionId /*node_id*/) auto& impl_info = context.impls().Get(impl_id); if (!impl_info.is_defined()) { - impl_info.witness_id = BuildImplWitness(context, impl_id); + impl_info.witness_id = BuildImplWitness(context, impl_info); + impl_info.defined = true; } FinishGenericDefinition(context, impl_info.generic_id); diff --git a/toolchain/check/impl.cpp b/toolchain/check/impl.cpp index 7ca75fceb957..3fcc0463ae78 100644 --- a/toolchain/check/impl.cpp +++ b/toolchain/check/impl.cpp @@ -134,27 +134,53 @@ static auto CheckAssociatedFunctionImplementation( return impl_decl_id; } -// Builds a witness that the specified impl implements the given interface. -static auto BuildInterfaceWitness( - Context& context, const SemIR::Impl& impl, SemIR::TypeId facet_type_id, - SemIR::FacetTypeInfo::ImplsConstraint interface_type, - llvm::SmallVectorImpl& used_decl_ids) -> SemIR::InstId { - const auto& interface = context.interfaces().Get(interface_type.interface_id); +auto ImplWitnessForDeclaration(Context& context, const SemIR::Impl& impl) + -> SemIR::InstId { + auto facet_type_id = context.GetTypeIdForTypeInst(impl.constraint_id); + if (facet_type_id == SemIR::ErrorInst::SingletonTypeId) { + return SemIR::ErrorInst::SingletonInstId; + } + auto facet_type = context.types().TryGetAs(facet_type_id); + if (!facet_type) { + CARBON_DIAGNOSTIC(ImplAsNonFacetType, Error, "impl as non-facet type {0}", + InstIdAsType); + context.emitter().Emit(impl.latest_decl_id(), ImplAsNonFacetType, + impl.constraint_id); + return SemIR::ErrorInst::SingletonInstId; + } + const SemIR::FacetTypeInfo& facet_type_info = + context.facet_types().Get(facet_type->facet_type_id); + + auto interface_type = facet_type_info.TryAsSingleInterface(); + if (!interface_type) { + context.TODO(impl.latest_decl_id(), "impl as not 1 interface"); + return SemIR::ErrorInst::SingletonInstId; + } + const auto& interface = + context.interfaces().Get(interface_type->interface_id); // TODO: This is going to try and define all the interfaces for this facet // type, and so once we support impl of a facet type with more than one // interface, it might give the wrong name in the diagnostic. if (!context.RequireDefinedType( - facet_type_id, context.insts().GetLocId(impl.definition_id), [&] { + facet_type_id, context.insts().GetLocId(impl.latest_decl_id()), [&] { CARBON_DIAGNOSTIC(ImplOfUndefinedInterface, Error, "implementation of undefined interface {0}", SemIR::NameId); - return context.emitter().Build(impl.definition_id, + return context.emitter().Build(impl.latest_decl_id(), ImplOfUndefinedInterface, interface.name_id); })) { return SemIR::ErrorInst::SingletonInstId; } + return SemIR::InstId::Invalid; +} +// Builds a witness that the specified impl implements the given interface. +static auto BuildInterfaceWitness( + Context& context, const SemIR::Impl& impl, + SemIR::FacetTypeInfo::ImplsConstraint interface_type, + llvm::SmallVectorImpl& used_decl_ids) -> SemIR::InstId { + const auto& interface = context.interfaces().Get(interface_type.interface_id); auto& impl_scope = context.name_scopes().Get(impl.scope_id); auto self_type_id = context.GetTypeIdForTypeInst(impl.self_id); @@ -225,33 +251,25 @@ static auto BuildInterfaceWitness( .elements_id = table_id}); } -auto BuildImplWitness(Context& context, SemIR::ImplId impl_id) +auto BuildImplWitness(Context& context, const SemIR::Impl& impl) -> SemIR::InstId { - auto& impl = context.impls().Get(impl_id); CARBON_CHECK(impl.is_being_defined()); + if (impl.witness_id == SemIR::ErrorInst::SingletonInstId) { + return SemIR::ErrorInst::SingletonInstId; + } auto facet_type_id = context.GetTypeIdForTypeInst(impl.constraint_id); - if (facet_type_id == SemIR::ErrorInst::SingletonTypeId) { - return SemIR::ErrorInst::SingletonInstId; - } - auto facet_type = context.types().TryGetAs(facet_type_id); - if (!facet_type) { - CARBON_DIAGNOSTIC(ImplAsNonFacetType, Error, "impl as non-facet-type"); - context.emitter().Emit(impl.definition_id, ImplAsNonFacetType); - return SemIR::ErrorInst::SingletonInstId; - } + CARBON_CHECK(facet_type_id != SemIR::ErrorInst::SingletonTypeId); + auto facet_type = context.types().GetAs(facet_type_id); const SemIR::FacetTypeInfo& facet_type_info = - context.facet_types().Get(facet_type->facet_type_id); + context.facet_types().Get(facet_type.facet_type_id); auto interface = facet_type_info.TryAsSingleInterface(); - if (!interface) { - context.TODO(impl.definition_id, "impl as not 1 interface"); - return SemIR::ErrorInst::SingletonInstId; - } + CARBON_CHECK(interface.has_value()); llvm::SmallVector used_decl_ids; - auto witness_id = BuildInterfaceWitness(context, impl, facet_type_id, - *interface, used_decl_ids); + auto witness_id = + BuildInterfaceWitness(context, impl, *interface, used_decl_ids); // TODO: Diagnose if any declarations in the impl are not in used_decl_ids. diff --git a/toolchain/check/impl.h b/toolchain/check/impl.h index 2d5471a0183d..418a4a29d068 100644 --- a/toolchain/check/impl.h +++ b/toolchain/check/impl.h @@ -10,8 +10,13 @@ namespace Carbon::Check { +// Returns the initial witness value for a new impl declaration. +auto ImplWitnessForDeclaration(Context& context, const SemIR::Impl& impl) + -> SemIR::InstId; + // Builds and returns a witness for the impl `impl_id`. -auto BuildImplWitness(Context& context, SemIR::ImplId impl_id) -> SemIR::InstId; +auto BuildImplWitness(Context& context, const SemIR::Impl& impl) + -> SemIR::InstId; } // namespace Carbon::Check diff --git a/toolchain/check/import_ref.cpp b/toolchain/check/import_ref.cpp index fe8a1a1655ff..7429ccc918ab 100644 --- a/toolchain/check/import_ref.cpp +++ b/toolchain/check/import_ref.cpp @@ -1898,8 +1898,8 @@ static auto AddImplDefinition(ImportContext& context, SemIR::Impl& new_impl, SemIR::InstId witness_id) -> void { new_impl.definition_id = new_impl.first_owning_decl_id; - new_impl.witness_id = witness_id; + new_impl.defined = true; if (import_impl.scope_id.is_valid()) { new_impl.scope_id = context.local_name_scopes().Add( diff --git a/toolchain/check/testdata/as/overloaded.carbon b/toolchain/check/testdata/as/overloaded.carbon index 5fdce48601bb..4b3a88e35913 100644 --- a/toolchain/check/testdata/as/overloaded.carbon +++ b/toolchain/check/testdata/as/overloaded.carbon @@ -34,15 +34,15 @@ let n: i32 = ((4 as i32) as X) as i32; // CHECK:STDOUT: %As.type.1: type = generic_interface_type @As [template] // CHECK:STDOUT: %As.generic: %As.type.1 = struct_value () [template] // CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(%X)> [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.2 [template] -// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.1, @As(%X) [template] -// CHECK:STDOUT: %interface.1: = interface_witness (%Convert.2) [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @As(%X) [template] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2 [template] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [template] +// CHECK:STDOUT: %interface.1: = interface_witness (%Convert.3) [template] // CHECK:STDOUT: %As.type.4: type = facet_type <@As, @As(%i32)> [template] -// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3 [template] -// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @As(%i32) [template] -// CHECK:STDOUT: %interface.2: = interface_witness (%Convert.4) [template] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.1, @As(%i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.3 [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %interface.2: = interface_witness (%Convert.5) [template] // CHECK:STDOUT: %int_4.1: Core.IntLiteral = int_value 4 [template] // CHECK:STDOUT: %Convert.type.13: type = fn_type @Convert.7, @impl.5(%int_32) [template] // CHECK:STDOUT: %Convert.13: %Convert.type.13 = struct_value () [template] @@ -50,7 +50,7 @@ let n: i32 = ((4 as i32) as X) as i32; // CHECK:STDOUT: %Convert.bound.1: = bound_method %int_4.1, %Convert.13 [template] // CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound.1, @Convert.7(%int_32) [template] // CHECK:STDOUT: %int_4.2: %i32 = int_value 4 [template] -// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_4.2, %Convert.2 [template] +// CHECK:STDOUT: %Convert.bound.2: = bound_method %int_4.2, %Convert.3 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -90,7 +90,7 @@ let n: i32 = ((4 as i32) as X) as i32; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: %i32 as %As.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.2 = fn_decl @Convert.2 [template = constants.%Convert.2] { +// CHECK:STDOUT: %Convert.decl: %Convert.type.3 = fn_decl @Convert.2 [template = constants.%Convert.3] { // CHECK:STDOUT: %self.patt: %i32 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %i32 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %X = return_slot_pattern @@ -114,7 +114,7 @@ let n: i32 = ((4 as i32) as X) as i32; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: %X.ref as %As.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.4 = fn_decl @Convert.3 [template = constants.%Convert.4] { +// CHECK:STDOUT: %Convert.decl: %Convert.type.5 = fn_decl @Convert.3 [template = constants.%Convert.5] { // CHECK:STDOUT: %self.patt: %X = binding_pattern self // CHECK:STDOUT: %self.param_patt: %X = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern @@ -170,21 +170,21 @@ let n: i32 = ((4 as i32) as X) as i32; // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [template = constants.%int_4.1] // CHECK:STDOUT: %int_32.loc23_21: Core.IntLiteral = int_value 32 [template = constants.%int_32] // CHECK:STDOUT: %i32.loc23_21: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %impl.elem0.loc23_18: %Convert.type.5 = interface_witness_access constants.%interface.21, element0 [template = constants.%Convert.13] +// CHECK:STDOUT: %impl.elem0.loc23_18: %Convert.type.4 = interface_witness_access constants.%interface.21, element0 [template = constants.%Convert.13] // CHECK:STDOUT: %Convert.bound.loc23_18: = bound_method %int_4, %impl.elem0.loc23_18 [template = constants.%Convert.bound.1] // CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound.loc23_18, @Convert.7(constants.%int_32) [template = constants.%Convert.specific_fn] // CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn(%int_4) [template = constants.%int_4.2] // CHECK:STDOUT: %.loc23_18.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_4.2] // CHECK:STDOUT: %.loc23_18.2: %i32 = converted %int_4, %.loc23_18.1 [template = constants.%int_4.2] // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [template = constants.%X] -// CHECK:STDOUT: %impl.elem0.loc23_26: %Convert.type.3 = interface_witness_access constants.%interface.1, element0 [template = constants.%Convert.2] +// CHECK:STDOUT: %impl.elem0.loc23_26: %Convert.type.2 = interface_witness_access constants.%interface.1, element0 [template = constants.%Convert.3] // CHECK:STDOUT: %Convert.bound.loc23_26: = bound_method %.loc23_18.2, %impl.elem0.loc23_26 [template = constants.%Convert.bound.2] // CHECK:STDOUT: %.loc23_26.1: ref %X = temporary_storage // CHECK:STDOUT: %Convert.call.loc23_26: init %X = call %Convert.bound.loc23_26(%.loc23_18.2) to %.loc23_26.1 // CHECK:STDOUT: %.loc23_26.2: init %X = converted %.loc23_18.2, %Convert.call.loc23_26 // CHECK:STDOUT: %int_32.loc23_35: Core.IntLiteral = int_value 32 [template = constants.%int_32] // CHECK:STDOUT: %i32.loc23_35: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %impl.elem0.loc23_32: %Convert.type.5 = interface_witness_access constants.%interface.2, element0 [template = constants.%Convert.4] +// CHECK:STDOUT: %impl.elem0.loc23_32: %Convert.type.4 = interface_witness_access constants.%interface.2, element0 [template = constants.%Convert.5] // CHECK:STDOUT: %Convert.bound.loc23_32: = bound_method %.loc23_26.2, %impl.elem0.loc23_32 // CHECK:STDOUT: %.loc23_26.3: ref %X = temporary %.loc23_26.1, %.loc23_26.2 // CHECK:STDOUT: %.loc23_26.4: %X = bind_value %.loc23_26.3 diff --git a/toolchain/check/testdata/class/access_modifers.carbon b/toolchain/check/testdata/class/access_modifers.carbon index 62a3ea56b054..8de0f6c34e8c 100644 --- a/toolchain/check/testdata/class/access_modifers.carbon +++ b/toolchain/check/testdata/class/access_modifers.carbon @@ -165,7 +165,7 @@ class A { // CHECK:STDOUT: %Make.type: type = fn_type @Make [template] // CHECK:STDOUT: %Make: %Make.type = struct_value () [template] // CHECK:STDOUT: %struct_type.radius.1: type = struct_type {.radius: %i32} [template] -// CHECK:STDOUT: %complete_type.4: = complete_type_witness %struct_type.radius.1 [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %struct_type.radius.1 [template] // CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: %Convert.bound.2: = bound_method %int_0.1, %Convert.10 [template] // CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] @@ -223,7 +223,7 @@ class A { // CHECK:STDOUT: %return.param: ref %Circle = out_param runtime_param0 // CHECK:STDOUT: %return: ref %Circle = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.radius.1 [template = constants.%complete_type.4] +// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.radius.1 [template = constants.%complete_type.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Circle @@ -474,7 +474,7 @@ class A { // CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_5.2: %i32 = int_value 5 [template] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.4: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -505,7 +505,7 @@ class A { // CHECK:STDOUT: %.loc5_17.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_5.2] // CHECK:STDOUT: %.loc5_17.2: %i32 = converted %int_5, %.loc5_17.1 [template = constants.%int_5.2] // CHECK:STDOUT: %x: %i32 = bind_name x, %.loc5_17.2 -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.4] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A @@ -536,7 +536,7 @@ class A { // CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_5.2: %i32 = int_value 5 [template] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.4: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -576,7 +576,7 @@ class A { // CHECK:STDOUT: %.loc6_25.1: %i32 = value_of_initializer %int.convert_checked.loc6 [template = constants.%int_5.2] // CHECK:STDOUT: %.loc6_25.2: %i32 = converted %int_5.loc6, %.loc6_25.1 [template = constants.%int_5.2] // CHECK:STDOUT: %y: %i32 = bind_name y, %.loc6_25.2 -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.4] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A diff --git a/toolchain/check/testdata/class/base_method.carbon b/toolchain/check/testdata/class/base_method.carbon index 05f383f2d8b7..969fd0117ae1 100644 --- a/toolchain/check/testdata/class/base_method.carbon +++ b/toolchain/check/testdata/class/base_method.carbon @@ -50,7 +50,7 @@ fn Call(p: Derived*) { // CHECK:STDOUT: %Derived: type = class_type @Derived [template] // CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %Base [template] // CHECK:STDOUT: %struct_type.base.1: type = struct_type {.base: %Base} [template] -// CHECK:STDOUT: %complete_type.5: = complete_type_witness %struct_type.base.1 [template] +// CHECK:STDOUT: %complete_type.4: = complete_type_witness %struct_type.base.1 [template] // CHECK:STDOUT: %ptr.3: type = ptr_type %Derived [template] // CHECK:STDOUT: %Call.type: type = fn_type @Call [template] // CHECK:STDOUT: %Call: %Call.type = struct_value () [template] @@ -126,7 +126,7 @@ fn Call(p: Derived*) { // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %.loc22: %Derived.elem = base_decl %Base.ref, element0 [template] -// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.base.1 [template = constants.%complete_type.5] +// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.base.1 [template = constants.%complete_type.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived diff --git a/toolchain/check/testdata/class/fail_field_modifiers.carbon b/toolchain/check/testdata/class/fail_field_modifiers.carbon index 9dda4c38cb64..99a39a16b2f0 100644 --- a/toolchain/check/testdata/class/fail_field_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_field_modifiers.carbon @@ -54,7 +54,7 @@ class Class { // CHECK:STDOUT: %Convert.specific_fn.2: = specific_function %Convert.bound.2, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_1.2: %i32 = int_value 1 [template] // CHECK:STDOUT: %struct_type.j.k: type = struct_type {.j: %i32, .k: %i32} [template] -// CHECK:STDOUT: %complete_type.4: = complete_type_witness %struct_type.j.k [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %struct_type.j.k [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -94,7 +94,7 @@ class Class { // CHECK:STDOUT: %.loc34_23.1: %i32 = value_of_initializer %int.convert_checked.loc34 [template = constants.%int_1.2] // CHECK:STDOUT: %.loc34_23.2: %i32 = converted %int_1, %.loc34_23.1 [template = constants.%int_1.2] // CHECK:STDOUT: %m: %i32 = bind_name m, %.loc34_23.2 -// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.j.k [template = constants.%complete_type.4] +// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.j.k [template = constants.%complete_type.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class diff --git a/toolchain/check/testdata/class/generic/complete_in_conversion.carbon b/toolchain/check/testdata/class/generic/complete_in_conversion.carbon index fd94cf83fc04..ee34b89a5c59 100644 --- a/toolchain/check/testdata/class/generic/complete_in_conversion.carbon +++ b/toolchain/check/testdata/class/generic/complete_in_conversion.carbon @@ -54,7 +54,7 @@ fn F(a: A(0)*) { // CHECK:STDOUT: %Convert.specific_fn.1: = specific_function %Convert.bound.1, @Convert.3(%int_32) [symbolic] // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %Convert.specific_fn.1(%N.2) [symbolic] // CHECK:STDOUT: %iN.builtin.2: type = int_type signed, %int.convert_checked [symbolic] -// CHECK:STDOUT: %require_complete.5: = require_complete_type %iN.builtin.2 [symbolic] +// CHECK:STDOUT: %require_complete.3: = require_complete_type %iN.builtin.2 [symbolic] // CHECK:STDOUT: %A.elem.2: type = unbound_element_type %A.1, %iN.builtin.2 [symbolic] // CHECK:STDOUT: %struct_type.base.n: type = struct_type {.base: %B, .n: %iN.builtin.2} [symbolic] // CHECK:STDOUT: %complete_type.4: = complete_type_witness %struct_type.base.n [symbolic] @@ -166,7 +166,7 @@ fn F(a: A(0)*) { // CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.3(constants.%int_32) [symbolic = %Convert.specific_fn (constants.%Convert.specific_fn.1)] // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %Convert.specific_fn(%N.loc6_9.2) [symbolic = %int.convert_checked (constants.%int.convert_checked)] // CHECK:STDOUT: %iN.builtin: type = int_type signed, %int.convert_checked [symbolic = %iN.builtin (constants.%iN.builtin.2)] -// CHECK:STDOUT: %require_complete: = require_complete_type @A.%iN.builtin (%iN.builtin.2) [symbolic = %require_complete (constants.%require_complete.5)] +// CHECK:STDOUT: %require_complete: = require_complete_type @A.%iN.builtin (%iN.builtin.2) [symbolic = %require_complete (constants.%require_complete.3)] // CHECK:STDOUT: %A.elem.loc12: type = unbound_element_type @A.%A (%A.1), @A.%iN.builtin (%iN.builtin.2) [symbolic = %A.elem.loc12 (constants.%A.elem.2)] // CHECK:STDOUT: %struct_type.base.n: type = struct_type {.base: %B, .n: @A.%iN.builtin (%iN.builtin.2)} [symbolic = %struct_type.base.n (constants.%struct_type.base.n)] // CHECK:STDOUT: %complete_type.loc13_1.2: = complete_type_witness @A.%struct_type.base.n (%struct_type.base.n) [symbolic = %complete_type.loc13_1.2 (constants.%complete_type.4)] diff --git a/toolchain/check/testdata/class/generic/import.carbon b/toolchain/check/testdata/class/generic/import.carbon index a37535e99a22..e180b5a83d38 100644 --- a/toolchain/check/testdata/class/generic/import.carbon +++ b/toolchain/check/testdata/class/generic/import.carbon @@ -249,7 +249,7 @@ class Class(U:! type) { // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [template] // CHECK:STDOUT: %Class.generic: %Class.type = struct_value () [template] // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T) [symbolic] -// CHECK:STDOUT: %require_complete.5: = require_complete_type %T [symbolic] +// CHECK:STDOUT: %require_complete.3: = require_complete_type %T [symbolic] // CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T [symbolic] // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %T} [symbolic] // CHECK:STDOUT: %complete_type.3: = complete_type_witness %struct_type.x [symbolic] @@ -328,7 +328,7 @@ class Class(U:! type) { // CHECK:STDOUT: %T.patt.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.1 (constants.%T.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @Class.%T.1 (%T) [symbolic = %require_complete (constants.%require_complete.5)] +// CHECK:STDOUT: %require_complete: = require_complete_type @Class.%T.1 (%T) [symbolic = %require_complete (constants.%require_complete.3)] // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T.1) [symbolic = %Class (constants.%Class)] // CHECK:STDOUT: %Class.elem: type = unbound_element_type @Class.%Class (%Class), @Class.%T.1 (%T) [symbolic = %Class.elem (constants.%Class.elem)] // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: @Class.%T.1 (%T)} [symbolic = %struct_type.x (constants.%struct_type.x)] diff --git a/toolchain/check/testdata/class/import.carbon b/toolchain/check/testdata/class/import.carbon index 1e85ae3f91f5..acbd0a629481 100644 --- a/toolchain/check/testdata/class/import.carbon +++ b/toolchain/check/testdata/class/import.carbon @@ -319,5 +319,5 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F[%self.param_patt: %ForwardDeclared.1]() [from "a.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @G[addr .inst947: %ptr.3]() [from "a.carbon"]; +// CHECK:STDOUT: fn @G[addr .inst942: %ptr.3]() [from "a.carbon"]; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/inheritance_access.carbon b/toolchain/check/testdata/class/inheritance_access.carbon index f26405ea0ff2..64b38201d71b 100644 --- a/toolchain/check/testdata/class/inheritance_access.carbon +++ b/toolchain/check/testdata/class/inheritance_access.carbon @@ -470,7 +470,7 @@ class B { // CHECK:STDOUT: %SomeProtectedFunction.type: type = fn_type @SomeProtectedFunction [template] // CHECK:STDOUT: %SomeProtectedFunction: %SomeProtectedFunction.type = struct_value () [template] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.4: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %B.elem: type = unbound_element_type %B, %A [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] @@ -478,7 +478,7 @@ class B { // CHECK:STDOUT: %H.type: type = fn_type @H [template] // CHECK:STDOUT: %H: %H.type = struct_value () [template] // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %A} [template] -// CHECK:STDOUT: %complete_type.5: = complete_type_witness %struct_type.base [template] +// CHECK:STDOUT: %complete_type.4: = complete_type_witness %struct_type.base [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -519,7 +519,7 @@ class B { // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param0 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.4] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A @@ -549,7 +549,7 @@ class B { // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param0 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.base [template = constants.%complete_type.5] +// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.base [template = constants.%complete_type.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B @@ -934,7 +934,7 @@ class B { // CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_5.2: %i32 = int_value 5 [template] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.4: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %Internal: type = class_type @Internal [template] // CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %B.elem: type = unbound_element_type %B, %Internal [template] @@ -943,7 +943,7 @@ class B { // CHECK:STDOUT: %SomeFunc.type: type = fn_type @SomeFunc [template] // CHECK:STDOUT: %SomeFunc: %SomeFunc.type = struct_value () [template] // CHECK:STDOUT: %struct_type.internal.1: type = struct_type {.internal: %Internal} [template] -// CHECK:STDOUT: %complete_type.5: = complete_type_witness %struct_type.internal.1 [template] +// CHECK:STDOUT: %complete_type.4: = complete_type_witness %struct_type.internal.1 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -985,7 +985,7 @@ class B { // CHECK:STDOUT: %.loc6_45.1: %i32 = value_of_initializer %int.convert_checked.loc6 [template = constants.%int_5.2] // CHECK:STDOUT: %.loc6_45.2: %i32 = converted %int_5.loc6, %.loc6_45.1 [template = constants.%int_5.2] // CHECK:STDOUT: %SOME_PRIVATE_CONSTANT: %i32 = bind_name SOME_PRIVATE_CONSTANT, %.loc6_45.2 -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.4] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A @@ -1003,7 +1003,7 @@ class B { // CHECK:STDOUT: %.loc10_43.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_5.2] // CHECK:STDOUT: %.loc10_43.2: %i32 = converted %int_5, %.loc10_43.1 [template = constants.%int_5.2] // CHECK:STDOUT: %INTERNAL_CONSTANT: %i32 = bind_name INTERNAL_CONSTANT, %.loc10_43.2 -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.4] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Internal @@ -1036,7 +1036,7 @@ class B { // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.internal.1 [template = constants.%complete_type.5] +// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.internal.1 [template = constants.%complete_type.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B diff --git a/toolchain/check/testdata/deduce/array.carbon b/toolchain/check/testdata/deduce/array.carbon index 2727d262db91..1465c11285a3 100644 --- a/toolchain/check/testdata/deduce/array.carbon +++ b/toolchain/check/testdata/deduce/array.carbon @@ -130,7 +130,7 @@ fn G() -> C { // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template] // CHECK:STDOUT: %array: %array_type.2 = tuple_value (%C.val, %C.val, %C.val) [template] // CHECK:STDOUT: %F.specific_fn: = specific_function %F, @F(%C) [template] -// CHECK:STDOUT: %complete_type.5: = complete_type_witness %array_type.2 [template] +// CHECK:STDOUT: %complete_type.4: = complete_type_witness %array_type.2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -263,7 +263,7 @@ fn G() -> C { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc6_27 => constants.%complete_type.1 -// CHECK:STDOUT: %require_complete.loc6_17 => constants.%complete_type.5 +// CHECK:STDOUT: %require_complete.loc6_17 => constants.%complete_type.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_todo_bound_only.carbon @@ -605,7 +605,7 @@ fn G() -> C { // CHECK:STDOUT: %array: %array_type.2 = tuple_value (%C.val, %C.val, %C.val) [template] // CHECK:STDOUT: %array_type.3: type = array_type %int_2, %C [template] // CHECK:STDOUT: %F.specific_fn: = specific_function %F, @F(%C) [template] -// CHECK:STDOUT: %complete_type.5: = complete_type_witness %array_type.3 [template] +// CHECK:STDOUT: %complete_type.4: = complete_type_witness %array_type.3 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -738,7 +738,7 @@ fn G() -> C { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc6_27 => constants.%complete_type.1 -// CHECK:STDOUT: %require_complete.loc6_17 => constants.%complete_type.5 +// CHECK:STDOUT: %require_complete.loc6_17 => constants.%complete_type.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_type_mismatch.carbon diff --git a/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon b/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon index 432d044bedff..d8dc3ca5204d 100644 --- a/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon +++ b/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon @@ -90,32 +90,32 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32)); // CHECK:STDOUT: %Add.facet: %Add.type = facet_value %i32.builtin, %i32.builtin [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.2) [template] // CHECK:STDOUT: %As.type.3: type = facet_type <@As, @As(%i32.builtin)> [template] -// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.3 [template] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.1, @As(%i32.builtin) [template] // CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.1, @As(%i32.builtin) [template] -// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [template] -// CHECK:STDOUT: %Convert.assoc_type.3: type = assoc_entity_type %As.type.3, %Convert.type.4 [template] +// CHECK:STDOUT: %Convert.assoc_type.3: type = assoc_entity_type %As.type.3, %Convert.type.3 [template] // CHECK:STDOUT: %assoc0.4: %Convert.assoc_type.3 = assoc_entity element0, @As.%Convert.decl [template] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3 [template] +// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [template] // CHECK:STDOUT: %As.facet: %As.type.2 = facet_value Core.IntLiteral, Core.IntLiteral [symbolic] -// CHECK:STDOUT: %interface.2: = interface_witness (%Convert.3) [template] +// CHECK:STDOUT: %interface.2: = interface_witness (%Convert.4) [template] // CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(%i32.builtin)> [template] -// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.4 [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.2, @ImplicitAs(%i32.builtin) [template] // CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.2, @ImplicitAs(%i32.builtin) [template] -// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [template] -// CHECK:STDOUT: %Convert.assoc_type.4: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.6 [template] +// CHECK:STDOUT: %Convert.assoc_type.4: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.5 [template] // CHECK:STDOUT: %assoc0.5: %Convert.assoc_type.4 = assoc_entity element0, @ImplicitAs.%Convert.decl [template] +// CHECK:STDOUT: %Convert.type.6: type = fn_type @Convert.4 [template] +// CHECK:STDOUT: %Convert.6: %Convert.type.6 = struct_value () [template] // CHECK:STDOUT: %ImplicitAs.facet.1: %ImplicitAs.type.2 = facet_value Core.IntLiteral, Core.IntLiteral [symbolic] -// CHECK:STDOUT: %interface.3: = interface_witness (%Convert.5) [template] +// CHECK:STDOUT: %interface.3: = interface_witness (%Convert.6) [template] // CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template] -// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.5 [template] +// CHECK:STDOUT: %Convert.type.7: type = fn_type @Convert.2, @ImplicitAs(Core.IntLiteral) [template] // CHECK:STDOUT: %Convert.7: %Convert.type.7 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.2, @ImplicitAs(Core.IntLiteral) [template] -// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [template] -// CHECK:STDOUT: %Convert.assoc_type.5: type = assoc_entity_type %ImplicitAs.type.4, %Convert.type.8 [template] +// CHECK:STDOUT: %Convert.assoc_type.5: type = assoc_entity_type %ImplicitAs.type.4, %Convert.type.7 [template] // CHECK:STDOUT: %assoc0.6: %Convert.assoc_type.5 = assoc_entity element0, @ImplicitAs.%Convert.decl [template] +// CHECK:STDOUT: %Convert.type.8: type = fn_type @Convert.5 [template] +// CHECK:STDOUT: %Convert.8: %Convert.type.8 = struct_value () [template] // CHECK:STDOUT: %ImplicitAs.facet.2: %ImplicitAs.type.2 = facet_value %i32.builtin, %i32.builtin [symbolic] -// CHECK:STDOUT: %interface.4: = interface_witness (%Convert.7) [template] +// CHECK:STDOUT: %interface.4: = interface_witness (%Convert.8) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -357,7 +357,7 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: %.loc23_17.2 as %As.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.3 = fn_decl @Convert.3 [template = constants.%Convert.3] { +// CHECK:STDOUT: %Convert.decl: %Convert.type.4 = fn_decl @Convert.3 [template = constants.%Convert.4] { // CHECK:STDOUT: %self.patt: Core.IntLiteral = binding_pattern self // CHECK:STDOUT: %self.param_patt: Core.IntLiteral = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %i32.builtin = return_slot_pattern @@ -381,7 +381,7 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.3: %.loc27_17.2 as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.5 = fn_decl @Convert.4 [template = constants.%Convert.5] { +// CHECK:STDOUT: %Convert.decl: %Convert.type.6 = fn_decl @Convert.4 [template = constants.%Convert.6] { // CHECK:STDOUT: %self.patt: Core.IntLiteral = binding_pattern self // CHECK:STDOUT: %self.param_patt: Core.IntLiteral = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %i32.builtin = return_slot_pattern @@ -405,7 +405,7 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.4: %.loc31_6.2 as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.7 = fn_decl @Convert.5 [template = constants.%Convert.7] { +// CHECK:STDOUT: %Convert.decl: %Convert.type.8 = fn_decl @Convert.5 [template = constants.%Convert.8] { // CHECK:STDOUT: %self.patt: %i32.builtin = binding_pattern self // CHECK:STDOUT: %self.param_patt: %i32.builtin = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: Core.IntLiteral = return_slot_pattern @@ -514,8 +514,8 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32)); // CHECK:STDOUT: !definition: // CHECK:STDOUT: %As.type => constants.%As.type.3 // CHECK:STDOUT: %Self.2 => constants.%Self.2 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.4 -// CHECK:STDOUT: %Convert => constants.%Convert.4 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.3 +// CHECK:STDOUT: %Convert => constants.%Convert.3 // CHECK:STDOUT: %Convert.assoc_type => constants.%Convert.assoc_type.3 // CHECK:STDOUT: %assoc0.loc12_32.2 => constants.%assoc0.4 // CHECK:STDOUT: } @@ -534,8 +534,8 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32)); // CHECK:STDOUT: !definition: // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 // CHECK:STDOUT: %Self.2 => constants.%Self.3 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.6 -// CHECK:STDOUT: %Convert => constants.%Convert.6 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 +// CHECK:STDOUT: %Convert => constants.%Convert.5 // CHECK:STDOUT: %Convert.assoc_type => constants.%Convert.assoc_type.4 // CHECK:STDOUT: %assoc0.loc16_32.2 => constants.%assoc0.5 // CHECK:STDOUT: } @@ -554,8 +554,8 @@ var arr: [i32; (1 as i32) + (2 as i32)] = (3, 4, (3 as i32) + (4 as i32)); // CHECK:STDOUT: !definition: // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 // CHECK:STDOUT: %Self.2 => constants.%Self.3 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.8 -// CHECK:STDOUT: %Convert => constants.%Convert.8 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.7 +// CHECK:STDOUT: %Convert => constants.%Convert.7 // CHECK:STDOUT: %Convert.assoc_type => constants.%Convert.assoc_type.5 // CHECK:STDOUT: %assoc0.loc16_32.2 => constants.%assoc0.6 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/generic/deduce.carbon b/toolchain/check/testdata/function/generic/deduce.carbon index c10d45129644..835b05a327f2 100644 --- a/toolchain/check/testdata/function/generic/deduce.carbon +++ b/toolchain/check/testdata/function/generic/deduce.carbon @@ -792,7 +792,7 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] // CHECK:STDOUT: %tuple: %tuple.type.4 = tuple_value (%int_1, %int_2.2) [template] -// CHECK:STDOUT: %complete_type.4: = complete_type_witness %tuple.type.4 [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %tuple.type.4 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -877,7 +877,7 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %tuple.type => constants.%tuple.type.4 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%complete_type.4 +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- deduce_nested_struct.carbon @@ -907,7 +907,7 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.2(%int_32) [template] // CHECK:STDOUT: %int_2.2: %i32 = int_value 2 [template] // CHECK:STDOUT: %struct: %struct_type.a.b.3 = struct_value (%int_1, %int_2.2) [template] -// CHECK:STDOUT: %complete_type.4: = complete_type_witness %struct_type.a.b.3 [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %struct_type.a.b.3 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -991,7 +991,7 @@ fn CallImplicitNotDeducible() { // CHECK:STDOUT: %struct_type.a.b.loc4_44.2 => constants.%struct_type.a.b.3 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete => constants.%complete_type.4 +// CHECK:STDOUT: %require_complete => constants.%complete_type.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_deduce_bigger_struct.carbon diff --git a/toolchain/check/testdata/function/generic/undefined.carbon b/toolchain/check/testdata/function/generic/undefined.carbon index 76b13e58c7bd..1f767fe2abaf 100644 --- a/toolchain/check/testdata/function/generic/undefined.carbon +++ b/toolchain/check/testdata/function/generic/undefined.carbon @@ -187,7 +187,7 @@ fn CallUndefined() -> i32 { // CHECK:STDOUT: %Convert.specific_fn: = specific_function %Convert.bound, @Convert.5(%int_32) [template] // CHECK:STDOUT: %int_0.2: %i32 = int_value 0 [template] // CHECK:STDOUT: %Defined.specific_fn: = specific_function %Defined, @Defined(%i32) [template] -// CHECK:STDOUT: %require_complete.5: = require_complete_type %T [symbolic] +// CHECK:STDOUT: %require_complete.3: = require_complete_type %T [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -256,7 +256,7 @@ fn CallUndefined() -> i32 { // CHECK:STDOUT: %T.patt.loc4: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4 (constants.%T.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @Defined.%T.loc4_12.2 (%T) [symbolic = %require_complete (constants.%require_complete.5)] +// CHECK:STDOUT: %require_complete: = require_complete_type @Defined.%T.loc4_12.2 (%T) [symbolic = %require_complete (constants.%require_complete.3)] // CHECK:STDOUT: // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: %T) -> %T { // CHECK:STDOUT: !entry: 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 61b7c3884f98..b3a19ff0101f 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -60,7 +60,7 @@ class C { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %i32 [template] // CHECK:STDOUT: %struct_type.n: type = struct_type {.n: %i32} [template] -// CHECK:STDOUT: %complete_type.4: = complete_type_witness %struct_type.n [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %struct_type.n [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -96,7 +96,7 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %.loc49: %C.elem = field_decl n, element0 [template] -// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.n [template = constants.%complete_type.4] +// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.n [template = constants.%complete_type.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C diff --git a/toolchain/check/testdata/impl/declaration.carbon b/toolchain/check/testdata/impl/declaration.carbon index 5447e66bcbf0..2d9d98a9a42c 100644 --- a/toolchain/check/testdata/impl/declaration.carbon +++ b/toolchain/check/testdata/impl/declaration.carbon @@ -12,6 +12,8 @@ interface I {} impl i32 as I; +impl i32 as I {} + // CHECK:STDOUT: --- declaration.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -19,6 +21,7 @@ impl i32 as I; // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template] +// CHECK:STDOUT: %interface: = interface_witness () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -37,9 +40,14 @@ impl i32 as I; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @impl [template] {} { -// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32] -// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] -// CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type] +// CHECK:STDOUT: %int_32.loc13: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc13: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %I.ref.loc13: type = name_ref I, file.%I.decl [template = constants.%I.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [template = constants.%int_32] +// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] +// CHECK:STDOUT: %I.ref.loc15: type = name_ref I, file.%I.decl [template = constants.%I.type] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -51,5 +59,10 @@ impl i32 as I; // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %i32 as %I.ref; +// CHECK:STDOUT: impl @impl: %i32.loc13 as %I.ref.loc13 { +// CHECK:STDOUT: %interface: = interface_witness () [template = constants.%interface] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = %interface +// CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/extend_impl_generic.carbon b/toolchain/check/testdata/impl/extend_impl_generic.carbon index 6437f4563206..4a3303e73655 100644 --- a/toolchain/check/testdata/impl/extend_impl_generic.carbon +++ b/toolchain/check/testdata/impl/extend_impl_generic.carbon @@ -394,7 +394,6 @@ class X(U:! type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%U) [symbolic = %F.type (constants.%F.type.3)] // CHECK:STDOUT: %F: @impl.%F.type (%F.type.3) = struct_value () [symbolic = %F (constants.%F.3)] -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%I.type.loc9_21.2 (%I.type.3) [symbolic = %require_complete (constants.%require_complete.1)] // CHECK:STDOUT: %interface.loc9_23.2: = interface_witness (%F) [symbolic = %interface.loc9_23.2 (constants.%interface)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %Self.ref as %I.type.loc9_21.1 { @@ -522,7 +521,6 @@ class X(U:! type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %F.type => constants.%F.type.3 // CHECK:STDOUT: %F => constants.%F.3 -// CHECK:STDOUT: %require_complete => constants.%require_complete.1 // CHECK:STDOUT: %interface.loc9_23.2 => constants.%interface // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon index bfd1018450ce..ed1328a11718 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon @@ -37,7 +37,6 @@ class C { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %F.type.2: type = fn_type @F.2, @impl(%T) [symbolic] // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [symbolic] -// CHECK:STDOUT: %require_complete.1: = require_complete_type %GenericInterface.type.2 [symbolic] // CHECK:STDOUT: %GenericInterface.facet: %GenericInterface.type.2 = facet_value %C, %C [symbolic] // CHECK:STDOUT: %interface: = interface_witness (%F.2) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] @@ -108,7 +107,6 @@ class C { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%T.loc19_23.2) [symbolic = %F.type (constants.%F.type.2)] // CHECK:STDOUT: %F: @impl.%F.type (%F.type.2) = struct_value () [symbolic = %F (constants.%F.2)] -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%GenericInterface.type.loc19_54.2 (%GenericInterface.type.2) [symbolic = %require_complete (constants.%require_complete.1)] // CHECK:STDOUT: %interface.loc19_56.2: = interface_witness (%F) [symbolic = %interface.loc19_56.2 (constants.%interface)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %Self.ref as %GenericInterface.type.loc19_54.1 { @@ -196,7 +194,6 @@ class C { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %F.type => constants.%F.type.2 // CHECK:STDOUT: %F => constants.%F.2 -// CHECK:STDOUT: %require_complete => constants.%require_complete.1 // CHECK:STDOUT: %interface.loc19_56.2 => constants.%interface // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon index d91519cdd77f..f4d54622a79b 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon @@ -19,13 +19,17 @@ class C { } class D { - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+7]]:3: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs] + // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+11]]:3: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs] // CHECK:STDERR: extend impl D as I; // CHECK:STDERR: ^~~~~~ - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+4]]:15: note: remove the explicit `Self` type here [ExtendImplSelfAsDefault] + // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+8]]:15: note: remove the explicit `Self` type here [ExtendImplSelfAsDefault] // CHECK:STDERR: extend impl D as I; // CHECK:STDERR: ^ // CHECK:STDERR: + // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+4]]:3: error: impl declared but not defined [MissingImplDefinition] + // CHECK:STDERR: extend impl D as I; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: extend impl D as I; } diff --git a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon index 0fce8555f406..dc5251a7ae7d 100644 --- a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon @@ -9,7 +9,15 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_extend_non_interface.carbon class C { - // CHECK:STDERR: fail_extend_non_interface.carbon:[[@LINE+3]]:3: error: semantics TODO: `extending non-facet-type constraint` [SemanticsTodo] + // CHECK:STDERR: fail_extend_non_interface.carbon:[[@LINE+11]]:3: error: impl as non-facet type `i32` [ImplAsNonFacetType] + // CHECK:STDERR: extend impl as i32; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + // CHECK:STDERR: fail_extend_non_interface.carbon:[[@LINE+7]]:3: error: semantics TODO: `extending non-facet-type constraint` [SemanticsTodo] + // CHECK:STDERR: extend impl as i32; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + // CHECK:STDERR: fail_extend_non_interface.carbon:[[@LINE+3]]:3: error: impl declared but not defined [MissingImplDefinition] // CHECK:STDERR: extend impl as i32; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ extend impl as i32; diff --git a/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon b/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon index f9107f478480..680d7ed772a6 100644 --- a/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon @@ -10,12 +10,16 @@ interface I { class C { - // CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE+6]]:5: error: `extend impl` requires a definition for facet type `I` [ExtendUndefinedInterface] + // CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE+10]]:5: error: implementation of undefined interface I [ImplOfUndefinedInterface] // CHECK:STDERR: extend impl as I; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE-5]]:1: note: interface is currently being defined [InterfaceUndefinedWithinDefinition] // CHECK:STDERR: interface I { // CHECK:STDERR: ^~~~~~~~~~~~~ + // CHECK:STDERR: + // CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE+3]]:5: error: impl declared but not defined [MissingImplDefinition] + // CHECK:STDERR: extend impl as I; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ extend impl as I; } } @@ -72,12 +76,12 @@ interface I { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C.2 [symbolic = %C (constants.%C.2)] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc19: type = specific_constant @impl.%I.ref, @impl(constants.%Self) [template = constants.%I.type] +// CHECK:STDOUT: %.loc23: type = specific_constant @impl.%I.ref, @impl(constants.%Self) [template = constants.%I.type] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C.2 -// CHECK:STDOUT: extend %.loc19 +// CHECK:STDOUT: extend %.loc23 // CHECK:STDOUT: has_error // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon b/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon index 1eb3a0f3b2d1..f54451d025a4 100644 --- a/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon @@ -11,13 +11,17 @@ interface I; class C { - // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE+7]]:3: error: `extend impl` requires a definition for facet type `I` [ExtendUndefinedInterface] + // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE+11]]:3: error: implementation of undefined interface I [ImplOfUndefinedInterface] // CHECK:STDERR: extend impl as I; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-6]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: interface I; // CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: + // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE+4]]:3: error: impl declared but not defined [MissingImplDefinition] + // CHECK:STDERR: extend impl as I; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: extend impl as I; } @@ -25,7 +29,7 @@ fn F(c: C) { // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE+10]]:3: error: member access into undefined interface `I` [QualifiedExprInUndefinedInterfaceScope] // CHECK:STDERR: C.F(); // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-17]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] + // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-21]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: interface I; // CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-10]]:18: note: declared as an extended scope here [FromExtendHere] @@ -36,7 +40,7 @@ fn F(c: C) { // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE+9]]:3: error: member access into undefined interface `I` [QualifiedExprInUndefinedInterfaceScope] // CHECK:STDERR: c.F(); // CHECK:STDERR: ^~~ - // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-28]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] + // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-32]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere] // CHECK:STDERR: interface I; // CHECK:STDERR: ^~~~~~~~~~~~ // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-21]]:18: note: declared as an extended scope here [FromExtendHere] @@ -78,7 +82,7 @@ fn F(c: C) { // CHECK:STDOUT: %c.param_patt: %C = value_param_pattern %c.patt, runtime_param0 // CHECK:STDOUT: } { // CHECK:STDOUT: %c.param: %C = value_param runtime_param0 -// CHECK:STDOUT: %C.ref.loc24: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc28: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %c: %C = bind_name c, %c.param // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -103,10 +107,10 @@ fn F(c: C) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%c.param_patt: %C) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref.loc35: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %F.ref.loc35: = name_ref F, [template = ] +// CHECK:STDOUT: %C.ref.loc39: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %F.ref.loc39: = name_ref F, [template = ] // CHECK:STDOUT: %c.ref: %C = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc45: = name_ref F, [template = ] +// CHECK:STDOUT: %F.ref.loc49: = name_ref F, [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon index ccdd469256df..55085a9af151 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon @@ -25,7 +25,7 @@ impl i32 as false {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_impl_as_type.carbon:[[@LINE+4]]:1: error: impl as non-facet-type [ImplAsNonFacetType] +// CHECK:STDERR: fail_impl_as_type.carbon:[[@LINE+4]]:1: error: impl as non-facet type `type` [ImplAsNonFacetType] // CHECK:STDERR: impl bool as type {} // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon index 156aec97460f..308a5385b1f6 100644 --- a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon @@ -13,6 +13,10 @@ interface I { } class C { + // CHECK:STDERR: fail_todo_undefined_impl.carbon:[[@LINE+4]]:3: error: impl declared but not defined [MissingImplDefinition] + // CHECK:STDERR: extend impl as I; + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~ + // CHECK:STDERR: extend impl as I; } diff --git a/toolchain/check/testdata/impl/lookup/generic.carbon b/toolchain/check/testdata/impl/lookup/generic.carbon index 3b641b491610..aa9a3ff1538e 100644 --- a/toolchain/check/testdata/impl/lookup/generic.carbon +++ b/toolchain/check/testdata/impl/lookup/generic.carbon @@ -694,7 +694,6 @@ fn G(x: A) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %F.type.2: type = fn_type @F.2, @impl(%T) [symbolic] // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %HasF.type.2 [symbolic] // CHECK:STDOUT: %HasF.facet: %HasF.type.2 = facet_value %empty_struct_type, %empty_struct_type [symbolic] // CHECK:STDOUT: %interface.1: = interface_witness (%F.2) [symbolic] // CHECK:STDOUT: %G.type: type = fn_type @G [template] @@ -706,7 +705,6 @@ fn G(x: A) { // CHECK:STDOUT: %assoc0.2: %F.assoc_type.2 = assoc_entity element0, @HasF.%F.decl [template] // CHECK:STDOUT: %F.type.4: type = fn_type @F.2, @impl(%empty_struct_type) [template] // CHECK:STDOUT: %F.4: %F.type.4 = struct_value () [template] -// CHECK:STDOUT: %complete_type: = complete_type_witness %HasF.type.3 [template] // CHECK:STDOUT: %interface.2: = interface_witness (%F.4) [template] // CHECK:STDOUT: %F.specific_fn: = specific_function %F.4, @F.2(%empty_struct_type) [template] // CHECK:STDOUT: } @@ -789,7 +787,6 @@ fn G(x: A) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%T.loc8_14.2) [symbolic = %F.type (constants.%F.type.2)] // CHECK:STDOUT: %F: @impl.%F.type (%F.type.2) = struct_value () [symbolic = %F (constants.%F.2)] -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%HasF.type.loc8_36.2 (%HasF.type.2) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: %interface.loc8_38.2: = interface_witness (%F) [symbolic = %interface.loc8_38.2 (constants.%interface.1)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %.loc8_25.2 as %HasF.type.loc8_36.1 { @@ -858,7 +855,6 @@ fn G(x: A) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %F.type => constants.%F.type.2 // CHECK:STDOUT: %F => constants.%F.2 -// CHECK:STDOUT: %require_complete => constants.%require_complete // CHECK:STDOUT: %interface.loc8_38.2 => constants.%interface.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -889,7 +885,6 @@ fn G(x: A) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %F.type => constants.%F.type.4 // CHECK:STDOUT: %F => constants.%F.4 -// CHECK:STDOUT: %require_complete => constants.%complete_type // CHECK:STDOUT: %interface.loc8_38.2 => constants.%interface.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1049,7 +1044,6 @@ fn G(x: A) { // CHECK:STDOUT: %assoc0.1: %F.assoc_type.1 = assoc_entity element0, @HasF.%F.decl [symbolic] // CHECK:STDOUT: %F.type.2: type = fn_type @F.2, @impl(%T) [symbolic] // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %HasF.type.2 [symbolic] // CHECK:STDOUT: %HasF.facet: %HasF.type.2 = facet_value %T, %T [symbolic] // CHECK:STDOUT: %interface: = interface_witness (%F.2) [symbolic] // CHECK:STDOUT: %A: type = class_type @A [template] @@ -1143,7 +1137,6 @@ fn G(x: A) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%T.loc8_14.2) [symbolic = %F.type (constants.%F.type.2)] // CHECK:STDOUT: %F: @impl.%F.type (%F.type.2) = struct_value () [symbolic = %F (constants.%F.2)] -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%HasF.type.loc8_35.2 (%HasF.type.2) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: %interface.loc8_37.2: = interface_witness (%F) [symbolic = %interface.loc8_37.2 (constants.%interface)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %T.ref.loc8_24 as %HasF.type.loc8_35.1 { @@ -1224,7 +1217,6 @@ fn G(x: A) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %F.type => constants.%F.type.2 // CHECK:STDOUT: %F => constants.%F.2 -// CHECK:STDOUT: %require_complete => constants.%require_complete // CHECK:STDOUT: %interface.loc8_37.2 => constants.%interface // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/no_prelude/impl_forall.carbon b/toolchain/check/testdata/impl/lookup/no_prelude/impl_forall.carbon index 39dd266d92e1..a3b59f8ec8c1 100644 --- a/toolchain/check/testdata/impl/lookup/no_prelude/impl_forall.carbon +++ b/toolchain/check/testdata/impl/lookup/no_prelude/impl_forall.carbon @@ -59,15 +59,14 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: %V.patt: type = symbolic_binding_pattern V, 0 [symbolic] // CHECK:STDOUT: %A.2: type = class_type @A, @A(%V) [symbolic] // CHECK:STDOUT: %I.type.3: type = facet_type <@I, @I(%V)> [symbolic] -// CHECK:STDOUT: %F.type.2: type = fn_type @F.2, @impl(%V) [symbolic] +// CHECK:STDOUT: %F.type.2: type = fn_type @F.1, @I(%V) [symbolic] // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [symbolic] -// CHECK:STDOUT: %require_complete.2: = require_complete_type %I.type.3 [symbolic] -// CHECK:STDOUT: %F.type.3: type = fn_type @F.1, @I(%V) [symbolic] -// CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [symbolic] -// CHECK:STDOUT: %F.assoc_type.2: type = assoc_entity_type %I.type.3, %F.type.3 [symbolic] +// CHECK:STDOUT: %F.assoc_type.2: type = assoc_entity_type %I.type.3, %F.type.2 [symbolic] // CHECK:STDOUT: %assoc0.2: %F.assoc_type.2 = assoc_entity element0, @I.%F.decl [symbolic] +// CHECK:STDOUT: %F.type.3: type = fn_type @F.2, @impl(%V) [symbolic] +// CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [symbolic] // CHECK:STDOUT: %I.facet: %I.type.2 = facet_value %A.2, %A.2 [symbolic] -// CHECK:STDOUT: %interface.1: = interface_witness (%F.2) [symbolic] +// CHECK:STDOUT: %interface.1: = interface_witness (%F.3) [symbolic] // CHECK:STDOUT: %require_complete.3: = require_complete_type %V [symbolic] // CHECK:STDOUT: %A.elem.2: type = unbound_element_type %A.2, %V [symbolic] // CHECK:STDOUT: %struct_type.n.2: type = struct_type {.n: %V} [symbolic] @@ -107,7 +106,6 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: %assoc0.4: %F.assoc_type.4 = assoc_entity element0, @I.%F.decl [template] // CHECK:STDOUT: %F.type.7: type = fn_type @F.2, @impl(%empty_struct_type) [template] // CHECK:STDOUT: %F.7: %F.type.7 = struct_value () [template] -// CHECK:STDOUT: %complete_type.6: = complete_type_witness %I.type.5 [template] // CHECK:STDOUT: %interface.3: = interface_witness (%F.7) [template] // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [template] // CHECK:STDOUT: } @@ -236,13 +234,12 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: %I.type.loc10_35.2: type = facet_type <@I, @I(%V.loc10_14.2)> [symbolic = %I.type.loc10_35.2 (constants.%I.type.3)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%V.loc10_14.2) [symbolic = %F.type (constants.%F.type.2)] -// CHECK:STDOUT: %F: @impl.%F.type (%F.type.2) = struct_value () [symbolic = %F (constants.%F.2)] -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%I.type.loc10_35.2 (%I.type.3) [symbolic = %require_complete (constants.%require_complete.2)] +// CHECK:STDOUT: %F.type: type = fn_type @F.2, @impl(%V.loc10_14.2) [symbolic = %F.type (constants.%F.type.3)] +// CHECK:STDOUT: %F: @impl.%F.type (%F.type.3) = struct_value () [symbolic = %F (constants.%F.3)] // CHECK:STDOUT: %interface.loc10_37.2: = interface_witness (%F) [symbolic = %interface.loc10_37.2 (constants.%interface.1)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %A.loc10_27.1 as %I.type.loc10_35.1 { -// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.2) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.2)] { +// CHECK:STDOUT: %F.decl: @impl.%F.type (%F.type.3) = fn_decl @F.2 [symbolic = @impl.%F (constants.%F.3)] { // CHECK:STDOUT: %self.patt: @F.2.%A (%A.2) = binding_pattern self // CHECK:STDOUT: %self.param_patt: @F.2.%A (%A.2) = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: @F.2.%V (%V) = return_slot_pattern @@ -409,8 +406,8 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %I.type => constants.%I.type.3 // CHECK:STDOUT: %Self.2 => constants.%Self -// CHECK:STDOUT: %F.type => constants.%F.type.3 -// CHECK:STDOUT: %F => constants.%F.3 +// CHECK:STDOUT: %F.type => constants.%F.type.2 +// CHECK:STDOUT: %F => constants.%F.2 // CHECK:STDOUT: %F.assoc_type => constants.%F.assoc_type.2 // CHECK:STDOUT: %assoc0.loc7_26.2 => constants.%assoc0.2 // CHECK:STDOUT: } @@ -426,9 +423,8 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: %I.type.loc10_35.2 => constants.%I.type.3 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %F.type => constants.%F.type.2 -// CHECK:STDOUT: %F => constants.%F.2 -// CHECK:STDOUT: %require_complete => constants.%require_complete.2 +// CHECK:STDOUT: %F.type => constants.%F.type.3 +// CHECK:STDOUT: %F => constants.%F.3 // CHECK:STDOUT: %interface.loc10_37.2 => constants.%interface.1 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -490,7 +486,6 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %F.type => constants.%F.type.5 // CHECK:STDOUT: %F => constants.%F.5 -// CHECK:STDOUT: %require_complete => constants.%require_complete.7 // CHECK:STDOUT: %interface.loc10_37.2 => constants.%interface.2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -542,7 +537,6 @@ fn TestSpecific(a: A({})) -> {} { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %F.type => constants.%F.type.7 // CHECK:STDOUT: %F => constants.%F.7 -// CHECK:STDOUT: %require_complete => constants.%complete_type.6 // CHECK:STDOUT: %interface.loc10_37.2 => constants.%interface.3 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon b/toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon index e364b3ba25fe..723df87dde21 100644 --- a/toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon +++ b/toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon @@ -179,14 +179,14 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %F.assoc_type.1: type = assoc_entity_type %I.type.2, %F.type.1 [symbolic] // CHECK:STDOUT: %assoc0.1: %F.assoc_type.1 = assoc_entity element0, imports.%import_ref.9 [symbolic] // CHECK:STDOUT: %I.type.3: type = facet_type <@I, @I(%InInterfaceArgs)> [template] -// CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %F.type.2: type = fn_type @F.1, @I(%InInterfaceArgs) [template] // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template] -// CHECK:STDOUT: %F.type.3: type = fn_type @F.1, @I(%InInterfaceArgs) [template] -// CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template] -// CHECK:STDOUT: %F.assoc_type.2: type = assoc_entity_type %I.type.3, %F.type.3 [template] +// CHECK:STDOUT: %F.assoc_type.2: type = assoc_entity_type %I.type.3, %F.type.2 [template] // CHECK:STDOUT: %assoc0.2: %F.assoc_type.2 = assoc_entity element0, imports.%import_ref.9 [template] +// CHECK:STDOUT: %F.type.3: type = fn_type @F.2 [template] +// CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template] // CHECK:STDOUT: %I.facet: %I.type.2 = facet_value %X, %X [symbolic] -// CHECK:STDOUT: %interface: = interface_witness (%F.2) [template] +// CHECK:STDOUT: %interface: = interface_witness (%F.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -239,7 +239,7 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %X.ref as %I.type { -// CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] {} {} +// CHECK:STDOUT: %F.decl: %F.type.3 = fn_decl @F.2 [template = constants.%F.3] {} {} // CHECK:STDOUT: %interface: = interface_witness (%F.decl) [template = constants.%interface] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -287,8 +287,8 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: !definition: // CHECK:STDOUT: %I.type => constants.%I.type.3 // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %F.type => constants.%F.type.3 -// CHECK:STDOUT: %F => constants.%F.3 +// CHECK:STDOUT: %F.type => constants.%F.type.2 +// CHECK:STDOUT: %F => constants.%F.2 // CHECK:STDOUT: %F.assoc_type => constants.%F.assoc_type.2 // CHECK:STDOUT: %assoc0 => constants.%assoc0.2 // CHECK:STDOUT: } @@ -463,14 +463,14 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: %assoc0.1: %F.assoc_type.1 = assoc_entity element0, imports.%import_ref.9 [symbolic] // CHECK:STDOUT: %X: type = class_type @X [template] // CHECK:STDOUT: %I.type.3: type = facet_type <@I, @I(%X)> [template] -// CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %F.type.2: type = fn_type @F.1, @I(%X) [template] // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template] -// CHECK:STDOUT: %F.type.3: type = fn_type @F.1, @I(%X) [template] -// CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template] -// CHECK:STDOUT: %F.assoc_type.2: type = assoc_entity_type %I.type.3, %F.type.3 [template] +// CHECK:STDOUT: %F.assoc_type.2: type = assoc_entity_type %I.type.3, %F.type.2 [template] // CHECK:STDOUT: %assoc0.2: %F.assoc_type.2 = assoc_entity element0, imports.%import_ref.9 [template] +// CHECK:STDOUT: %F.type.3: type = fn_type @F.2 [template] +// CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template] // CHECK:STDOUT: %I.facet: %I.type.2 = facet_value %C.2, %C.2 [symbolic] -// CHECK:STDOUT: %interface: = interface_witness (%F.2) [template] +// CHECK:STDOUT: %interface: = interface_witness (%F.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -527,7 +527,7 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %C as %I.type { -// CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] {} {} +// CHECK:STDOUT: %F.decl: %F.type.3 = fn_decl @F.2 [template = constants.%F.3] {} {} // CHECK:STDOUT: %interface: = interface_witness (%F.decl) [template = constants.%interface] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -598,8 +598,8 @@ fn H(c: C(InClassArgs)) { c.(I(X).F)(); } // CHECK:STDOUT: !definition: // CHECK:STDOUT: %I.type => constants.%I.type.3 // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %F.type => constants.%F.type.3 -// CHECK:STDOUT: %F => constants.%F.3 +// CHECK:STDOUT: %F.type => constants.%F.type.2 +// CHECK:STDOUT: %F => constants.%F.2 // CHECK:STDOUT: %F.assoc_type => constants.%F.assoc_type.2 // CHECK:STDOUT: %assoc0 => constants.%assoc0.2 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/no_prelude/import_generic.carbon b/toolchain/check/testdata/impl/no_prelude/import_generic.carbon index 0c29458fc32a..625b71a12dfc 100644 --- a/toolchain/check/testdata/impl/no_prelude/import_generic.carbon +++ b/toolchain/check/testdata/impl/no_prelude/import_generic.carbon @@ -15,28 +15,87 @@ library "[[@TEST_NAME]]"; class C {} interface I(T:! type) {} +// Has both declaration and definition. impl forall [T:! type] C as I(T); -impl forall [T:! type] C as I(T*) {} - -// --- import_generic.impl.carbon - -impl library "[[@TEST_NAME]]"; - impl forall [T:! type] C as I(T) {} +// Only has definition. +impl forall [T:! type] C as I(T*) {} + // --- fail_import_generic.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+7]]:1: error: redefinition of `impl C as I(T*)` [ImplRedefinition] -// CHECK:STDERR: impl forall [T:! type] C as I(T*) {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE-5]]:6: in import [InImport] -// CHECK:STDERR: import_generic.carbon:8:1: note: previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: impl forall [T:! type] C as I(T); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +impl forall [T:! type] C as I(T); + +// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: impl forall [T:! type] C as I(T) {} +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +impl forall [T:! type] C as I(T) {} + +// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: impl forall [T:! type] C as I(T*); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +impl forall [T:! type] C as I(T*); + +// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl forall [T:! type] C as I(T*) {} // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: impl forall [T:! type] C as I(T*) {} +// --- fail_import_generic_decl.carbon + +library "[[@TEST_NAME]]"; + +class D {} +interface J(T:! type) {} + +// CHECK:STDERR: fail_import_generic_decl.carbon:[[@LINE+4]]:1: error: impl declared but not defined [MissingImplDefinition] +// CHECK:STDERR: impl forall [T:! type] D as J(T); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +impl forall [T:! type] D as J(T); + +// CHECK:STDERR: fail_import_generic_decl.carbon:[[@LINE+4]]:1: error: impl declared but not defined [MissingImplDefinition] +// CHECK:STDERR: impl forall [T:! type] D as J(T*); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +impl forall [T:! type] D as J(T*); + +// --- fail_import_generic_decl.impl.carbon + +impl library "[[@TEST_NAME]]"; + +// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: impl forall [T:! type] D as J(T); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +impl forall [T:! type] D as J(T); + +// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: impl forall [T:! type] D as J(T) {} +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +impl forall [T:! type] D as J(T) {} + +// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: impl forall [T:! type] D as J(T*); +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +impl forall [T:! type] D as J(T*); + +// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+3]]:1: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: impl forall [T:! type] D as J(T*) {} +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +impl forall [T:! type] D as J(T*) {} + // CHECK:STDOUT: --- import_generic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -49,10 +108,9 @@ impl forall [T:! type] C as I(T*) {} // CHECK:STDOUT: %I.generic: %I.type.1 = struct_value () [template] // CHECK:STDOUT: %I.type.2: type = facet_type <@I, @I(%T)> [symbolic] // CHECK:STDOUT: %Self: %I.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %interface: = interface_witness () [template] // CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic] // CHECK:STDOUT: %I.type.3: type = facet_type <@I, @I(%ptr)> [symbolic] -// CHECK:STDOUT: %require_complete: = require_complete_type %I.type.3 [symbolic] -// CHECK:STDOUT: %interface: = interface_witness () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -69,27 +127,38 @@ impl forall [T:! type] C as I(T*) {} // CHECK:STDOUT: %T.loc5_13.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc5_13.2 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.1 [template] { -// CHECK:STDOUT: %T.patt.loc7_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_14.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc7_14.1, runtime_param [symbolic = %T.patt.loc7_14.2 (constants.%T.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %I.ref: %I.type.1 = name_ref I, file.%I.decl [template = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc7_14.1 [symbolic = %T.loc7_14.2 (constants.%T)] -// CHECK:STDOUT: %I.type.loc7_32.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc7_32.2 (constants.%I.type.2)] -// CHECK:STDOUT: %T.param: type = value_param runtime_param -// CHECK:STDOUT: %T.loc7_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc7_14.2 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: impl_decl @impl.2 [template] { // CHECK:STDOUT: %T.patt.loc8_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_14.2 (constants.%T.patt)] // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc8_14.1, runtime_param [symbolic = %T.patt.loc8_14.2 (constants.%T.patt)] // CHECK:STDOUT: } { +// CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %I.ref.loc8: %I.type.1 = name_ref I, file.%I.decl [template = constants.%I.generic] +// CHECK:STDOUT: %T.ref.loc8: type = name_ref T, %T.loc8_14.1 [symbolic = %T.loc8_14.2 (constants.%T)] +// CHECK:STDOUT: %I.type.loc8_32.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc8_32.2 (constants.%I.type.2)] +// CHECK:STDOUT: %T.param.loc8: type = value_param runtime_param +// CHECK:STDOUT: %T.loc8_14.1: type = bind_symbolic_name T, 0, %T.param.loc8 [symbolic = %T.loc8_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.1 [template] { +// CHECK:STDOUT: %T.patt.loc8_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc8_14.1, runtime_param [symbolic = %T.patt.loc8_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %C.ref.loc9: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %I.ref.loc9: %I.type.1 = name_ref I, file.%I.decl [template = constants.%I.generic] +// CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T.loc9 [symbolic = constants.%T] +// CHECK:STDOUT: %I.type.loc9: type = facet_type <@I, @I(constants.%T)> [symbolic = constants.%I.type.2] +// CHECK:STDOUT: %T.param.loc9: type = value_param runtime_param +// CHECK:STDOUT: %T.loc9: type = bind_symbolic_name T, 0, %T.param.loc9 [symbolic = constants.%T] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.2 [template] { +// CHECK:STDOUT: %T.patt.loc12_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc12_14.1, runtime_param [symbolic = %T.patt.loc12_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %I.ref: %I.type.1 = name_ref I, file.%I.decl [template = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc8_14.1 [symbolic = %T.loc8_14.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc8_32.1: type = ptr_type %T [symbolic = %ptr.loc8_32.2 (constants.%ptr)] -// CHECK:STDOUT: %I.type.loc8_33.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc8_33.2 (constants.%I.type.3)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc12_14.1 [symbolic = %T.loc12_14.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc12_32.1: type = ptr_type %T [symbolic = %ptr.loc12_32.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc12_33.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc12_33.2 (constants.%I.type.3)] // CHECK:STDOUT: %T.param: type = value_param runtime_param -// CHECK:STDOUT: %T.loc8_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_14.2 (constants.%T)] +// CHECK:STDOUT: %T.loc12_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc12_14.2 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -110,24 +179,30 @@ impl forall [T:! type] C as I(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl.1(%T.loc7_14.1: type) { -// CHECK:STDOUT: %T.loc7_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc7_14.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc7_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_14.2 (constants.%T.patt)] -// CHECK:STDOUT: %I.type.loc7_32.2: type = facet_type <@I, @I(%T.loc7_14.2)> [symbolic = %I.type.loc7_32.2 (constants.%I.type.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %I.type.loc7_32.1; -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl.2(%T.loc8_14.1: type) { +// CHECK:STDOUT: generic impl @impl.1(%T.loc8_14.1: type) { // CHECK:STDOUT: %T.loc8_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_14.2 (constants.%T)] // CHECK:STDOUT: %T.patt.loc8_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_14.2 (constants.%T.patt)] -// CHECK:STDOUT: %ptr.loc8_32.2: type = ptr_type @impl.2.%T.loc8_14.2 (%T) [symbolic = %ptr.loc8_32.2 (constants.%ptr)] -// CHECK:STDOUT: %I.type.loc8_33.2: type = facet_type <@I, @I(%ptr.loc8_32.2)> [symbolic = %I.type.loc8_33.2 (constants.%I.type.3)] +// CHECK:STDOUT: %I.type.loc8_32.2: type = facet_type <@I, @I(%T.loc8_14.2)> [symbolic = %I.type.loc8_32.2 (constants.%I.type.2)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.2.%I.type.loc8_33.2 (%I.type.3) [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %I.type.loc8_33.1 { +// CHECK:STDOUT: impl: %C.ref.loc8 as %I.type.loc8_32.1 { +// CHECK:STDOUT: %interface: = interface_witness () [template = constants.%interface] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = %interface +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.2(%T.loc12_14.1: type) { +// CHECK:STDOUT: %T.loc12_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc12_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc12_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %ptr.loc12_32.2: type = ptr_type @impl.2.%T.loc12_14.2 (%T) [symbolic = %ptr.loc12_32.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc12_33.2: type = facet_type <@I, @I(%ptr.loc12_32.2)> [symbolic = %I.type.loc12_33.2 (constants.%I.type.3)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %C.ref as %I.type.loc12_33.1 { // CHECK:STDOUT: %interface: = interface_witness () [template = constants.%interface] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -146,16 +221,20 @@ impl forall [T:! type] C as I(T*) {} // CHECK:STDOUT: specific @I(constants.%T) { // CHECK:STDOUT: %T.loc5_13.2 => constants.%T // CHECK:STDOUT: %T.patt.loc5_13.2 => constants.%T +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %I.type => constants.%I.type.2 +// CHECK:STDOUT: %Self.2 => constants.%Self // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(%T.loc5_13.2) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @I(@impl.1.%T.loc7_14.2) {} +// CHECK:STDOUT: specific @I(@impl.1.%T.loc8_14.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @impl.1(constants.%T) { -// CHECK:STDOUT: %T.loc7_14.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc7_14.2 => constants.%T -// CHECK:STDOUT: %I.type.loc7_32.2 => constants.%I.type.2 +// CHECK:STDOUT: %T.loc8_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc8_14.2 => constants.%T +// CHECK:STDOUT: %I.type.loc8_32.2 => constants.%I.type.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%ptr) { @@ -167,16 +246,16 @@ impl forall [T:! type] C as I(T*) {} // CHECK:STDOUT: %Self.2 => constants.%Self // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I(@impl.2.%ptr.loc8_32.2) {} +// CHECK:STDOUT: specific @I(@impl.2.%ptr.loc12_32.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @impl.2(constants.%T) { -// CHECK:STDOUT: %T.loc8_14.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc8_14.2 => constants.%T -// CHECK:STDOUT: %ptr.loc8_32.2 => constants.%ptr -// CHECK:STDOUT: %I.type.loc8_33.2 => constants.%I.type.3 +// CHECK:STDOUT: %T.loc12_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc12_14.2 => constants.%T +// CHECK:STDOUT: %ptr.loc12_32.2 => constants.%ptr +// CHECK:STDOUT: %I.type.loc12_33.2 => constants.%I.type.3 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- import_generic.impl.carbon +// CHECK:STDOUT: --- fail_import_generic.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] @@ -190,8 +269,6 @@ impl forall [T:! type] C as I(T*) {} // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic] // CHECK:STDOUT: %I.type.3: type = facet_type <@I, @I(%ptr)> [symbolic] -// CHECK:STDOUT: %require_complete.1: = require_complete_type %I.type.3 [symbolic] -// CHECK:STDOUT: %require_complete.2: = require_complete_type %I.type.2 [symbolic] // CHECK:STDOUT: %interface: = interface_witness () [template] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -201,11 +278,12 @@ impl forall [T:! type] C as I(T*) {} // CHECK:STDOUT: %import_ref.3 = import_ref Main//import_generic, inst31 [no loc], unloaded // CHECK:STDOUT: %import_ref.4: = import_ref Main//import_generic, loc4_10, loaded [template = constants.%complete_type] // CHECK:STDOUT: %import_ref.5 = import_ref Main//import_generic, inst14 [no loc], unloaded -// CHECK:STDOUT: %import_ref.6: type = import_ref Main//import_generic, loc7_24, loaded [template = constants.%C] -// CHECK:STDOUT: %import_ref.7: type = import_ref Main//import_generic, loc7_32, loaded [symbolic = @impl.1.%I.type.1 (constants.%I.type.2)] -// CHECK:STDOUT: %import_ref.8: type = import_ref Main//import_generic, loc8_24, loaded [template = constants.%C] -// CHECK:STDOUT: %import_ref.9: type = import_ref Main//import_generic, loc8_33, loaded [symbolic = @impl.2.%I.type (constants.%I.type.3)] -// CHECK:STDOUT: %import_ref.10 = import_ref Main//import_generic, loc8_35, unloaded +// CHECK:STDOUT: %import_ref.6: type = import_ref Main//import_generic, loc8_24, loaded [template = constants.%C] +// CHECK:STDOUT: %import_ref.7: type = import_ref Main//import_generic, loc8_32, loaded [symbolic = @impl.1.%I.type (constants.%I.type.2)] +// CHECK:STDOUT: %import_ref.8 = import_ref Main//import_generic, loc9_34, unloaded +// CHECK:STDOUT: %import_ref.9: type = import_ref Main//import_generic, loc12_24, loaded [template = constants.%C] +// CHECK:STDOUT: %import_ref.10: type = import_ref Main//import_generic, loc12_33, loaded [symbolic = @impl.2.%I.type (constants.%I.type.3)] +// CHECK:STDOUT: %import_ref.11 = import_ref Main//import_generic, loc12_35, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -215,13 +293,51 @@ impl forall [T:! type] C as I(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import.loc2_6.1 = import // CHECK:STDOUT: %default.import.loc2_6.2 = import -// CHECK:STDOUT: impl_decl @impl.1 [template] {} { +// CHECK:STDOUT: impl_decl @impl.3 [template] { +// CHECK:STDOUT: %T.patt.loc8_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc8_14.1, runtime_param [symbolic = %T.patt.loc8_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C] // CHECK:STDOUT: %I.ref: %I.type.1 = name_ref I, imports.%import_ref.2 [template = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4 [symbolic = constants.%T] -// CHECK:STDOUT: %I.type.loc4: type = facet_type <@I, @I(constants.%T)> [symbolic = constants.%I.type.2] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc8_14.1 [symbolic = %T.loc8_14.2 (constants.%T)] +// CHECK:STDOUT: %I.type.loc8_32.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc8_32.2 (constants.%I.type.2)] // CHECK:STDOUT: %T.param: type = value_param runtime_param -// CHECK:STDOUT: %T.loc4: type = bind_symbolic_name T, 0, %T.param [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc8_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.4 [template] { +// CHECK:STDOUT: %T.patt.loc14_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc14_14.1, runtime_param [symbolic = %T.patt.loc14_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C] +// CHECK:STDOUT: %I.ref: %I.type.1 = name_ref I, imports.%import_ref.2 [template = constants.%I.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_14.1 [symbolic = %T.loc14_14.2 (constants.%T)] +// CHECK:STDOUT: %I.type.loc14_32.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc14_32.2 (constants.%I.type.2)] +// CHECK:STDOUT: %T.param: type = value_param runtime_param +// CHECK:STDOUT: %T.loc14_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc14_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.5 [template] { +// CHECK:STDOUT: %T.patt.loc20_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc20_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc20_14.1, runtime_param [symbolic = %T.patt.loc20_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C] +// CHECK:STDOUT: %I.ref: %I.type.1 = name_ref I, imports.%import_ref.2 [template = constants.%I.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc20_14.1 [symbolic = %T.loc20_14.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc20_32.1: type = ptr_type %T [symbolic = %ptr.loc20_32.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc20_33.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc20_33.2 (constants.%I.type.3)] +// CHECK:STDOUT: %T.param: type = value_param runtime_param +// CHECK:STDOUT: %T.loc20_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc20_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.6 [template] { +// CHECK:STDOUT: %T.patt.loc26_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc26_14.1, runtime_param [symbolic = %T.patt.loc26_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C] +// CHECK:STDOUT: %I.ref: %I.type.1 = name_ref I, imports.%import_ref.2 [template = constants.%I.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc26_14.1 [symbolic = %T.loc26_14.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc26_32.1: type = ptr_type %T [symbolic = %ptr.loc26_32.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc26_33.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc26_33.2 (constants.%I.type.3)] +// CHECK:STDOUT: %T.param: type = value_param runtime_param +// CHECK:STDOUT: %T.loc26_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc26_14.2 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -241,18 +357,15 @@ impl forall [T:! type] C as I(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic impl @impl.1(constants.%T: type) [from "import_generic.carbon"] { -// CHECK:STDOUT: %T.1: type = bind_symbolic_name T, 0 [symbolic = %T.1 (constants.%T)] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] -// CHECK:STDOUT: %I.type.1: type = facet_type <@I, @I(%T.1)> [symbolic = %I.type.1 (constants.%I.type.2)] +// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.2)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.1.%I.type.1 (%I.type.2) [symbolic = %require_complete (constants.%require_complete.2)] // CHECK:STDOUT: // CHECK:STDOUT: impl: imports.%import_ref.6 as imports.%import_ref.7 { -// CHECK:STDOUT: %interface: = interface_witness () [template = constants.%interface] -// CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = %interface +// CHECK:STDOUT: witness = imports.%import_ref.8 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -263,11 +376,58 @@ impl forall [T:! type] C as I(T*) {} // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%ptr)> [symbolic = %I.type (constants.%I.type.3)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type @impl.2.%I.type (%I.type.3) [symbolic = %require_complete (constants.%require_complete.1)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: imports.%import_ref.8 as imports.%import_ref.9 { +// CHECK:STDOUT: impl: imports.%import_ref.9 as imports.%import_ref.10 { // CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = imports.%import_ref.10 +// CHECK:STDOUT: witness = imports.%import_ref.11 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.3(%T.loc8_14.1: type) { +// CHECK:STDOUT: %T.loc8_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc8_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %I.type.loc8_32.2: type = facet_type <@I, @I(%T.loc8_14.2)> [symbolic = %I.type.loc8_32.2 (constants.%I.type.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %C.ref as %I.type.loc8_32.1; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.4(%T.loc14_14.1: type) { +// CHECK:STDOUT: %T.loc14_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc14_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %I.type.loc14_32.2: type = facet_type <@I, @I(%T.loc14_14.2)> [symbolic = %I.type.loc14_32.2 (constants.%I.type.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %C.ref as %I.type.loc14_32.1 { +// CHECK:STDOUT: %interface: = interface_witness () [template = constants.%interface] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = %interface +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(%T.loc20_14.1: type) { +// CHECK:STDOUT: %T.loc20_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc20_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc20_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc20_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %ptr.loc20_32.2: type = ptr_type @impl.5.%T.loc20_14.2 (%T) [symbolic = %ptr.loc20_32.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc20_33.2: type = facet_type <@I, @I(%ptr.loc20_32.2)> [symbolic = %I.type.loc20_33.2 (constants.%I.type.3)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %C.ref as %I.type.loc20_33.1; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(%T.loc26_14.1: type) { +// CHECK:STDOUT: %T.loc26_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc26_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc26_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %ptr.loc26_32.2: type = ptr_type @impl.6.%T.loc26_14.2 (%T) [symbolic = %ptr.loc26_32.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc26_33.2: type = facet_type <@I, @I(%ptr.loc26_32.2)> [symbolic = %I.type.loc26_33.2 (constants.%I.type.3)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %C.ref as %I.type.loc26_33.1 { +// CHECK:STDOUT: %interface: = interface_witness () [template = constants.%interface] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = %interface // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -288,125 +448,6 @@ impl forall [T:! type] C as I(T*) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @I(%T) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @I(@impl.1.%T.1) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl.1(constants.%T) { -// CHECK:STDOUT: %T.1 => constants.%T -// CHECK:STDOUT: %T.patt => constants.%T -// CHECK:STDOUT: %I.type.1 => constants.%I.type.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @I(constants.%ptr) { -// CHECK:STDOUT: %T => constants.%ptr -// CHECK:STDOUT: %T.patt => constants.%ptr -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @I(@impl.2.%ptr) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @impl.2(constants.%T) { -// CHECK:STDOUT: %T => constants.%T -// CHECK:STDOUT: %T.patt => constants.%T -// CHECK:STDOUT: %ptr => constants.%ptr -// CHECK:STDOUT: %I.type => constants.%I.type.3 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_import_generic.impl.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %I.type.1: type = generic_interface_type @I [template] -// CHECK:STDOUT: %I.generic: %I.type.1 = struct_value () [template] -// CHECK:STDOUT: %I.type.2: type = facet_type <@I, @I(%T)> [symbolic] -// CHECK:STDOUT: %Self: %I.type.2 = bind_symbolic_name Self, 1 [symbolic] -// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %C: type = class_type @C [template] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] -// CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic] -// CHECK:STDOUT: %I.type.3: type = facet_type <@I, @I(%ptr)> [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1: type = import_ref Main//import_generic, C, loaded [template = constants.%C] -// CHECK:STDOUT: %import_ref.2: %I.type.1 = import_ref Main//import_generic, I, loaded [template = constants.%I.generic] -// CHECK:STDOUT: %import_ref.3 = import_ref Main//import_generic, inst31 [no loc], unloaded -// CHECK:STDOUT: %import_ref.4: = import_ref Main//import_generic, loc4_10, loaded [template = constants.%complete_type] -// CHECK:STDOUT: %import_ref.5 = import_ref Main//import_generic, inst14 [no loc], unloaded -// CHECK:STDOUT: %import_ref.6: type = import_ref Main//import_generic, loc7_24, loaded [template = constants.%C] -// CHECK:STDOUT: %import_ref.7: type = import_ref Main//import_generic, loc7_32, loaded [symbolic = @impl.1.%I.type (constants.%I.type.2)] -// CHECK:STDOUT: %import_ref.8: type = import_ref Main//import_generic, loc8_24, loaded [template = constants.%C] -// CHECK:STDOUT: %import_ref.9: type = import_ref Main//import_generic, loc8_33, loaded [symbolic = @impl.2.%I.type.1 (constants.%I.type.3)] -// CHECK:STDOUT: %import_ref.10 = import_ref Main//import_generic, loc8_35, unloaded -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .C = imports.%import_ref.1 -// CHECK:STDOUT: .I = imports.%import_ref.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: %default.import.loc2_6.1 = import -// CHECK:STDOUT: %default.import.loc2_6.2 = import -// CHECK:STDOUT: impl_decl @impl.2 [template] {} { -// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C] -// CHECK:STDOUT: %I.ref: %I.type.1 = name_ref I, imports.%import_ref.2 [template = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11 [symbolic = constants.%T] -// CHECK:STDOUT: %ptr.loc11: type = ptr_type %T [symbolic = constants.%ptr] -// CHECK:STDOUT: %I.type.loc11: type = facet_type <@I, @I(constants.%ptr)> [symbolic = constants.%I.type.3] -// CHECK:STDOUT: %T.param: type = value_param runtime_param -// CHECK:STDOUT: %T.loc11: type = bind_symbolic_name T, 0, %T.param [symbolic = constants.%T] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @I(constants.%T: type) [from "import_generic.carbon"] { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.2)] -// CHECK:STDOUT: %Self: %I.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.3 -// CHECK:STDOUT: witness = () -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl.1(constants.%T: type) [from "import_generic.carbon"] { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] -// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.2)] -// CHECK:STDOUT: -// CHECK:STDOUT: impl: imports.%import_ref.6 as imports.%import_ref.7; -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @impl.2(constants.%T: type) [from "import_generic.carbon"] { -// CHECK:STDOUT: %T.1: type = bind_symbolic_name T, 0 [symbolic = %T.1 (constants.%T)] -// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] -// CHECK:STDOUT: %ptr.1: type = ptr_type @impl.2.%T.1 (%T) [symbolic = %ptr.1 (constants.%ptr)] -// CHECK:STDOUT: %I.type.1: type = facet_type <@I, @I(%ptr.1)> [symbolic = %I.type.1 (constants.%I.type.3)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: impl: imports.%import_ref.8 as imports.%import_ref.9 { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = imports.%import_ref.10 -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @C [from "import_generic.carbon"] { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%import_ref.5 -// CHECK:STDOUT: complete_type_witness = imports.%import_ref.4 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @I(constants.%T) { -// CHECK:STDOUT: %T => constants.%T -// CHECK:STDOUT: %T.patt => constants.%T -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @I(%T) {} -// CHECK:STDOUT: // CHECK:STDOUT: specific @I(@impl.1.%T) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @impl.1(constants.%T) { @@ -418,14 +459,426 @@ impl forall [T:! type] C as I(T*) {} // CHECK:STDOUT: specific @I(constants.%ptr) { // CHECK:STDOUT: %T => constants.%ptr // CHECK:STDOUT: %T.patt => constants.%ptr +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %I.type => constants.%I.type.3 +// CHECK:STDOUT: %Self => constants.%Self // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I(@impl.2.%ptr.1) {} +// CHECK:STDOUT: specific @I(@impl.2.%ptr) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @impl.2(constants.%T) { -// CHECK:STDOUT: %T.1 => constants.%T +// CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %T.patt => constants.%T -// CHECK:STDOUT: %ptr.1 => constants.%ptr -// CHECK:STDOUT: %I.type.1 => constants.%I.type.3 +// CHECK:STDOUT: %ptr => constants.%ptr +// CHECK:STDOUT: %I.type => constants.%I.type.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @I(@impl.3.%T.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%T) { +// CHECK:STDOUT: %T.loc8_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc8_14.2 => constants.%T +// CHECK:STDOUT: %I.type.loc8_32.2 => constants.%I.type.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @I(@impl.4.%T.loc14_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.4(constants.%T) { +// CHECK:STDOUT: %T.loc14_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc14_14.2 => constants.%T +// CHECK:STDOUT: %I.type.loc14_32.2 => constants.%I.type.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @I(@impl.5.%ptr.loc20_32.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%T) { +// CHECK:STDOUT: %T.loc20_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc20_14.2 => constants.%T +// CHECK:STDOUT: %ptr.loc20_32.2 => constants.%ptr +// CHECK:STDOUT: %I.type.loc20_33.2 => constants.%I.type.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @I(@impl.6.%ptr.loc26_32.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%T) { +// CHECK:STDOUT: %T.loc26_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc26_14.2 => constants.%T +// CHECK:STDOUT: %ptr.loc26_32.2 => constants.%ptr +// CHECK:STDOUT: %I.type.loc26_33.2 => constants.%I.type.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_import_generic_decl.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %D: type = class_type @D [template] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %J.type.1: type = generic_interface_type @J [template] +// CHECK:STDOUT: %J.generic: %J.type.1 = struct_value () [template] +// CHECK:STDOUT: %J.type.2: type = facet_type <@J, @J(%T)> [symbolic] +// CHECK:STDOUT: %Self: %J.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic] +// CHECK:STDOUT: %J.type.3: type = facet_type <@J, @J(%ptr)> [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .D = %D.decl +// CHECK:STDOUT: .J = %J.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {} +// CHECK:STDOUT: %J.decl: %J.type.1 = interface_decl @J [template = constants.%J.generic] { +// CHECK:STDOUT: %T.patt.loc5_13.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc5_13.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc5_13.1, runtime_param [symbolic = %T.patt.loc5_13.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.param: type = value_param runtime_param +// CHECK:STDOUT: %T.loc5_13.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc5_13.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.1 [template] { +// CHECK:STDOUT: %T.patt.loc11_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc11_14.1, runtime_param [symbolic = %T.patt.loc11_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] +// CHECK:STDOUT: %J.ref: %J.type.1 = name_ref J, file.%J.decl [template = constants.%J.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_14.1 [symbolic = %T.loc11_14.2 (constants.%T)] +// CHECK:STDOUT: %J.type.loc11_32.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc11_32.2 (constants.%J.type.2)] +// CHECK:STDOUT: %T.param: type = value_param runtime_param +// CHECK:STDOUT: %T.loc11_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc11_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.2 [template] { +// CHECK:STDOUT: %T.patt.loc17_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc17_14.1, runtime_param [symbolic = %T.patt.loc17_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D] +// CHECK:STDOUT: %J.ref: %J.type.1 = name_ref J, file.%J.decl [template = constants.%J.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc17_14.1 [symbolic = %T.loc17_14.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc17_32.1: type = ptr_type %T [symbolic = %ptr.loc17_32.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc17_33.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc17_33.2 (constants.%J.type.3)] +// CHECK:STDOUT: %T.param: type = value_param runtime_param +// CHECK:STDOUT: %T.loc17_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc17_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @J(%T.loc5_13.1: type) { +// CHECK:STDOUT: %T.loc5_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc5_13.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc5_13.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc5_13.2 (constants.%T.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %J.type: type = facet_type <@J, @J(%T.loc5_13.2)> [symbolic = %J.type (constants.%J.type.2)] +// CHECK:STDOUT: %Self.2: %J.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: %Self.1: @J.%J.type (%J.type.2) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.1(%T.loc11_14.1: type) { +// CHECK:STDOUT: %T.loc11_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc11_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc11_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %J.type.loc11_32.2: type = facet_type <@J, @J(%T.loc11_14.2)> [symbolic = %J.type.loc11_32.2 (constants.%J.type.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %D.ref as %J.type.loc11_32.1; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.2(%T.loc17_14.1: type) { +// CHECK:STDOUT: %T.loc17_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc17_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc17_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %ptr.loc17_32.2: type = ptr_type @impl.2.%T.loc17_14.2 (%T) [symbolic = %ptr.loc17_32.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc17_33.2: type = facet_type <@J, @J(%ptr.loc17_32.2)> [symbolic = %J.type.loc17_33.2 (constants.%J.type.3)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %D.ref as %J.type.loc17_33.1; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @D { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%D +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(constants.%T) { +// CHECK:STDOUT: %T.loc5_13.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc5_13.2 => constants.%T +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %J.type => constants.%J.type.2 +// CHECK:STDOUT: %Self.2 => constants.%Self +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(%T.loc5_13.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(@impl.1.%T.loc11_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.1(constants.%T) { +// CHECK:STDOUT: %T.loc11_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc11_14.2 => constants.%T +// CHECK:STDOUT: %J.type.loc11_32.2 => constants.%J.type.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(constants.%ptr) { +// CHECK:STDOUT: %T.loc5_13.2 => constants.%ptr +// CHECK:STDOUT: %T.patt.loc5_13.2 => constants.%ptr +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %J.type => constants.%J.type.3 +// CHECK:STDOUT: %Self.2 => constants.%Self +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(@impl.2.%ptr.loc17_32.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%T) { +// CHECK:STDOUT: %T.loc17_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc17_14.2 => constants.%T +// CHECK:STDOUT: %ptr.loc17_32.2 => constants.%ptr +// CHECK:STDOUT: %J.type.loc17_33.2 => constants.%J.type.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_import_generic_decl.impl.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %J.type.1: type = generic_interface_type @J [template] +// CHECK:STDOUT: %J.generic: %J.type.1 = struct_value () [template] +// CHECK:STDOUT: %J.type.2: type = facet_type <@J, @J(%T)> [symbolic] +// CHECK:STDOUT: %Self: %J.type.2 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %D: type = class_type @D [template] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %ptr: type = ptr_type %T [symbolic] +// CHECK:STDOUT: %J.type.3: type = facet_type <@J, @J(%ptr)> [symbolic] +// CHECK:STDOUT: %interface: = interface_witness () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %import_ref.1: type = import_ref Main//import_generic_decl, D, loaded [template = constants.%D] +// CHECK:STDOUT: %import_ref.2: %J.type.1 = import_ref Main//import_generic_decl, J, loaded [template = constants.%J.generic] +// CHECK:STDOUT: %import_ref.3 = import_ref Main//import_generic_decl, inst31 [no loc], unloaded +// CHECK:STDOUT: %import_ref.4: = import_ref Main//import_generic_decl, loc4_10, loaded [template = constants.%complete_type] +// CHECK:STDOUT: %import_ref.5 = import_ref Main//import_generic_decl, inst14 [no loc], unloaded +// CHECK:STDOUT: %import_ref.6: type = import_ref Main//import_generic_decl, loc11_24, loaded [template = constants.%D] +// CHECK:STDOUT: %import_ref.7: type = import_ref Main//import_generic_decl, loc11_32, loaded [symbolic = @impl.1.%J.type (constants.%J.type.2)] +// CHECK:STDOUT: %import_ref.8: type = import_ref Main//import_generic_decl, loc17_24, loaded [template = constants.%D] +// CHECK:STDOUT: %import_ref.9: type = import_ref Main//import_generic_decl, loc17_33, loaded [symbolic = @impl.2.%J.type (constants.%J.type.3)] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .D = imports.%import_ref.1 +// CHECK:STDOUT: .J = imports.%import_ref.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: %default.import.loc2_6.1 = import +// CHECK:STDOUT: %default.import.loc2_6.2 = import +// CHECK:STDOUT: impl_decl @impl.3 [template] { +// CHECK:STDOUT: %T.patt.loc8_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc8_14.1, runtime_param [symbolic = %T.patt.loc8_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%import_ref.1 [template = constants.%D] +// CHECK:STDOUT: %J.ref: %J.type.1 = name_ref J, imports.%import_ref.2 [template = constants.%J.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc8_14.1 [symbolic = %T.loc8_14.2 (constants.%T)] +// CHECK:STDOUT: %J.type.loc8_32.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc8_32.2 (constants.%J.type.2)] +// CHECK:STDOUT: %T.param: type = value_param runtime_param +// CHECK:STDOUT: %T.loc8_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.4 [template] { +// CHECK:STDOUT: %T.patt.loc14_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc14_14.1, runtime_param [symbolic = %T.patt.loc14_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%import_ref.1 [template = constants.%D] +// CHECK:STDOUT: %J.ref: %J.type.1 = name_ref J, imports.%import_ref.2 [template = constants.%J.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_14.1 [symbolic = %T.loc14_14.2 (constants.%T)] +// CHECK:STDOUT: %J.type.loc14_32.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc14_32.2 (constants.%J.type.2)] +// CHECK:STDOUT: %T.param: type = value_param runtime_param +// CHECK:STDOUT: %T.loc14_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc14_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.5 [template] { +// CHECK:STDOUT: %T.patt.loc20_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc20_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc20_14.1, runtime_param [symbolic = %T.patt.loc20_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%import_ref.1 [template = constants.%D] +// CHECK:STDOUT: %J.ref: %J.type.1 = name_ref J, imports.%import_ref.2 [template = constants.%J.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc20_14.1 [symbolic = %T.loc20_14.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc20_32.1: type = ptr_type %T [symbolic = %ptr.loc20_32.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc20_33.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc20_33.2 (constants.%J.type.3)] +// CHECK:STDOUT: %T.param: type = value_param runtime_param +// CHECK:STDOUT: %T.loc20_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc20_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: impl_decl @impl.6 [template] { +// CHECK:STDOUT: %T.patt.loc25_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc25_14.1, runtime_param [symbolic = %T.patt.loc25_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%import_ref.1 [template = constants.%D] +// CHECK:STDOUT: %J.ref: %J.type.1 = name_ref J, imports.%import_ref.2 [template = constants.%J.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc25_14.1 [symbolic = %T.loc25_14.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc25_32.1: type = ptr_type %T [symbolic = %ptr.loc25_32.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc25_33.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc25_33.2 (constants.%J.type.3)] +// CHECK:STDOUT: %T.param: type = value_param runtime_param +// CHECK:STDOUT: %T.loc25_14.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc25_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @J(constants.%T: type) [from "fail_import_generic_decl.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %J.type: type = facet_type <@J, @J(%T)> [symbolic = %J.type (constants.%J.type.2)] +// CHECK:STDOUT: %Self: %J.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.3 +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.1(constants.%T: type) [from "fail_import_generic_decl.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] +// CHECK:STDOUT: %J.type: type = facet_type <@J, @J(%T)> [symbolic = %J.type (constants.%J.type.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.6 as imports.%import_ref.7; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.2(constants.%T: type) [from "fail_import_generic_decl.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] +// CHECK:STDOUT: %ptr: type = ptr_type @impl.2.%T (%T) [symbolic = %ptr (constants.%ptr)] +// CHECK:STDOUT: %J.type: type = facet_type <@J, @J(%ptr)> [symbolic = %J.type (constants.%J.type.3)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%import_ref.8 as imports.%import_ref.9; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.3(%T.loc8_14.1: type) { +// CHECK:STDOUT: %T.loc8_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc8_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %J.type.loc8_32.2: type = facet_type <@J, @J(%T.loc8_14.2)> [symbolic = %J.type.loc8_32.2 (constants.%J.type.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %D.ref as %J.type.loc8_32.1; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.4(%T.loc14_14.1: type) { +// CHECK:STDOUT: %T.loc14_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc14_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %J.type.loc14_32.2: type = facet_type <@J, @J(%T.loc14_14.2)> [symbolic = %J.type.loc14_32.2 (constants.%J.type.2)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %D.ref as %J.type.loc14_32.1 { +// CHECK:STDOUT: %interface: = interface_witness () [template = constants.%interface] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = %interface +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.5(%T.loc20_14.1: type) { +// CHECK:STDOUT: %T.loc20_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc20_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc20_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc20_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %ptr.loc20_32.2: type = ptr_type @impl.5.%T.loc20_14.2 (%T) [symbolic = %ptr.loc20_32.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc20_33.2: type = facet_type <@J, @J(%ptr.loc20_32.2)> [symbolic = %J.type.loc20_33.2 (constants.%J.type.3)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %D.ref as %J.type.loc20_33.1; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.6(%T.loc25_14.1: type) { +// CHECK:STDOUT: %T.loc25_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc25_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc25_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %ptr.loc25_32.2: type = ptr_type @impl.6.%T.loc25_14.2 (%T) [symbolic = %ptr.loc25_32.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc25_33.2: type = facet_type <@J, @J(%ptr.loc25_32.2)> [symbolic = %J.type.loc25_33.2 (constants.%J.type.3)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %D.ref as %J.type.loc25_33.1 { +// CHECK:STDOUT: %interface: = interface_witness () [template = constants.%interface] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = %interface +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @D [from "fail_import_generic_decl.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.5 +// CHECK:STDOUT: complete_type_witness = imports.%import_ref.4 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %T.patt => constants.%T +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %J.type => constants.%J.type.2 +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(@impl.1.%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.1(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %T.patt => constants.%T +// CHECK:STDOUT: %J.type => constants.%J.type.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(constants.%ptr) { +// CHECK:STDOUT: %T => constants.%ptr +// CHECK:STDOUT: %T.patt => constants.%ptr +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %J.type => constants.%J.type.3 +// CHECK:STDOUT: %Self => constants.%Self +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(@impl.2.%ptr) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.2(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %T.patt => constants.%T +// CHECK:STDOUT: %ptr => constants.%ptr +// CHECK:STDOUT: %J.type => constants.%J.type.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(@impl.3.%T.loc8_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.3(constants.%T) { +// CHECK:STDOUT: %T.loc8_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc8_14.2 => constants.%T +// CHECK:STDOUT: %J.type.loc8_32.2 => constants.%J.type.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(@impl.4.%T.loc14_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.4(constants.%T) { +// CHECK:STDOUT: %T.loc14_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc14_14.2 => constants.%T +// CHECK:STDOUT: %J.type.loc14_32.2 => constants.%J.type.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(@impl.5.%ptr.loc20_32.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.5(constants.%T) { +// CHECK:STDOUT: %T.loc20_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc20_14.2 => constants.%T +// CHECK:STDOUT: %ptr.loc20_32.2 => constants.%ptr +// CHECK:STDOUT: %J.type.loc20_33.2 => constants.%J.type.3 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @J(@impl.6.%ptr.loc25_32.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.6(constants.%T) { +// CHECK:STDOUT: %T.loc25_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc25_14.2 => constants.%T +// CHECK:STDOUT: %ptr.loc25_32.2 => constants.%ptr +// CHECK:STDOUT: %J.type.loc25_33.2 => constants.%J.type.3 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/interface_args.carbon b/toolchain/check/testdata/impl/no_prelude/interface_args.carbon index 274b01380d9d..8f22f1f3724c 100644 --- a/toolchain/check/testdata/impl/no_prelude/interface_args.carbon +++ b/toolchain/check/testdata/impl/no_prelude/interface_args.carbon @@ -98,14 +98,14 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %Action.type.3: type = facet_type <@Action, @Action(%B)> [template] -// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.1, @Action(%B) [template] // CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template] -// CHECK:STDOUT: %Op.type.3: type = fn_type @Op.1, @Action(%B) [template] -// CHECK:STDOUT: %Op.3: %Op.type.3 = struct_value () [template] -// CHECK:STDOUT: %Op.assoc_type.2: type = assoc_entity_type %Action.type.3, %Op.type.3 [template] +// CHECK:STDOUT: %Op.assoc_type.2: type = assoc_entity_type %Action.type.3, %Op.type.2 [template] // CHECK:STDOUT: %assoc0.2: %Op.assoc_type.2 = assoc_entity element0, @Action.%Op.decl [template] +// CHECK:STDOUT: %Op.type.3: type = fn_type @Op.2 [template] +// CHECK:STDOUT: %Op.3: %Op.type.3 = struct_value () [template] // CHECK:STDOUT: %Action.facet: %Action.type.2 = facet_value %A, %A [symbolic] -// CHECK:STDOUT: %interface: = interface_witness (%Op.2) [template] +// CHECK:STDOUT: %interface: = interface_witness (%Op.3) [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] // CHECK:STDOUT: } @@ -169,7 +169,7 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %A.ref as %Action.type { -// CHECK:STDOUT: %Op.decl: %Op.type.2 = fn_decl @Op.2 [template = constants.%Op.2] {} {} +// CHECK:STDOUT: %Op.decl: %Op.type.3 = fn_decl @Op.2 [template = constants.%Op.3] {} {} // CHECK:STDOUT: %interface: = interface_witness (%Op.decl) [template = constants.%interface] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -219,7 +219,7 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%B)> [template = constants.%Action.type.3] // CHECK:STDOUT: %.loc16: %Op.assoc_type.2 = specific_constant @Action.%assoc0.loc5_10.1, @Action(constants.%B) [template = constants.%assoc0.2] // CHECK:STDOUT: %Op.ref: %Op.assoc_type.2 = name_ref Op, %.loc16 [template = constants.%assoc0.2] -// CHECK:STDOUT: %impl.elem0: %Op.type.3 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2] +// CHECK:STDOUT: %impl.elem0: %Op.type.2 = interface_witness_access constants.%interface, element0 [template = constants.%Op.3] // CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %impl.elem0() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -240,8 +240,8 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Action.type => constants.%Action.type.3 // CHECK:STDOUT: %Self.2 => constants.%Self -// CHECK:STDOUT: %Op.type => constants.%Op.type.3 -// CHECK:STDOUT: %Op => constants.%Op.3 +// CHECK:STDOUT: %Op.type => constants.%Op.type.2 +// CHECK:STDOUT: %Op => constants.%Op.2 // CHECK:STDOUT: %Op.assoc_type => constants.%Op.assoc_type.2 // CHECK:STDOUT: %assoc0.loc5_10.2 => constants.%assoc0.2 // CHECK:STDOUT: } @@ -589,14 +589,14 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %B: type = class_type @B [template] // CHECK:STDOUT: %Factory.type.3: type = facet_type <@Factory, @Factory(%B)> [template] -// CHECK:STDOUT: %Make.type.2: type = fn_type @Make.2 [template] +// CHECK:STDOUT: %Make.type.2: type = fn_type @Make.1, @Factory(%B) [template] // CHECK:STDOUT: %Make.2: %Make.type.2 = struct_value () [template] -// CHECK:STDOUT: %Make.type.3: type = fn_type @Make.1, @Factory(%B) [template] -// CHECK:STDOUT: %Make.3: %Make.type.3 = struct_value () [template] -// CHECK:STDOUT: %Make.assoc_type.2: type = assoc_entity_type %Factory.type.3, %Make.type.3 [template] +// CHECK:STDOUT: %Make.assoc_type.2: type = assoc_entity_type %Factory.type.3, %Make.type.2 [template] // CHECK:STDOUT: %assoc0.2: %Make.assoc_type.2 = assoc_entity element0, @Factory.%Make.decl [template] +// CHECK:STDOUT: %Make.type.3: type = fn_type @Make.2 [template] +// CHECK:STDOUT: %Make.3: %Make.type.3 = struct_value () [template] // CHECK:STDOUT: %Factory.facet: %Factory.type.2 = facet_value %A, %A [symbolic] -// CHECK:STDOUT: %interface: = interface_witness (%Make.2) [template] +// CHECK:STDOUT: %interface: = interface_witness (%Make.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -654,7 +654,7 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %A.ref as %Factory.type { -// CHECK:STDOUT: %Make.decl: %Make.type.2 = fn_decl @Make.2 [template = constants.%Make.2] { +// CHECK:STDOUT: %Make.decl: %Make.type.3 = fn_decl @Make.2 [template = constants.%Make.3] { // CHECK:STDOUT: %return.patt: %B = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %B = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { @@ -711,8 +711,8 @@ fn MakeC(a: A) -> C { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Factory.type => constants.%Factory.type.3 // CHECK:STDOUT: %Self.2 => constants.%Self -// CHECK:STDOUT: %Make.type => constants.%Make.type.3 -// CHECK:STDOUT: %Make => constants.%Make.3 +// CHECK:STDOUT: %Make.type => constants.%Make.type.2 +// CHECK:STDOUT: %Make => constants.%Make.2 // CHECK:STDOUT: %Make.assoc_type => constants.%Make.assoc_type.2 // CHECK:STDOUT: %assoc0.loc5_17.2 => constants.%assoc0.2 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/no_prelude/no_definition_in_impl_file.carbon b/toolchain/check/testdata/impl/no_prelude/no_definition_in_impl_file.carbon index c5a0859cbfba..40fb61b9b32b 100644 --- a/toolchain/check/testdata/impl/no_prelude/no_definition_in_impl_file.carbon +++ b/toolchain/check/testdata/impl/no_prelude/no_definition_in_impl_file.carbon @@ -8,20 +8,32 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/no_definition_in_impl_file.carbon -// --- decl_in_api_definition_in_impl.carbon +// --- fail_decl_in_api_definition_in_impl.carbon library "[[@TEST_NAME]]"; -interface A {}; +interface A {} +// CHECK:STDERR: fail_decl_in_api_definition_in_impl.carbon:[[@LINE+4]]:1: error: impl declared but not defined [MissingImplDefinition] +// CHECK:STDERR: impl () as A; +// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: impl () as A; -// --- decl_in_api_definition_in_impl.impl.carbon +// --- fail_decl_in_api_definition_in_impl.impl.carbon impl library "[[@TEST_NAME]]"; +// CHECK:STDERR: fail_decl_in_api_definition_in_impl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: impl () as A; +// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: impl () as A; +// CHECK:STDERR: fail_decl_in_api_definition_in_impl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: impl () as A {} +// CHECK:STDERR: ^~~~~~~~~~~~~~ +// CHECK:STDERR: impl () as A {} // --- use_decl_in_api.carbon @@ -34,31 +46,39 @@ impl library "[[@TEST_NAME]]"; import library "decl_in_api_definition_in_impl"; -// --- decl_only_in_api.carbon +// --- fail_decl_only_in_api.carbon library "[[@TEST_NAME]]"; -interface B {}; +interface B {} +// CHECK:STDERR: fail_decl_only_in_api.carbon:[[@LINE+4]]:1: error: impl declared but not defined [MissingImplDefinition] +// CHECK:STDERR: impl () as B; +// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: impl () as B; // --- decl_only_in_api.impl.carbon impl library "[[@TEST_NAME]]"; -// --- decl_in_api_decl_in_impl.carbon +// --- fail_decl_in_api_decl_in_impl.carbon library "[[@TEST_NAME]]"; -interface C {}; +interface C {} +// CHECK:STDERR: fail_decl_in_api_decl_in_impl.carbon:[[@LINE+4]]:1: error: impl declared but not defined [MissingImplDefinition] +// CHECK:STDERR: impl () as C; +// CHECK:STDERR: ^~~~~~~~~~~~~ +// CHECK:STDERR: impl () as C; // --- fail_decl_in_api_decl_in_impl.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+4]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl] +// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+4]]:1: error: redeclaration of imported impl [RedeclImportedImpl] // CHECK:STDERR: impl () as C; // CHECK:STDERR: ^~~~~~~~~~~~~ // CHECK:STDERR: @@ -72,14 +92,14 @@ library "[[@TEST_NAME]]"; impl library "[[@TEST_NAME]]"; -interface D {}; +interface D {} -// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+3]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl] +// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+3]]:1: error: impl declared but not defined [MissingImplDefinition] // CHECK:STDERR: impl () as D; // CHECK:STDERR: ^~~~~~~~~~~~~ impl () as D; -// CHECK:STDOUT: --- decl_in_api_definition_in_impl.carbon +// CHECK:STDOUT: --- fail_decl_in_api_definition_in_impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A.type: type = facet_type <@A> [template] @@ -93,8 +113,8 @@ impl () as D; // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl: type = interface_decl @A [template = constants.%A.type] {} {} // CHECK:STDOUT: impl_decl @impl [template] {} { -// CHECK:STDOUT: %.loc6_7.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A.type] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -107,9 +127,9 @@ impl () as D; // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %.loc6_7.2 as %A.ref; +// CHECK:STDOUT: impl @impl: %.loc10_7.2 as %A.ref; // CHECK:STDOUT: -// CHECK:STDOUT: --- decl_in_api_definition_in_impl.impl.carbon +// CHECK:STDOUT: --- fail_decl_in_api_definition_in_impl.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A.type: type = facet_type <@A> [template] @@ -120,8 +140,8 @@ impl () as D; // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: type = import_ref Main//decl_in_api_definition_in_impl, A, loaded [template = constants.%A.type] // CHECK:STDOUT: %import_ref.2 = import_ref Main//decl_in_api_definition_in_impl, inst15 [no loc], unloaded -// CHECK:STDOUT: %import_ref.3: type = import_ref Main//decl_in_api_definition_in_impl, loc6_7, loaded [template = constants.%empty_tuple.type] -// CHECK:STDOUT: %import_ref.4: type = import_ref Main//decl_in_api_definition_in_impl, loc6_12, loaded [template = constants.%A.type] +// CHECK:STDOUT: %import_ref.3: type = import_ref Main//decl_in_api_definition_in_impl, loc10_7, loaded [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %import_ref.4: type = import_ref Main//decl_in_api_definition_in_impl, loc10_12, loaded [template = constants.%A.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -130,25 +150,29 @@ impl () as D; // CHECK:STDOUT: } // CHECK:STDOUT: %default.import.loc2_6.1 = import // CHECK:STDOUT: %default.import.loc2_6.2 = import -// CHECK:STDOUT: impl_decl @impl [template] {} { -// CHECK:STDOUT: %.loc4_7.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc4_7.2: type = converted %.loc4_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] -// CHECK:STDOUT: %A.ref.loc4: type = name_ref A, imports.%import_ref.1 [template = constants.%A.type] +// CHECK:STDOUT: impl_decl @impl.2 [template] {} { +// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %A.ref: type = name_ref A, imports.%import_ref.1 [template = constants.%A.type] // CHECK:STDOUT: } -// CHECK:STDOUT: impl_decl @impl [template] {} { -// CHECK:STDOUT: %.loc6_7.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] -// CHECK:STDOUT: %A.ref.loc6: type = name_ref A, imports.%import_ref.1 [template = constants.%A.type] +// CHECK:STDOUT: impl_decl @impl.3 [template] {} { +// CHECK:STDOUT: %.loc14_7.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc14_7.2: type = converted %.loc14_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %A.ref: type = name_ref A, imports.%import_ref.1 [template = constants.%A.type] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @A [from "decl_in_api_definition_in_impl.carbon"] { +// CHECK:STDOUT: interface @A [from "fail_decl_in_api_definition_in_impl.carbon"] { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%import_ref.2 // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: imports.%import_ref.3 as imports.%import_ref.4 [from "decl_in_api_definition_in_impl.carbon"] { +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.3 as imports.%import_ref.4 [from "fail_decl_in_api_definition_in_impl.carbon"]; +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.2: %.loc8_7.2 as %A.ref; +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.3: %.loc14_7.2 as %A.ref { // CHECK:STDOUT: %interface: = interface_witness () [template = constants.%interface] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -175,7 +199,7 @@ impl () as D; // CHECK:STDOUT: %default.import.loc2_6.2 = import // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- decl_only_in_api.carbon +// CHECK:STDOUT: --- fail_decl_only_in_api.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %B.type: type = facet_type <@B> [template] @@ -189,8 +213,8 @@ impl () as D; // CHECK:STDOUT: } // CHECK:STDOUT: %B.decl: type = interface_decl @B [template = constants.%B.type] {} {} // CHECK:STDOUT: impl_decl @impl [template] {} { -// CHECK:STDOUT: %.loc6_7.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B.type] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -203,7 +227,7 @@ impl () as D; // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %.loc6_7.2 as %B.ref; +// CHECK:STDOUT: impl @impl: %.loc10_7.2 as %B.ref; // CHECK:STDOUT: // CHECK:STDOUT: --- decl_only_in_api.impl.carbon // CHECK:STDOUT: @@ -215,8 +239,8 @@ impl () as D; // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1 = import_ref Main//decl_only_in_api, B, unloaded // CHECK:STDOUT: %import_ref.2 = import_ref Main//decl_only_in_api, inst15 [no loc], unloaded -// CHECK:STDOUT: %import_ref.3: type = import_ref Main//decl_only_in_api, loc6_7, loaded [template = constants.%empty_tuple.type] -// CHECK:STDOUT: %import_ref.4: type = import_ref Main//decl_only_in_api, loc6_12, loaded [template = constants.%B.type] +// CHECK:STDOUT: %import_ref.3: type = import_ref Main//decl_only_in_api, loc10_7, loaded [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %import_ref.4: type = import_ref Main//decl_only_in_api, loc10_12, loaded [template = constants.%B.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -227,15 +251,15 @@ impl () as D; // CHECK:STDOUT: %default.import.loc2_6.2 = import // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @B [from "decl_only_in_api.carbon"] { +// CHECK:STDOUT: interface @B [from "fail_decl_only_in_api.carbon"] { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%import_ref.2 // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: imports.%import_ref.3 as imports.%import_ref.4 [from "decl_only_in_api.carbon"]; +// CHECK:STDOUT: impl @impl: imports.%import_ref.3 as imports.%import_ref.4 [from "fail_decl_only_in_api.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: --- decl_in_api_decl_in_impl.carbon +// CHECK:STDOUT: --- fail_decl_in_api_decl_in_impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %C.type: type = facet_type <@C> [template] @@ -249,8 +273,8 @@ impl () as D; // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = interface_decl @C [template = constants.%C.type] {} {} // CHECK:STDOUT: impl_decl @impl [template] {} { -// CHECK:STDOUT: %.loc6_7.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C.type] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -263,7 +287,7 @@ impl () as D; // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %.loc6_7.2 as %C.ref; +// CHECK:STDOUT: impl @impl: %.loc10_7.2 as %C.ref; // CHECK:STDOUT: // CHECK:STDOUT: --- fail_decl_in_api_decl_in_impl.impl.carbon // CHECK:STDOUT: @@ -275,8 +299,8 @@ impl () as D; // CHECK:STDOUT: imports { // CHECK:STDOUT: %import_ref.1: type = import_ref Main//decl_in_api_decl_in_impl, C, loaded [template = constants.%C.type] // CHECK:STDOUT: %import_ref.2 = import_ref Main//decl_in_api_decl_in_impl, inst15 [no loc], unloaded -// CHECK:STDOUT: %import_ref.3: type = import_ref Main//decl_in_api_decl_in_impl, loc6_7, loaded [template = constants.%empty_tuple.type] -// CHECK:STDOUT: %import_ref.4: type = import_ref Main//decl_in_api_decl_in_impl, loc6_12, loaded [template = constants.%C.type] +// CHECK:STDOUT: %import_ref.3: type = import_ref Main//decl_in_api_decl_in_impl, loc10_7, loaded [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %import_ref.4: type = import_ref Main//decl_in_api_decl_in_impl, loc10_12, loaded [template = constants.%C.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -285,20 +309,22 @@ impl () as D; // CHECK:STDOUT: } // CHECK:STDOUT: %default.import.loc2_6.1 = import // CHECK:STDOUT: %default.import.loc2_6.2 = import -// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: impl_decl @impl.2 [template] {} { // CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () // CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C.type] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @C [from "decl_in_api_decl_in_impl.carbon"] { +// CHECK:STDOUT: interface @C [from "fail_decl_in_api_decl_in_impl.carbon"] { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%import_ref.2 // CHECK:STDOUT: witness = () // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: imports.%import_ref.3 as imports.%import_ref.4 [from "decl_in_api_decl_in_impl.carbon"]; +// CHECK:STDOUT: impl @impl.1: imports.%import_ref.3 as imports.%import_ref.4 [from "fail_decl_in_api_decl_in_impl.carbon"]; +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.2: %.loc8_7.2 as %C.ref; // CHECK:STDOUT: // CHECK:STDOUT: --- decl_only_in_impl.carbon // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/generic.carbon b/toolchain/check/testdata/interface/no_prelude/generic.carbon index b4661488e7f8..13ad6649601e 100644 --- a/toolchain/check/testdata/interface/no_prelude/generic.carbon +++ b/toolchain/check/testdata/interface/no_prelude/generic.carbon @@ -83,14 +83,14 @@ fn G(T:! Generic(B)) { // CHECK:STDOUT: %Simple.type.3: type = facet_type <@Simple, @Simple(%C)> [template] // CHECK:STDOUT: %interface.1: = interface_witness () [template] // CHECK:STDOUT: %WithAssocFn.type.3: type = facet_type <@WithAssocFn, @WithAssocFn(%C)> [template] -// CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %F.type.2: type = fn_type @F.1, @WithAssocFn(%C) [template] // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template] -// CHECK:STDOUT: %F.type.3: type = fn_type @F.1, @WithAssocFn(%C) [template] -// CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template] -// CHECK:STDOUT: %F.assoc_type.2: type = assoc_entity_type %WithAssocFn.type.3, %F.type.3 [template] +// CHECK:STDOUT: %F.assoc_type.2: type = assoc_entity_type %WithAssocFn.type.3, %F.type.2 [template] // CHECK:STDOUT: %assoc0.2: %F.assoc_type.2 = assoc_entity element0, @WithAssocFn.%F.decl [template] +// CHECK:STDOUT: %F.type.3: type = fn_type @F.2 [template] +// CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template] // CHECK:STDOUT: %WithAssocFn.facet: %WithAssocFn.type.2 = facet_value %C, %C [symbolic] -// CHECK:STDOUT: %interface.2: = interface_witness (%F.2) [template] +// CHECK:STDOUT: %interface.2: = interface_witness (%F.3) [template] // CHECK:STDOUT: %X.val: %X = struct_value () [template] // CHECK:STDOUT: %N: %T.1 = bind_symbolic_name N, 1 [symbolic] // CHECK:STDOUT: %N.patt: %T.1 = symbolic_binding_pattern N, 1 [symbolic] @@ -234,7 +234,7 @@ fn G(T:! Generic(B)) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: %Self.ref as %WithAssocFn.type { -// CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] { +// CHECK:STDOUT: %F.decl: %F.type.3 = fn_decl @F.2 [template = constants.%F.3] { // CHECK:STDOUT: %return.patt: %X = return_slot_pattern // CHECK:STDOUT: %return.param_patt: %X = out_param_pattern %return.patt, runtime_param0 // CHECK:STDOUT: } { @@ -351,8 +351,8 @@ fn G(T:! Generic(B)) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %WithAssocFn.type => constants.%WithAssocFn.type.3 // CHECK:STDOUT: %Self.2 => constants.%Self.2 -// CHECK:STDOUT: %F.type => constants.%F.type.3 -// CHECK:STDOUT: %F => constants.%F.3 +// CHECK:STDOUT: %F.type => constants.%F.type.2 +// CHECK:STDOUT: %F => constants.%F.2 // CHECK:STDOUT: %F.assoc_type => constants.%F.assoc_type.2 // CHECK:STDOUT: %assoc0.loc10_14.2 => constants.%assoc0.2 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/no_prelude/generic_import.carbon b/toolchain/check/testdata/interface/no_prelude/generic_import.carbon index 574abfc16a92..49530e7d0cc3 100644 --- a/toolchain/check/testdata/interface/no_prelude/generic_import.carbon +++ b/toolchain/check/testdata/interface/no_prelude/generic_import.carbon @@ -110,14 +110,14 @@ impl C as AddWith(C) { // CHECK:STDOUT: %F.assoc_type.1: type = assoc_entity_type %AddWith.type.2, %F.type.1 [symbolic] // CHECK:STDOUT: %assoc0.1: %F.assoc_type.1 = assoc_entity element0, imports.%import_ref.5 [symbolic] // CHECK:STDOUT: %AddWith.type.3: type = facet_type <@AddWith, @AddWith(%C)> [template] -// CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template] +// CHECK:STDOUT: %F.type.2: type = fn_type @F.1, @AddWith(%C) [template] // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template] -// CHECK:STDOUT: %F.type.3: type = fn_type @F.1, @AddWith(%C) [template] -// CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template] -// CHECK:STDOUT: %F.assoc_type.2: type = assoc_entity_type %AddWith.type.3, %F.type.3 [template] +// CHECK:STDOUT: %F.assoc_type.2: type = assoc_entity_type %AddWith.type.3, %F.type.2 [template] // CHECK:STDOUT: %assoc0.2: %F.assoc_type.2 = assoc_entity element0, imports.%import_ref.5 [template] +// CHECK:STDOUT: %F.type.3: type = fn_type @F.2 [template] +// CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template] // CHECK:STDOUT: %AddWith.facet: %AddWith.type.2 = facet_value %C, %C [symbolic] -// CHECK:STDOUT: %interface: = interface_witness (%F.2) [template] +// CHECK:STDOUT: %interface: = interface_witness (%F.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -164,7 +164,7 @@ impl C as AddWith(C) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %C.ref.loc7_6 as %AddWith.type { -// CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] {} {} +// CHECK:STDOUT: %F.decl: %F.type.3 = fn_decl @F.2 [template = constants.%F.3] {} {} // CHECK:STDOUT: %interface: = interface_witness (%F.decl) [template = constants.%interface] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -206,8 +206,8 @@ impl C as AddWith(C) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %AddWith.type => constants.%AddWith.type.3 // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %F.type => constants.%F.type.3 -// CHECK:STDOUT: %F => constants.%F.3 +// CHECK:STDOUT: %F.type => constants.%F.type.2 +// CHECK:STDOUT: %F => constants.%F.2 // CHECK:STDOUT: %F.assoc_type => constants.%F.assoc_type.2 // CHECK:STDOUT: %assoc0 => constants.%assoc0.2 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/no_prelude/import_interface_decl.carbon b/toolchain/check/testdata/interface/no_prelude/import_interface_decl.carbon index e8e5697089c1..9f8c7d28781c 100644 --- a/toolchain/check/testdata/interface/no_prelude/import_interface_decl.carbon +++ b/toolchain/check/testdata/interface/no_prelude/import_interface_decl.carbon @@ -11,17 +11,25 @@ // --- a.carbon library "[[@TEST_NAME]]"; interface A; -impl () as A; - // --- a.impl.carbon impl library "[[@TEST_NAME]]"; +// --- fail_b.carbon +library "[[@TEST_NAME]]"; +interface B {} +// CHECK:STDERR: fail_b.carbon:[[@LINE+3]]:1: error: impl declared but not defined [MissingImplDefinition] +// CHECK:STDERR: impl () as B; +// CHECK:STDERR: ^~~~~~~~~~~~~ +impl () as B; + +// --- b.impl.carbon +impl library "[[@TEST_NAME]]"; + // CHECK:STDOUT: --- a.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %A.type: type = facet_type <@A> [template] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -29,39 +37,81 @@ impl library "[[@TEST_NAME]]"; // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl: type = interface_decl @A [template = constants.%A.type] {} {} -// CHECK:STDOUT: impl_decl @impl [template] {} { -// CHECK:STDOUT: %.loc3_7.1: %empty_tuple.type = tuple_literal () -// CHECK:STDOUT: %.loc3_7.2: type = converted %.loc3_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A.type] -// CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @A; // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: %.loc3_7.2 as %A.ref; -// CHECK:STDOUT: // CHECK:STDOUT: --- a.impl.carbon // CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %A.type: type = facet_type <@A> [template] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: imports { -// CHECK:STDOUT: %import_ref.1 = import_ref Main//a, A, unloaded -// CHECK:STDOUT: %import_ref.2: type = import_ref Main//a, loc3_7, loaded [template = constants.%empty_tuple.type] -// CHECK:STDOUT: %import_ref.3: type = import_ref Main//a, loc3_12, loaded [template = constants.%A.type] +// CHECK:STDOUT: %import_ref = import_ref Main//a, A, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = imports.%import_ref.1 +// CHECK:STDOUT: .A = imports.%import_ref // CHECK:STDOUT: } // CHECK:STDOUT: %default.import.loc1_6.1 = import // CHECK:STDOUT: %default.import.loc1_6.2 = import // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @A [from "a.carbon"]; +// CHECK:STDOUT: --- fail_b.carbon // CHECK:STDOUT: -// CHECK:STDOUT: impl @impl: imports.%import_ref.2 as imports.%import_ref.3 [from "a.carbon"]; +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %B.type: type = facet_type <@B> [template] +// CHECK:STDOUT: %Self: %B.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .B = %B.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %B.decl: type = interface_decl @B [template = constants.%B.type] {} {} +// CHECK:STDOUT: impl_decl @impl [template] {} { +// CHECK:STDOUT: %.loc6_7.1: %empty_tuple.type = tuple_literal () +// CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @B { +// CHECK:STDOUT: %Self: %B.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl: %.loc6_7.2 as %B.ref; +// CHECK:STDOUT: +// CHECK:STDOUT: --- b.impl.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %B.type: type = facet_type <@B> [template] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %import_ref.1 = import_ref Main//b, B, unloaded +// CHECK:STDOUT: %import_ref.2 = import_ref Main//b, inst15 [no loc], unloaded +// CHECK:STDOUT: %import_ref.3: type = import_ref Main//b, loc6_7, loaded [template = constants.%empty_tuple.type] +// CHECK:STDOUT: %import_ref.4: type = import_ref Main//b, loc6_12, loaded [template = constants.%B.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [template] { +// CHECK:STDOUT: .B = imports.%import_ref.1 +// CHECK:STDOUT: } +// CHECK:STDOUT: %default.import.loc1_6.1 = import +// CHECK:STDOUT: %default.import.loc1_6.2 = import +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @B [from "fail_b.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%import_ref.2 +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl: imports.%import_ref.3 as imports.%import_ref.4 [from "fail_b.carbon"]; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/add.carbon b/toolchain/check/testdata/operators/overloaded/add.carbon index 3396ecffec9e..4694644e81fc 100644 --- a/toolchain/check/testdata/operators/overloaded/add.carbon +++ b/toolchain/check/testdata/operators/overloaded/add.carbon @@ -38,8 +38,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %Add.type: type = facet_type <@Add> [template] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/bit_and.carbon b/toolchain/check/testdata/operators/overloaded/bit_and.carbon index e56b393ac927..21f250e41624 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_and.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_and.carbon @@ -38,8 +38,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %BitAnd.type: type = facet_type <@BitAnd> [template] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/bit_or.carbon b/toolchain/check/testdata/operators/overloaded/bit_or.carbon index 94fce897edd4..ab0e28ddc8d4 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_or.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_or.carbon @@ -38,8 +38,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %BitOr.type: type = facet_type <@BitOr> [template] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/bit_xor.carbon b/toolchain/check/testdata/operators/overloaded/bit_xor.carbon index 327a6732341d..09ce19784887 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_xor.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_xor.carbon @@ -38,8 +38,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %BitXor.type: type = facet_type <@BitXor> [template] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/dec.carbon b/toolchain/check/testdata/operators/overloaded/dec.carbon index c15f13ed4519..48c67c69529a 100644 --- a/toolchain/check/testdata/operators/overloaded/dec.carbon +++ b/toolchain/check/testdata/operators/overloaded/dec.carbon @@ -30,9 +30,9 @@ fn TestOp() { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %Dec.type: type = facet_type <@Dec> [template] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] // CHECK:STDOUT: %ptr.1: type = ptr_type %C [template] // CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/div.carbon b/toolchain/check/testdata/operators/overloaded/div.carbon index ef5167fd2bd1..89a5cf494ad0 100644 --- a/toolchain/check/testdata/operators/overloaded/div.carbon +++ b/toolchain/check/testdata/operators/overloaded/div.carbon @@ -38,8 +38,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %Div.type: type = facet_type <@Div> [template] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon index 46b82d2a497a..873c354de0c0 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon @@ -47,9 +47,9 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %Inc.type: type = facet_type <@Inc> [template] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] // CHECK:STDOUT: %ptr.1: type = ptr_type %C [template] // CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon index 41b12049f7ce..dc9336622e96 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon @@ -56,8 +56,8 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %D: type = class_type @D [template] // CHECK:STDOUT: %Add.type: type = facet_type <@Add> [template] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/implicit_as.carbon b/toolchain/check/testdata/operators/overloaded/implicit_as.carbon index 0351e99104f0..315a18084c1a 100644 --- a/toolchain/check/testdata/operators/overloaded/implicit_as.carbon +++ b/toolchain/check/testdata/operators/overloaded/implicit_as.carbon @@ -46,15 +46,15 @@ fn Test() { // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template] // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.1 = struct_value () [template] // CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(%X)> [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.2 [template] -// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.1, @ImplicitAs(%X) [template] -// CHECK:STDOUT: %interface.1: = interface_witness (%Convert.2) [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%X) [template] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2 [template] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [template] +// CHECK:STDOUT: %interface.1: = interface_witness (%Convert.3) [template] // CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [template] -// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3 [template] -// CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] -// CHECK:STDOUT: %interface.2: = interface_witness (%Convert.4) [template] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.1, @ImplicitAs(%i32) [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.3 [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] +// CHECK:STDOUT: %interface.2: = interface_witness (%Convert.5) [template] // CHECK:STDOUT: %Sink_i32.type: type = fn_type @Sink_i32 [template] // CHECK:STDOUT: %Sink_i32: %Sink_i32.type = struct_value () [template] // CHECK:STDOUT: %Sink_X.type: type = fn_type @Sink_X [template] @@ -143,7 +143,7 @@ fn Test() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: %i32 as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.2 = fn_decl @Convert.2 [template = constants.%Convert.2] { +// CHECK:STDOUT: %Convert.decl: %Convert.type.3 = fn_decl @Convert.2 [template = constants.%Convert.3] { // CHECK:STDOUT: %self.patt: %i32 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %i32 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %X = return_slot_pattern @@ -167,7 +167,7 @@ fn Test() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: %X.ref as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.4 = fn_decl @Convert.3 [template = constants.%Convert.4] { +// CHECK:STDOUT: %Convert.decl: %Convert.type.5 = fn_decl @Convert.3 [template = constants.%Convert.5] { // CHECK:STDOUT: %self.patt: %X = binding_pattern self // CHECK:STDOUT: %self.param_patt: %X = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern @@ -250,7 +250,7 @@ fn Test() { // CHECK:STDOUT: %Source.specific_fn.loc30: = specific_function %Source.ref.loc30, @Source(constants.%X) [template = constants.%Source.specific_fn.2] // CHECK:STDOUT: %.loc30_20.1: ref %X = temporary_storage // CHECK:STDOUT: %Source.call.loc30: init %X = call %Source.specific_fn.loc30() to %.loc30_20.1 -// CHECK:STDOUT: %impl.elem0.loc30: %Convert.type.5 = interface_witness_access constants.%interface.2, element0 [template = constants.%Convert.4] +// CHECK:STDOUT: %impl.elem0.loc30: %Convert.type.4 = interface_witness_access constants.%interface.2, element0 [template = constants.%Convert.5] // CHECK:STDOUT: %Convert.bound.loc30: = bound_method %Source.call.loc30, %impl.elem0.loc30 // CHECK:STDOUT: %.loc30_20.2: ref %X = temporary %.loc30_20.1, %Source.call.loc30 // CHECK:STDOUT: %.loc30_20.3: %X = bind_value %.loc30_20.2 @@ -264,7 +264,7 @@ fn Test() { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32] // CHECK:STDOUT: %Source.specific_fn.loc31: = specific_function %Source.ref.loc31, @Source(constants.%i32) [template = constants.%Source.specific_fn.3] // CHECK:STDOUT: %Source.call.loc31: init %i32 = call %Source.specific_fn.loc31() -// CHECK:STDOUT: %impl.elem0.loc31: %Convert.type.3 = interface_witness_access constants.%interface.1, element0 [template = constants.%Convert.2] +// CHECK:STDOUT: %impl.elem0.loc31: %Convert.type.2 = interface_witness_access constants.%interface.1, element0 [template = constants.%Convert.3] // CHECK:STDOUT: %Convert.bound.loc31: = bound_method %Source.call.loc31, %impl.elem0.loc31 // CHECK:STDOUT: %.loc31_20.1: ref %X = temporary_storage // CHECK:STDOUT: %.loc31_20.2: %i32 = value_of_initializer %Source.call.loc31 diff --git a/toolchain/check/testdata/operators/overloaded/inc.carbon b/toolchain/check/testdata/operators/overloaded/inc.carbon index e45cb71c94d2..20892ea4a5dd 100644 --- a/toolchain/check/testdata/operators/overloaded/inc.carbon +++ b/toolchain/check/testdata/operators/overloaded/inc.carbon @@ -30,9 +30,9 @@ fn TestOp() { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %Inc.type: type = facet_type <@Inc> [template] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] // CHECK:STDOUT: %ptr.1: type = ptr_type %C [template] // CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/index.carbon b/toolchain/check/testdata/operators/overloaded/index.carbon index e6efb4e396b0..b78c3dbacb29 100644 --- a/toolchain/check/testdata/operators/overloaded/index.carbon +++ b/toolchain/check/testdata/operators/overloaded/index.carbon @@ -87,10 +87,10 @@ let x: i32 = c[0]; // CHECK:STDOUT: %IndexWith.type.1: type = generic_interface_type @IndexWith [template] // CHECK:STDOUT: %IndexWith.generic: %IndexWith.type.1 = struct_value () [template] // CHECK:STDOUT: %IndexWith.type.3: type = facet_type <@IndexWith, @IndexWith(%SubscriptType.1, %ElementType.1)> [template] -// CHECK:STDOUT: %At.type.2: type = fn_type @At.2 [template] -// CHECK:STDOUT: %At.2: %At.type.2 = struct_value () [template] -// CHECK:STDOUT: %At.type.3: type = fn_type @At.1, @IndexWith(%SubscriptType.1, %ElementType.1) [template] -// CHECK:STDOUT: %interface: = interface_witness (%At.2) [template] +// CHECK:STDOUT: %At.type.2: type = fn_type @At.1, @IndexWith(%SubscriptType.1, %ElementType.1) [template] +// CHECK:STDOUT: %At.type.3: type = fn_type @At.2 [template] +// CHECK:STDOUT: %At.3: %At.type.3 = struct_value () [template] +// CHECK:STDOUT: %interface: = interface_witness (%At.3) [template] // CHECK:STDOUT: %ElementType.val: %ElementType.1 = struct_value () [template] // CHECK:STDOUT: %SubscriptType.val: %SubscriptType.1 = struct_value () [template] // CHECK:STDOUT: %C.val: %C = struct_value () [template] @@ -130,7 +130,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %C.ref as %IndexWith.type { -// CHECK:STDOUT: %At.decl: %At.type.2 = fn_decl @At.2 [template = constants.%At.2] { +// CHECK:STDOUT: %At.decl: %At.type.3 = fn_decl @At.2 [template = constants.%At.3] { // CHECK:STDOUT: %self.patt: %C = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %subscript.patt: %SubscriptType.1 = binding_pattern subscript @@ -205,7 +205,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %c: %C = bind_name c, %.loc15_14.2 // CHECK:STDOUT: %c.ref: %C = name_ref c, %c // CHECK:STDOUT: %s.ref: %SubscriptType.1 = name_ref s, %s -// CHECK:STDOUT: %impl.elem0: %At.type.3 = interface_witness_access constants.%interface, element0 [template = constants.%At.2] +// CHECK:STDOUT: %impl.elem0: %At.type.2 = interface_witness_access constants.%interface, element0 [template = constants.%At.3] // CHECK:STDOUT: %At.bound: = bound_method %c.ref, %impl.elem0 // CHECK:STDOUT: %.loc16_25.1: ref %ElementType.1 = temporary_storage // CHECK:STDOUT: %At.call: init %ElementType.1 = call %At.bound(%c.ref, %s.ref) to %.loc16_25.1 @@ -225,10 +225,10 @@ let x: i32 = c[0]; // CHECK:STDOUT: %IndexWith.type.1: type = generic_interface_type @IndexWith [template] // CHECK:STDOUT: %IndexWith.generic: %IndexWith.type.1 = struct_value () [template] // CHECK:STDOUT: %IndexWith.type.3: type = facet_type <@IndexWith, @IndexWith(%i32, %i32)> [template] -// CHECK:STDOUT: %At.type.2: type = fn_type @At.2 [template] -// CHECK:STDOUT: %At.2: %At.type.2 = struct_value () [template] -// CHECK:STDOUT: %At.type.3: type = fn_type @At.1, @IndexWith(%i32, %i32) [template] -// CHECK:STDOUT: %interface.1: = interface_witness (%At.2) [template] +// CHECK:STDOUT: %At.type.2: type = fn_type @At.1, @IndexWith(%i32, %i32) [template] +// CHECK:STDOUT: %At.type.3: type = fn_type @At.2 [template] +// CHECK:STDOUT: %At.3: %At.type.3 = struct_value () [template] +// CHECK:STDOUT: %interface.1: = interface_witness (%At.3) [template] // CHECK:STDOUT: %int_0.1: Core.IntLiteral = int_value 0 [template] // CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %int_5.1: Core.IntLiteral = int_value 5 [template] @@ -285,7 +285,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: %.loc4_15.2 as %IndexWith.type { -// CHECK:STDOUT: %At.decl: %At.type.2 = fn_decl @At.2 [template = constants.%At.2] { +// CHECK:STDOUT: %At.decl: %At.type.3 = fn_decl @At.2 [template = constants.%At.3] { // CHECK:STDOUT: %self.patt: %tuple.type.2 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %tuple.type.2 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %subscript.patt: %i32 = binding_pattern subscript @@ -350,7 +350,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %int.convert_checked.loc11: init %i32 = call %Convert.specific_fn.loc11(%int_0) [template = constants.%int_0.2] // CHECK:STDOUT: %.loc11_17.1: %i32 = value_of_initializer %int.convert_checked.loc11 [template = constants.%int_0.2] // CHECK:STDOUT: %.loc11_17.2: %i32 = converted %int_0, %.loc11_17.1 [template = constants.%int_0.2] -// CHECK:STDOUT: %impl.elem0.loc11_17.2: %At.type.3 = interface_witness_access constants.%interface.1, element0 [template = constants.%At.2] +// CHECK:STDOUT: %impl.elem0.loc11_17.2: %At.type.2 = interface_witness_access constants.%interface.1, element0 [template = constants.%At.3] // CHECK:STDOUT: %At.bound: = bound_method %s.ref, %impl.elem0.loc11_17.2 // CHECK:STDOUT: %At.call: init %i32 = call %At.bound(%s.ref, %.loc11_17.2) // CHECK:STDOUT: %.loc11_18.1: %i32 = value_of_initializer %At.call @@ -370,10 +370,10 @@ let x: i32 = c[0]; // CHECK:STDOUT: %IndexWith.type.1: type = generic_interface_type @IndexWith [template] // CHECK:STDOUT: %IndexWith.generic: %IndexWith.type.1 = struct_value () [template] // CHECK:STDOUT: %IndexWith.type.3: type = facet_type <@IndexWith, @IndexWith(%SubscriptType.1, %ElementType.1)> [template] -// CHECK:STDOUT: %At.type.2: type = fn_type @At.2 [template] -// CHECK:STDOUT: %At.2: %At.type.2 = struct_value () [template] -// CHECK:STDOUT: %At.type.3: type = fn_type @At.1, @IndexWith(%SubscriptType.1, %ElementType.1) [template] -// CHECK:STDOUT: %interface: = interface_witness (%At.2) [template] +// CHECK:STDOUT: %At.type.2: type = fn_type @At.1, @IndexWith(%SubscriptType.1, %ElementType.1) [template] +// CHECK:STDOUT: %At.type.3: type = fn_type @At.2 [template] +// CHECK:STDOUT: %At.3: %At.type.3 = struct_value () [template] +// CHECK:STDOUT: %interface: = interface_witness (%At.3) [template] // CHECK:STDOUT: %ElementType.val: %ElementType.1 = struct_value () [template] // CHECK:STDOUT: %C.val: %C = struct_value () [template] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template] @@ -413,7 +413,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %C.ref as %IndexWith.type { -// CHECK:STDOUT: %At.decl: %At.type.2 = fn_decl @At.2 [template = constants.%At.2] { +// CHECK:STDOUT: %At.decl: %At.type.3 = fn_decl @At.2 [template = constants.%At.3] { // CHECK:STDOUT: %self.patt: %C = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %subscript.patt: %SubscriptType.1 = binding_pattern subscript @@ -482,7 +482,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %c.ref: %C = name_ref c, %c // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0] // CHECK:STDOUT: %.loc22_25.1: %SubscriptType.1 = converted %int_0, [template = ] -// CHECK:STDOUT: %impl.elem0: %At.type.3 = interface_witness_access constants.%interface, element0 [template = constants.%At.2] +// CHECK:STDOUT: %impl.elem0: %At.type.2 = interface_witness_access constants.%interface, element0 [template = constants.%At.3] // CHECK:STDOUT: %At.bound: = bound_method %c.ref, %impl.elem0 // CHECK:STDOUT: %.loc22_25.2: ref %ElementType.1 = temporary_storage // CHECK:STDOUT: %At.call: init %ElementType.1 = call %At.bound(%c.ref, ) to %.loc22_25.2 diff --git a/toolchain/check/testdata/operators/overloaded/left_shift.carbon b/toolchain/check/testdata/operators/overloaded/left_shift.carbon index c4f303a181ee..f73575e5a417 100644 --- a/toolchain/check/testdata/operators/overloaded/left_shift.carbon +++ b/toolchain/check/testdata/operators/overloaded/left_shift.carbon @@ -38,8 +38,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %LeftShift.type: type = facet_type <@LeftShift> [template] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/mod.carbon b/toolchain/check/testdata/operators/overloaded/mod.carbon index de66d0dedf23..61b8a4a51408 100644 --- a/toolchain/check/testdata/operators/overloaded/mod.carbon +++ b/toolchain/check/testdata/operators/overloaded/mod.carbon @@ -38,8 +38,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %Mod.type: type = facet_type <@Mod> [template] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/mul.carbon b/toolchain/check/testdata/operators/overloaded/mul.carbon index 32679475c919..ed21aa4d5d8e 100644 --- a/toolchain/check/testdata/operators/overloaded/mul.carbon +++ b/toolchain/check/testdata/operators/overloaded/mul.carbon @@ -38,8 +38,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %Mul.type: type = facet_type <@Mul> [template] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/no_prelude/index.carbon b/toolchain/check/testdata/operators/overloaded/no_prelude/index.carbon index 6a6bcd1ea2c9..68f4c5e92cb0 100644 --- a/toolchain/check/testdata/operators/overloaded/no_prelude/index.carbon +++ b/toolchain/check/testdata/operators/overloaded/no_prelude/index.carbon @@ -128,18 +128,18 @@ fn F() { ()[()]; } // CHECK:STDOUT: %At.assoc_type.1: type = assoc_entity_type %IndexWith.type.2, %At.type.1 [symbolic] // CHECK:STDOUT: %assoc0.1: %At.assoc_type.1 = assoc_entity element0, @IndexWith.%At.decl [symbolic] // CHECK:STDOUT: %IndexWith.type.3: type = facet_type <@IndexWith, @IndexWith(%empty_tuple.type)> [template] -// CHECK:STDOUT: %At.type.2: type = fn_type @At.2 [template] +// CHECK:STDOUT: %At.type.2: type = fn_type @At.1, @IndexWith(%empty_tuple.type) [template] // CHECK:STDOUT: %At.2: %At.type.2 = struct_value () [template] -// CHECK:STDOUT: %At.type.3: type = fn_type @At.1, @IndexWith(%empty_tuple.type) [template] -// CHECK:STDOUT: %At.3: %At.type.3 = struct_value () [template] -// CHECK:STDOUT: %At.assoc_type.2: type = assoc_entity_type %IndexWith.type.3, %At.type.3 [template] +// CHECK:STDOUT: %At.assoc_type.2: type = assoc_entity_type %IndexWith.type.3, %At.type.2 [template] // CHECK:STDOUT: %assoc0.2: %At.assoc_type.2 = assoc_entity element0, @IndexWith.%At.decl [template] +// CHECK:STDOUT: %At.type.3: type = fn_type @At.2 [template] +// CHECK:STDOUT: %At.3: %At.type.3 = struct_value () [template] // CHECK:STDOUT: %IndexWith.facet: %IndexWith.type.2 = facet_value %empty_tuple.type, %empty_tuple.type [symbolic] -// CHECK:STDOUT: %interface: = interface_witness (%At.2) [template] +// CHECK:STDOUT: %interface: = interface_witness (%At.3) [template] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] // CHECK:STDOUT: %F: %F.type = struct_value () [template] -// CHECK:STDOUT: %At.bound: = bound_method %empty_tuple, %At.2 [template] +// CHECK:STDOUT: %At.bound: = bound_method %empty_tuple, %At.3 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -217,7 +217,7 @@ fn F() { ()[()]; } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %.loc9_7.2 as %IndexWith.type { -// CHECK:STDOUT: %At.decl: %At.type.2 = fn_decl @At.2 [template = constants.%At.2] { +// CHECK:STDOUT: %At.decl: %At.type.3 = fn_decl @At.2 [template = constants.%At.3] { // CHECK:STDOUT: %self.patt: %empty_tuple.type = binding_pattern self // CHECK:STDOUT: %self.param_patt: %empty_tuple.type = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %subscript.patt: %empty_tuple.type = binding_pattern subscript @@ -271,7 +271,7 @@ fn F() { ()[()]; } // CHECK:STDOUT: %.loc15_11.2: %empty_tuple.type = converted %.loc15_11.1, %empty_tuple.loc15_11 [template = constants.%empty_tuple] // CHECK:STDOUT: %empty_tuple.loc15_14: %empty_tuple.type = tuple_value () [template = constants.%empty_tuple] // CHECK:STDOUT: %.loc15_15: %empty_tuple.type = converted %.loc15_14, %empty_tuple.loc15_14 [template = constants.%empty_tuple] -// CHECK:STDOUT: %impl.elem0: %At.type.3 = interface_witness_access constants.%interface, element0 [template = constants.%At.2] +// CHECK:STDOUT: %impl.elem0: %At.type.2 = interface_witness_access constants.%interface, element0 [template = constants.%At.3] // CHECK:STDOUT: %At.bound: = bound_method %.loc15_11.2, %impl.elem0 [template = constants.%At.bound] // CHECK:STDOUT: %At.call: init %empty_tuple.type = call %At.bound(%.loc15_11.2, %.loc15_15) // CHECK:STDOUT: return @@ -300,8 +300,8 @@ fn F() { ()[()]; } // CHECK:STDOUT: !definition: // CHECK:STDOUT: %IndexWith.type => constants.%IndexWith.type.3 // CHECK:STDOUT: %Self.2 => constants.%Self -// CHECK:STDOUT: %At.type => constants.%At.type.3 -// CHECK:STDOUT: %At => constants.%At.3 +// CHECK:STDOUT: %At.type => constants.%At.type.2 +// CHECK:STDOUT: %At => constants.%At.2 // CHECK:STDOUT: %At.assoc_type => constants.%At.assoc_type.2 // CHECK:STDOUT: %assoc0.loc6_52.2 => constants.%assoc0.2 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/right_shift.carbon b/toolchain/check/testdata/operators/overloaded/right_shift.carbon index 7ac3e88ea90b..e5ccf7c2a2c8 100644 --- a/toolchain/check/testdata/operators/overloaded/right_shift.carbon +++ b/toolchain/check/testdata/operators/overloaded/right_shift.carbon @@ -38,8 +38,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %RightShift.type: type = facet_type <@RightShift> [template] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.1) [template] diff --git a/toolchain/check/testdata/operators/overloaded/sub.carbon b/toolchain/check/testdata/operators/overloaded/sub.carbon index f786b3edf782..8266dc4f419e 100644 --- a/toolchain/check/testdata/operators/overloaded/sub.carbon +++ b/toolchain/check/testdata/operators/overloaded/sub.carbon @@ -38,8 +38,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %Sub.type: type = facet_type <@Sub> [template] -// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template] +// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1 [template] // CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [template] // CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template] // CHECK:STDOUT: %interface.1: = interface_witness (%Op.1) [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 ae122b298e5d..e0f594d83f42 100644 --- a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon @@ -51,7 +51,7 @@ fn G() -> C { // CHECK:STDOUT: %C: type = class_type @C [template] // CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %i32 [template] // CHECK:STDOUT: %struct_type.a.b.1: type = struct_type {.a: %i32, .b: %i32} [template] -// CHECK:STDOUT: %complete_type.4: = complete_type_witness %struct_type.a.b.1 [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %struct_type.a.b.1 [template] // CHECK:STDOUT: %G.type: type = fn_type @G [template] // CHECK:STDOUT: %G: %G.type = struct_value () [template] // CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] @@ -105,7 +105,7 @@ fn G() -> C { // CHECK:STDOUT: class @C { // CHECK:STDOUT: %.loc23_16: %C.elem = field_decl a, element0 [template] // CHECK:STDOUT: %.loc23_28: %C.elem = field_decl b, element1 [template] -// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.a.b.1 [template = constants.%complete_type.4] +// CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.a.b.1 [template = constants.%complete_type.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C diff --git a/toolchain/check/testdata/return/no_prelude/import_convert_function.carbon b/toolchain/check/testdata/return/no_prelude/import_convert_function.carbon index b1d1cc7b03ea..73441ca242c5 100644 --- a/toolchain/check/testdata/return/no_prelude/import_convert_function.carbon +++ b/toolchain/check/testdata/return/no_prelude/import_convert_function.carbon @@ -83,14 +83,14 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template] // CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [template] // CHECK:STDOUT: %ImplicitAs.type.3: type = facet_type <@ImplicitAs, @ImplicitAs(%i32.builtin)> [template] -// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.2 [template] +// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(%i32.builtin) [template] // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.1, @ImplicitAs(%i32.builtin) [template] -// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [template] -// CHECK:STDOUT: %Convert.assoc_type.2: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.3 [template] +// CHECK:STDOUT: %Convert.assoc_type.2: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template] // CHECK:STDOUT: %assoc0.2: %Convert.assoc_type.2 = assoc_entity element0, @ImplicitAs.%Convert.decl [template] +// CHECK:STDOUT: %Convert.type.3: type = fn_type @Convert.2 [template] +// CHECK:STDOUT: %Convert.3: %Convert.type.3 = struct_value () [template] // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.2 = facet_value Core.IntLiteral, Core.IntLiteral [symbolic] -// CHECK:STDOUT: %interface: = interface_witness (%Convert.2) [template] +// CHECK:STDOUT: %interface: = interface_witness (%Convert.3) [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -186,7 +186,7 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: %.loc12_17.2 as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.2 = fn_decl @Convert.2 [template = constants.%Convert.2] { +// CHECK:STDOUT: %Convert.decl: %Convert.type.3 = fn_decl @Convert.2 [template = constants.%Convert.3] { // CHECK:STDOUT: %self.patt: Core.IntLiteral = binding_pattern self // CHECK:STDOUT: %self.param_patt: Core.IntLiteral = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %i32.builtin = return_slot_pattern @@ -247,8 +247,8 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3 // CHECK:STDOUT: %Self.2 => constants.%Self -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.3 -// CHECK:STDOUT: %Convert => constants.%Convert.3 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2 +// CHECK:STDOUT: %Convert => constants.%Convert.2 // CHECK:STDOUT: %Convert.assoc_type => constants.%Convert.assoc_type.2 // CHECK:STDOUT: %assoc0.loc9_32.2 => constants.%assoc0.2 // CHECK:STDOUT: } @@ -307,14 +307,14 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: %D.val: %D = struct_value (%int_0.2, %int_0.2) [template] // CHECK:STDOUT: %C.2: type = class_type @C, @C(%int_0.2) [template] // CHECK:STDOUT: %ImplicitAs.type.4: type = facet_type <@ImplicitAs, @ImplicitAs(%D)> [template] -// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.3 [template] +// CHECK:STDOUT: %Convert.type.4: type = fn_type @Convert.1, @ImplicitAs(%D) [template] // CHECK:STDOUT: %Convert.4: %Convert.type.4 = struct_value () [template] -// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.1, @ImplicitAs(%D) [template] -// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] -// CHECK:STDOUT: %Convert.assoc_type.3: type = assoc_entity_type %ImplicitAs.type.4, %Convert.type.5 [template] +// CHECK:STDOUT: %Convert.assoc_type.3: type = assoc_entity_type %ImplicitAs.type.4, %Convert.type.4 [template] // CHECK:STDOUT: %assoc0.4: %Convert.assoc_type.3 = assoc_entity element0, imports.%import_ref.6 [template] +// CHECK:STDOUT: %Convert.type.5: type = fn_type @Convert.3 [template] +// CHECK:STDOUT: %Convert.5: %Convert.type.5 = struct_value () [template] // CHECK:STDOUT: %ImplicitAs.facet.1: %ImplicitAs.type.2 = facet_value %C.2, %C.2 [symbolic] -// CHECK:STDOUT: %interface.2: = interface_witness (%Convert.4) [template] +// CHECK:STDOUT: %interface.2: = interface_witness (%Convert.5) [template] // CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %Convert.bound.2: = bound_method %int_1.1, %Convert.3 [template] // CHECK:STDOUT: %int_1.2: %i32.builtin = int_value 1 [template] @@ -559,7 +559,7 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: %C as %ImplicitAs.type { -// CHECK:STDOUT: %Convert.decl: %Convert.type.4 = fn_decl @Convert.3 [template = constants.%Convert.4] { +// CHECK:STDOUT: %Convert.decl: %Convert.type.5 = fn_decl @Convert.3 [template = constants.%Convert.5] { // CHECK:STDOUT: %self.patt: %C.2 = binding_pattern self // CHECK:STDOUT: %self.param_patt: %C.2 = value_param_pattern %self.patt, runtime_param0 // CHECK:STDOUT: %return.patt: %D = return_slot_pattern @@ -900,8 +900,8 @@ fn F0(n: i32) -> P.D { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.4 // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.5 -// CHECK:STDOUT: %Convert => constants.%Convert.5 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.4 +// CHECK:STDOUT: %Convert => constants.%Convert.4 // CHECK:STDOUT: %Convert.assoc_type => constants.%Convert.assoc_type.3 // CHECK:STDOUT: %assoc0 => constants.%assoc0.4 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/import.carbon b/toolchain/check/testdata/struct/import.carbon index 1b0a93f361c9..7d607e20dfb6 100644 --- a/toolchain/check/testdata/struct/import.carbon +++ b/toolchain/check/testdata/struct/import.carbon @@ -83,7 +83,7 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template] // CHECK:STDOUT: %C.1: type = class_type @C, @C(%S) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.4: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %int_1.1: Core.IntLiteral = int_value 1 [template] // CHECK:STDOUT: %int_2.1: Core.IntLiteral = int_value 2 [template] // CHECK:STDOUT: %struct_type.a.b.2: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [template] @@ -170,7 +170,7 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: class { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.4] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C.1 @@ -276,7 +276,7 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.195: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.196 = import_ref Implicit//default, inst945 [no loc], unloaded +// CHECK:STDOUT: %import_ref.196 = import_ref Implicit//default, inst940 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -396,7 +396,7 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.194: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst945 [no loc], unloaded +// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst940 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -486,7 +486,7 @@ var c_bad: C({.a = 3, .b = 4}) = F(); // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.194: = import_ref Implicit//default, loc8_34, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst945 [no loc], unloaded +// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst940 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/tuple/import.carbon b/toolchain/check/testdata/tuple/import.carbon index dff9bddbf797..3df6812364ee 100644 --- a/toolchain/check/testdata/tuple/import.carbon +++ b/toolchain/check/testdata/tuple/import.carbon @@ -97,7 +97,7 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template] // CHECK:STDOUT: %C.1: type = class_type @C, @C(%X) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template] -// CHECK:STDOUT: %complete_type.4: = complete_type_witness %empty_struct_type [template] +// CHECK:STDOUT: %complete_type.3: = complete_type_witness %empty_struct_type [template] // CHECK:STDOUT: %tuple.5: %tuple.type.8 = tuple_value (%int_1.2, %int_2.2) [template] // CHECK:STDOUT: %C.2: type = class_type @C, @C(%tuple.5) [template] // CHECK:STDOUT: %F.type: type = fn_type @F [template] @@ -176,7 +176,7 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: class { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.4] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [template = constants.%complete_type.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C.1 @@ -293,7 +293,7 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.195: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.196 = import_ref Implicit//default, inst980 [no loc], unloaded +// CHECK:STDOUT: %import_ref.196 = import_ref Implicit//default, inst975 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -421,7 +421,7 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.194: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst980 [no loc], unloaded +// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst975 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -511,7 +511,7 @@ var c_bad: C((3, 4)) = F(); // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.194: = import_ref Implicit//default, loc7_26, loaded [template = constants.%complete_type.3] -// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst980 [no loc], unloaded +// CHECK:STDOUT: %import_ref.195 = import_ref Implicit//default, inst975 [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/diagnostics/diagnostic_kind.def b/toolchain/diagnostics/diagnostic_kind.def index bd7eb61b566d..457768bb6c8b 100644 --- a/toolchain/diagnostics/diagnostic_kind.def +++ b/toolchain/diagnostics/diagnostic_kind.def @@ -172,6 +172,7 @@ CARBON_DIAGNOSTIC_KIND(RedeclRedundant) CARBON_DIAGNOSTIC_KIND(RedeclPrevDef) CARBON_DIAGNOSTIC_KIND(RedeclRedef) CARBON_DIAGNOSTIC_KIND(RedeclExternMismatch) +CARBON_DIAGNOSTIC_KIND(RedeclImportedImpl) CARBON_DIAGNOSTIC_KIND(RedeclParamListDiffers) CARBON_DIAGNOSTIC_KIND(RedeclParamListPrevious) CARBON_DIAGNOSTIC_KIND(RedeclParamCountDiffers) @@ -251,7 +252,6 @@ CARBON_DIAGNOSTIC_KIND(ExtendImplForall) CARBON_DIAGNOSTIC_KIND(ExtendImplOutsideClass) CARBON_DIAGNOSTIC_KIND(ExtendImplSelfAs) CARBON_DIAGNOSTIC_KIND(ExtendImplSelfAsDefault) -CARBON_DIAGNOSTIC_KIND(ExtendUndefinedInterface) CARBON_DIAGNOSTIC_KIND(ImplAsNonFacetType) CARBON_DIAGNOSTIC_KIND(ImplAsOutsideClass) CARBON_DIAGNOSTIC_KIND(ImplPreviousDefinition) @@ -260,6 +260,7 @@ CARBON_DIAGNOSTIC_KIND(ImplMissingFunction) CARBON_DIAGNOSTIC_KIND(ImplFunctionWithNonFunction) CARBON_DIAGNOSTIC_KIND(ImplAssociatedFunctionHere) CARBON_DIAGNOSTIC_KIND(ImplOfUndefinedInterface) +CARBON_DIAGNOSTIC_KIND(MissingImplDefinition) // Impl lookup. CARBON_DIAGNOSTIC_KIND(MissingImplInMemberAccess) diff --git a/toolchain/sem_ir/impl.h b/toolchain/sem_ir/impl.h index e47dda530202..d07c86512440 100644 --- a/toolchain/sem_ir/impl.h +++ b/toolchain/sem_ir/impl.h @@ -33,6 +33,7 @@ struct ImplFields { // The witness for the impl. This can be `BuiltinErrorInst`. InstId witness_id = InstId::Invalid; + bool defined = false; }; // An implementation of a constraint. See EntityWithParamsBase regarding the @@ -46,7 +47,7 @@ struct Impl : public EntityWithParamsBase, // Determines whether this impl has been fully defined. This is false until we // reach the `}` of the impl definition. - auto is_defined() const -> bool { return witness_id.is_valid(); } + auto is_defined() const -> bool { return defined; } // Determines whether this impl's definition has begun but not yet ended. auto is_being_defined() const -> bool {