From 2f58185c447534a020643c61106327dad6ba82dd Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 31 Jul 2026 16:17:06 -0400 Subject: [PATCH] Find the current impl from accesses in a named constraint being implemented (#7592) When implementing a named constraint, like `impl as N`, any accesses through `Self` in the named constraint need to get the value of the associated constant from the impl's witness table. This isn't possible immediately, since the impl does not even exist until the declaration is complete. We use the same model as for accesses found directly in the impl declaration, but applied to the point where accesses in the named constraint are substituted during identify to point at the impl's self type. To get there, we need LookupImplWitness instructions in the named constraint, when re-evaluated during construction of their enclosing specific, to evaluate to ImplSelfWitness when they are a reference to the type and interface being implemented. --- toolchain/check/context.h | 21 ++--- toolchain/check/handle_impl.cpp | 16 ++-- toolchain/check/handle_where.cpp | 8 +- toolchain/check/impl.cpp | 84 +++++++++---------- toolchain/check/impl_lookup.cpp | 50 ++++++----- .../check/testdata/facet/period_self.carbon | 2 +- toolchain/check/testdata/for/actual.carbon | 8 +- .../check/testdata/impl/forward_decls.carbon | 30 +++---- .../impl/impl_as_named_constraint.carbon | 9 +- .../impl/impl_assoc_const_with_prelude.carbon | 4 +- .../impl/import_interface_assoc_const.carbon | 22 ++--- .../testdata/impl/import_self_specific.carbon | 4 +- .../check/testdata/impl/incomplete.carbon | 6 +- .../overloaded/index_with_prelude.carbon | 12 +-- 14 files changed, 133 insertions(+), 143 deletions(-) diff --git a/toolchain/check/context.h b/toolchain/check/context.h index 16404d9ddbe4..73902694293a 100644 --- a/toolchain/check/context.h +++ b/toolchain/check/context.h @@ -307,17 +307,13 @@ class Context { return binding_type_where_count_; } - auto declaring_impl_decls() -> llvm::SmallVector& { + struct DeclaringImplDecl { + SemIR::ConstantId self_id; + SemIR::SpecificInterface specific_interface; + }; + auto declaring_impl_decls() -> llvm::SmallVector& { return declaring_impl_decls_; } - // Returns the interface of the `impl` being declared, that `.Self` refers to, - // if any. - auto declaring_impl_for_interface() -> SemIR::SpecificInterface { - if (declaring_impl_decls_.empty()) { - return SemIR::SpecificInterface::None; - } - return declaring_impl_decls_.back(); - } // Data about a form expression. // @@ -616,10 +612,9 @@ class Context { int32_t binding_type_where_count_ = 0; // Track impl declarations that are underway. If we're declaring an impl for - // interface `I`, an impl lookup query for `.Self as I` should find that impl - // being declared (even though it does not yet exist). Since there can only be - // one `.Self` in scope, only the back of the vector needs to be consulted. - llvm::SmallVector declaring_impl_decls_; + // `C as I`, an impl lookup query for `C as I` or `.Self as I` should find + // that impl being declared (even though it does not yet exist). + llvm::SmallVector declaring_impl_decls_; // Declared return form for the in-progress function declaration, if any. std::optional return_form_expr_; diff --git a/toolchain/check/handle_impl.cpp b/toolchain/check/handle_impl.cpp index 26159e81f628..1f98b5398cb3 100644 --- a/toolchain/check/handle_impl.cpp +++ b/toolchain/check/handle_impl.cpp @@ -109,9 +109,11 @@ auto HandleParseNode(Context& context, Parse::ImplTypeAsId node_id) -> bool { AddNameToLookup(context, SemIR::NameId::SelfType, self_type.inst_id); context.node_stack().Push(node_id, self_type.inst_id); - // The value in here, if any, is populated by the `where` expression that - // introduces a `.Self` in the impl's constraint facet type. - context.declaring_impl_decls().push_back(SemIR::SpecificInterface::None); + // The specific interface in here, if any, is populated by the `where` + // expression that introduces a `.Self` in the impl's constraint facet type. + context.declaring_impl_decls().push_back( + {.self_id = self_type.type_id.AsConstantId(), + .specific_interface = SemIR::SpecificInterface::None}); return true; } @@ -145,9 +147,11 @@ auto HandleParseNode(Context& context, Parse::ImplDefaultSelfAsId node_id) // the parent class scope. context.node_stack().Push(node_id, self_inst_id); - // The value in here, if any, is populated by the `where` expression that - // introduces a `.Self` in the impl's constraint facet type. - context.declaring_impl_decls().push_back(SemIR::SpecificInterface::None); + // The specific interface in here, if any, is populated by the `where` + // expression that introduces a `.Self` in the impl's constraint facet type. + context.declaring_impl_decls().push_back( + {.self_id = context.constant_values().Get(self_inst_id), + .specific_interface = SemIR::SpecificInterface::None}); return true; } diff --git a/toolchain/check/handle_where.cpp b/toolchain/check/handle_where.cpp index abbe879a3f0b..3f87fecf0810 100644 --- a/toolchain/check/handle_where.cpp +++ b/toolchain/check/handle_where.cpp @@ -105,12 +105,12 @@ auto HandleParseNode(Context& context, Parse::WhereOperandId node_id) -> bool { const auto& identified = context.identified_facet_types().Get(identified_id); if (identified.is_valid_impl_as_target()) { - auto& decl_impl_interface = context.declaring_impl_decls().back(); - if (decl_impl_interface != SemIR::SpecificInterface::None) { - CARBON_CHECK(decl_impl_interface == + auto& declaring = context.declaring_impl_decls().back(); + if (declaring.specific_interface != SemIR::SpecificInterface::None) { + CARBON_CHECK(declaring.specific_interface == identified.impl_as_target_interface()); } - decl_impl_interface = identified.impl_as_target_interface(); + declaring.specific_interface = identified.impl_as_target_interface(); } } } diff --git a/toolchain/check/impl.cpp b/toolchain/check/impl.cpp index 142ca1b4ffef..3e6e5de4d0bd 100644 --- a/toolchain/check/impl.cpp +++ b/toolchain/check/impl.cpp @@ -395,25 +395,6 @@ auto AddImpl(Context& context, const SemIR::Impl& impl, return impl_id; } -// Returns whether the `LookupImplWitness` of `witness_id` is for the same -// specific interface as the impl decl's `impl_interface`. -static auto WitnessQueryMatchesInterface( - Context& context, SemIR::InstId access_witness_id, - const SemIR::SpecificInterface& impl_interface) -> bool { - // This condition catches witnesses from inside the impl declaration. - if (context.insts().Is(access_witness_id)) { - return true; - } - - // We also need to find witnesses for rewrites acquired through a named - // constraint. - auto lookup = - context.insts().GetAs(access_witness_id); - auto access_interface = - context.specific_interfaces().Get(lookup.query_specific_interface_id); - return access_interface == impl_interface; -} - auto AddImplWitnessForDeclaration(Context& context, SemIR::LocId loc_id, const SemIR::Impl& impl, SemIR::TypeInstId full_constraint_id, @@ -437,8 +418,7 @@ auto AddImplWitnessForDeclaration(Context& context, SemIR::LocId loc_id, [&](const SemIR::DeclaredFacetType::RewriteConstraint& rewrite) { auto access = context.insts().GetAs( GetImplWitnessAccessWithoutSubstitution(context, rewrite.lhs_id)); - return WitnessQueryMatchesInterface(context, access.witness_id, - impl.interface); + return context.insts().Is(access.witness_id); }); if (rewrites_into_interface_to_witness.empty()) { @@ -773,10 +753,10 @@ auto FinishImplWitness(Context& context, const SemIR::Impl& impl) -> void { // enclosing ImplWitnessAccess be resolved to the corresponding value from the // impl's witness table. static auto SubstImplSelfWitnesses(Context& context, SemIR::LocId loc_id, - SemIR::ConstantId const_id, + SemIR::IdentifiedFacetType::RequiredImpl req, SemIR::InterfaceId impl_interface_id, SemIR::InstId witness_id) - -> SemIR::ConstantId { + -> SemIR::IdentifiedFacetType::RequiredImpl { class Callbacks : public SubstInstCallbacks { public: explicit Callbacks(Context* context, SemIR::LocId loc_id, @@ -827,9 +807,24 @@ static auto SubstImplSelfWitnesses(Context& context, SemIR::LocId loc_id, }; Callbacks callbacks(&context, loc_id, impl_interface_id, witness_id); - auto inst_id = context.constant_values().GetInstId(const_id); - inst_id = SubstInst(context, inst_id, callbacks); - return context.constant_values().Get(inst_id); + + auto self_inst_id = context.constant_values().GetInstId(req.self_facet_value); + self_inst_id = SubstInst(context, self_inst_id, callbacks); + + auto specific_id = req.specific_interface.specific_id; + if (specific_id.has_value()) { + const auto& specific = context.specifics().Get(specific_id); + llvm::SmallVector args( + context.inst_blocks().Get(specific.args_id)); + for (auto& arg_id : args) { + arg_id = SubstInst(context, arg_id, callbacks); + } + specific_id = MakeSpecific(context, loc_id, specific.generic_id, args); + } + + return { + .self_facet_value = context.constant_values().Get(self_inst_id), + .specific_interface = {req.specific_interface.interface_id, specific_id}}; } auto CheckRequireDeclsSatisfied(Context& context, SemIR::LocId loc_id, @@ -850,25 +845,22 @@ auto CheckRequireDeclsSatisfied(Context& context, SemIR::LocId loc_id, auto self_const_id = GetCanonicalFacetOrTypeValue( context, context.constant_values().Get(impl.self_id)); - // Resolve any accesses in the declaration by using the impl's witness table, - // now that it exists. Since these accesses are in the declaration, they were - // originally checked before the `impl` existed. - auto subst_constraint_id = SubstImplSelfWitnesses( - context, loc_id, context.constant_values().Get(full_constraint_id), - impl.interface.interface_id, impl.witness_id); - // Any errors in the facet type will result in an error in the canonical value - // here. Don't diagnose anything more in the facet type. - if (subst_constraint_id == SemIR::ErrorInst::ConstantId) { - return; - } - - auto canon_constraint_id = - context.types().GetTypeInstIdForTypeConstantId(subst_constraint_id); - + // We already identified the `impl.self_id` as the canonical + // `full_constraint_id`, so this should just be a cache lookup and can't fail. + // + // This is critical because the identification constructs specifics in named + // constraints which may refer back to the impl itself through access of an + // associated constant. Those references back to the impl need to be + // represented as `ImplSelfWitness` which can only be done inside the impl + // declaration. It is too late to form those specifics here, we need to find + // the specifics formed during the impl declaration. + // // TODO: Consider a function that just forms the key and returns the ID for an // already-identified facet type? Or plumb through the IdentifiedFacetType? auto identified_id = TryToIdentifyFacetType( - context, loc_id, self_const_id, canon_constraint_id, + context, loc_id, context.constant_values().Get(impl.self_id), + context.constant_values().GetConstantTypeInstId( + context.types().GetAsTypeInstId(full_constraint_id)), /*allow_partially_identified=*/false); CARBON_CHECK(identified_id.has_value()); const auto& identified = context.identified_facet_types().Get(identified_id); @@ -878,6 +870,14 @@ auto CheckRequireDeclsSatisfied(Context& context, SemIR::LocId loc_id, // This is what the impl is implementing, so it's not already satisfied. continue; } + + // Resolve any accesses in the declaration by using the impl's witness + // table, now that it exists. Since these accesses are from an + // IdentifiedFacetType first constructed inside the impl declaration, they + // were originally evaluated before the impl existed. + req = SubstImplSelfWitnesses(context, loc_id, req, + impl.interface.interface_id, impl.witness_id); + auto result = LookupImplWitness( context, loc_id, req.self_facet_value, GetInterfaceType(context, req.specific_interface.interface_id, diff --git a/toolchain/check/impl_lookup.cpp b/toolchain/check/impl_lookup.cpp index ca7cf65d7650..4f5686fd9a63 100644 --- a/toolchain/check/impl_lookup.cpp +++ b/toolchain/check/impl_lookup.cpp @@ -29,6 +29,7 @@ #include "toolchain/sem_ir/ids.h" #include "toolchain/sem_ir/impl.h" #include "toolchain/sem_ir/inst.h" +#include "toolchain/sem_ir/specific_interface.h" #include "toolchain/sem_ir/type_iterator.h" #include "toolchain/sem_ir/typed_insts.h" @@ -946,15 +947,18 @@ static auto FindNonFinalWitness( // declared still. The result is a witness for that impl even though it does not // yet exist. static auto GetImplSelfWitnessInsideImplDecl( - Context& context, SemIR::LocId loc_id, - const SemIR::IdentifiedFacetType::RequiredImpl& req_impl, - bool require_period_self) -> SemIR::InstId { - if (req_impl.specific_interface != context.declaring_impl_for_interface()) { + Context& context, SemIR::LocId loc_id, SemIR::ConstantId self_facet_value, + SemIR::SpecificInterface specific_interface) -> SemIR::InstId { + if (context.declaring_impl_decls().empty()) { return SemIR::InstId::None; } - if (require_period_self && - !IsPeriodSelf(context, context.constant_values().GetInstId( - req_impl.self_facet_value))) { + const auto& declaring = context.declaring_impl_decls().back(); + if (specific_interface != declaring.specific_interface) { + return SemIR::InstId::None; + } + if (self_facet_value != declaring.self_id && + !IsPeriodSelf(context, + context.constant_values().GetInstId(self_facet_value))) { return SemIR::InstId::None; } @@ -963,10 +967,9 @@ static auto GetImplSelfWitnessInsideImplDecl( auto const_id = EvalOrAddInst( context, loc_id, {.type_id = GetSingletonType(context, SemIR::WitnessType::TypeInstId), - .period_self = - context.constant_values().GetInstId(req_impl.self_facet_value), + .period_self = context.constant_values().GetInstId(self_facet_value), .specific_interface_id = - context.specific_interfaces().Add(req_impl.specific_interface)}); + context.specific_interfaces().Add(specific_interface)}); return context.constant_values().GetInstId(const_id); } @@ -1029,21 +1032,11 @@ auto LookupImplWitness(Context& context, SemIR::LocId loc_id, // order of the interfaces in `req_impls`. llvm::SmallVector result_witness_ids; for (const auto& req_impl : req_impls) { - // If the lookup comes from inside an impl decl and is for that impl, get a - // witness for that impl even though it does not yet exist. - auto result_witness_id = GetImplSelfWitnessInsideImplDecl( - context, loc_id, req_impl, /*require_period_self=*/true); - if (result_witness_id.has_value()) { - // Found a final witness from inside an impl being declared, for itself. - result_witness_ids.push_back(result_witness_id); - continue; - } - // If the self facet contains a final witness for the required interface, we // use that and avoid any further work. This is strictly an optimization, // since that same final witness should be found by evaluating a // LookupImplWitness instruction for the required self+interface pair. - result_witness_id = FindFinalWitnessFromFacetValue( + auto result_witness_id = FindFinalWitnessFromFacetValue( context, witness_sources, req_impl.self_facet_value, req_impl.specific_interface); if (result_witness_id.has_value()) { @@ -1188,6 +1181,14 @@ auto EvalLookupSingleFinalWitness(Context& context, SemIR::LocId loc_id, SemIR::ConstantId query_self_const_id = context.constant_values().Get(eval_query.query_self_inst_id); + // If the lookup comes from inside an impl decl and is for that impl, get a + // witness for that impl even though it does not yet exist. + auto impl_self_witness_id = GetImplSelfWitnessInsideImplDecl( + context, loc_id, query_self_const_id, query_specific_interface); + if (impl_self_witness_id.has_value()) { + return context.constant_values().Get(impl_self_witness_id); + } + // If the query self is monomorphized as a FacetValue, we can't use its // witnesses in general, since we are not allowed to identify facet types in // monomorphization. And we need to identify it to know which witness is for @@ -1357,12 +1358,9 @@ auto MakeWitnessesForPeriodSelfTypeWithoutLookup(Context& context, llvm::SmallVector witness_ids; witness_ids.reserve(required_impls.size()); for (const auto& req_impl : required_impls) { - // We don't `require_period_self` because we are building witnesses for a - // `facet_value` that is replacing `.Self`. The identify was done with the - // `facet_value` which replaces `.Self`. But we know these witnesses should - // point to the impl being declared if they are for its target interface. auto result_witness_id = GetImplSelfWitnessInsideImplDecl( - context, loc_id, req_impl, /*require_period_self=*/false); + context, loc_id, req_impl.self_facet_value, + req_impl.specific_interface); if (result_witness_id.has_value()) { witness_ids.push_back(result_witness_id); continue; diff --git a/toolchain/check/testdata/facet/period_self.carbon b/toolchain/check/testdata/facet/period_self.carbon index d2aa59e5210a..a4a564cb6e75 100644 --- a/toolchain/check/testdata/facet/period_self.carbon +++ b/toolchain/check/testdata/facet/period_self.carbon @@ -816,7 +816,7 @@ interface Y(T: type) { // TODO: We crash if this impl is not generic, as the call to `.YF()` produces a // symbolic-dependent instruction, but there's no generic eval block for it. -// CHECK:STDERR: fail_todo_period_self_in_generic_argument.carbon:[[@LINE+4]]:60: error: cannot convert type `` that implements `Z where .(Z.Z1) = ()` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] +// CHECK:STDERR: fail_todo_period_self_in_generic_argument.carbon:[[@LINE+4]]:60: error: cannot convert type `` that implements `Z where .(Z.Z1) = ()` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] // CHECK:STDERR: impl forall [T: type] T as Y(Z where .Z1 = ()) where .Y1 = .YF() {} // CHECK:STDERR: ^~~~~ // CHECK:STDERR: diff --git a/toolchain/check/testdata/for/actual.carbon b/toolchain/check/testdata/for/actual.carbon index 02bdc86f4bb8..2c02f0f7a974 100644 --- a/toolchain/check/testdata/for/actual.carbon +++ b/toolchain/check/testdata/for/actual.carbon @@ -110,7 +110,7 @@ fn Read(generic y: Core.IntLiteral) { // CHECK:STDOUT: %.327: = impl_self_witness %.Self.500, @Iterate [symbolic_self] // CHECK:STDOUT: %impl.elem1.4a6: %Destroy.type = impl_witness_access %.327, element1 [symbolic_self] // CHECK:STDOUT: %impl.elem0.188: %facet_type.f48 = impl_witness_access %.327, element0 [symbolic_self] -// CHECK:STDOUT: %Iterate_where.type.131: type = facet_type <@Iterate where %impl.elem1.4a6 = %Destroy.facet.7bb and %impl.elem0.188 = %facet_value> [symbolic] +// CHECK:STDOUT: %Iterate_where.type: type = facet_type <@Iterate where %impl.elem1.4a6 = %Destroy.facet.7bb and %impl.elem0.188 = %facet_value> [symbolic] // CHECK:STDOUT: %.84c: = impl_self_witness %IntRange.2c4, @Iterate [symbolic] // CHECK:STDOUT: %Iterate.impl_witness: = impl_witness @IntRange.as.Iterate.impl.%Iterate.impl_witness_table, @IntRange.as.Iterate.impl(%N) [symbolic] // CHECK:STDOUT: %self.param_patt.5cc: %pattern_type.1ea = value_param_pattern [symbolic] @@ -329,7 +329,7 @@ fn Read(generic y: Core.IntLiteral) { // CHECK:STDOUT: %.loc9_85.1: require_specific_def_type = require_specific_def @Int.as.Copy.impl(%N) [symbolic = %.loc9_85.1 (constants.%.a53)] // CHECK:STDOUT: %Copy.lookup_impl_witness: = lookup_impl_witness %Int.loc9_54.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.df6)] // CHECK:STDOUT: %facet_value.loc9_85.1: %facet_type.f48 = facet_value %Int.loc9_54.1, (%Destroy.lookup_impl_witness, %Copy.lookup_impl_witness) [symbolic = %facet_value.loc9_85.1 (constants.%facet_value)] -// CHECK:STDOUT: %Iterate_where.type: type = facet_type <@Iterate where constants.%impl.elem1.4a6 = %Destroy.facet.loc9_54.1 and constants.%impl.elem0.188 = %facet_value.loc9_85.1> [symbolic = %Iterate_where.type (constants.%Iterate_where.type.131)] +// CHECK:STDOUT: %Iterate_where.type: type = facet_type <@Iterate where constants.%impl.elem1.4a6 = %Destroy.facet.loc9_54.1 and constants.%impl.elem0.188 = %facet_value.loc9_85.1> [symbolic = %Iterate_where.type (constants.%Iterate_where.type)] // CHECK:STDOUT: %.loc9_87: = impl_self_witness %IntRange, @Iterate [symbolic = %.loc9_87 (constants.%.84c)] // CHECK:STDOUT: %Iterate.impl_witness.loc9_87.2: = impl_witness %Iterate.impl_witness_table, @IntRange.as.Iterate.impl(%N) [symbolic = %Iterate.impl_witness.loc9_87.2 (constants.%Iterate.impl_witness)] // CHECK:STDOUT: @@ -492,7 +492,7 @@ fn Read(generic y: Core.IntLiteral) { // CHECK:STDOUT: %rewrite.loc9_42.2 = requirement_rewrite %impl.elem1.loc9_30.2, %.loc9_54 [concrete] // CHECK:STDOUT: %impl.elem0.loc9_60.2: %facet_type.f48 = impl_witness_access constants.%.327, element0 [symbolic_self = constants.%impl.elem0.188] // CHECK:STDOUT: %rewrite.loc9_73.2 = requirement_rewrite %impl.elem0.loc9_60.2, %.loc9_85.2 [concrete] -// CHECK:STDOUT: %.loc9_24: type = where_expr [symbolic = %Iterate_where.type (constants.%Iterate_where.type.131)] { +// CHECK:STDOUT: %.loc9_24: type = where_expr [symbolic = %Iterate_where.type (constants.%Iterate_where.type)] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %Iterate.ref [concrete] // CHECK:STDOUT: %rewrite.loc9_42.2 = requirement_rewrite %impl.elem1.loc9_30.2, %.loc9_54 [concrete] // CHECK:STDOUT: %rewrite.loc9_73.2 = requirement_rewrite %impl.elem0.loc9_60.2, %.loc9_85.2 [concrete] @@ -864,7 +864,7 @@ fn Read(generic y: Core.IntLiteral) { // CHECK:STDOUT: %.loc9_85.1 => constants.%.a53 // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.df6 // CHECK:STDOUT: %facet_value.loc9_85.1 => constants.%facet_value -// CHECK:STDOUT: %Iterate_where.type => constants.%Iterate_where.type.131 +// CHECK:STDOUT: %Iterate_where.type => constants.%Iterate_where.type // CHECK:STDOUT: %.loc9_87 => constants.%.84c // CHECK:STDOUT: %Iterate.impl_witness.loc9_87.2 => constants.%Iterate.impl_witness // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/forward_decls.carbon b/toolchain/check/testdata/impl/forward_decls.carbon index 600db94e952c..1b38163aaaab 100644 --- a/toolchain/check/testdata/impl/forward_decls.carbon +++ b/toolchain/check/testdata/impl/forward_decls.carbon @@ -515,7 +515,7 @@ impl C as Y {} // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.00f: = impl_self_witness %.Self, @I [symbolic_self] // CHECK:STDOUT: %impl.elem0.c0c: type = impl_witness_access %.00f, element0 [symbolic_self] -// CHECK:STDOUT: %I_where.type.d99: type = facet_type <@I where %impl.elem0.c0c = %empty_tuple.type> [concrete] +// CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0.c0c = %empty_tuple.type> [concrete] // CHECK:STDOUT: %.aaf: = impl_self_witness %empty_struct_type, @I [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness @empty_struct_type.as.I.impl.%I.impl_witness_table [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %empty_struct_type, (%I.impl_witness) [concrete] @@ -551,7 +551,7 @@ impl C as Y {} // CHECK:STDOUT: %rewrite.loc6_23.1 = requirement_rewrite %impl.elem0.loc6_20.1, %.loc6_26.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc6_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %rewrite.loc6_23.2 = requirement_rewrite %impl.elem0.loc6_20.2, %.loc6_26.2 [concrete] -// CHECK:STDOUT: %.loc6_14: type = where_expr [concrete = constants.%I_where.type.d99] { +// CHECK:STDOUT: %.loc6_14: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type.loc6 = requirement_base_facet_type %I.ref.loc6 [concrete] // CHECK:STDOUT: %rewrite.loc6_23.2 = requirement_rewrite %impl.elem0.loc6_20.2, %.loc6_26.2 [concrete] // CHECK:STDOUT: } @@ -573,7 +573,7 @@ impl C as Y {} // CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, %.loc8_26.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc8_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] -// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = constants.%I_where.type.d99] { +// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type.loc8 = requirement_base_facet_type %I.ref.loc8 [concrete] // CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] // CHECK:STDOUT: } @@ -639,7 +639,7 @@ impl C as Y {} // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.00f: = impl_self_witness %.Self, @I [symbolic_self] // CHECK:STDOUT: %impl.elem0.c0c: type = impl_witness_access %.00f, element0 [symbolic_self] -// CHECK:STDOUT: %I_where.type.d99: type = facet_type <@I where %impl.elem0.c0c = %empty_tuple.type> [concrete] +// CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0.c0c = %empty_tuple.type> [concrete] // CHECK:STDOUT: %.b7f: = impl_self_witness %C, @I [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness @C.as.I.impl.%I.impl_witness_table [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete] @@ -679,7 +679,7 @@ impl C as Y {} // CHECK:STDOUT: %rewrite.loc7_22.1 = requirement_rewrite %impl.elem0.loc7_19.1, %.loc7_25.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc7_19.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %rewrite.loc7_22.2 = requirement_rewrite %impl.elem0.loc7_19.2, %.loc7_25.2 [concrete] -// CHECK:STDOUT: %.loc7_13: type = where_expr [concrete = constants.%I_where.type.d99] { +// CHECK:STDOUT: %.loc7_13: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type.loc7 = requirement_base_facet_type %I.ref.loc7 [concrete] // CHECK:STDOUT: %rewrite.loc7_22.2 = requirement_rewrite %impl.elem0.loc7_19.2, %.loc7_25.2 [concrete] // CHECK:STDOUT: } @@ -714,7 +714,7 @@ impl C as Y {} // CHECK:STDOUT: %rewrite.loc11_22.1 = requirement_rewrite %impl.elem0.loc11_19.1, %.loc11_25.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc11_19.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %rewrite.loc11_22.2 = requirement_rewrite %impl.elem0.loc11_19.2, %.loc11_25.2 [concrete] -// CHECK:STDOUT: %.loc11_13: type = where_expr [concrete = constants.%I_where.type.d99] { +// CHECK:STDOUT: %.loc11_13: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type.loc11 = requirement_base_facet_type %I.ref.loc11 [concrete] // CHECK:STDOUT: %rewrite.loc11_22.2 = requirement_rewrite %impl.elem0.loc11_19.2, %.loc11_25.2 [concrete] // CHECK:STDOUT: } @@ -794,7 +794,7 @@ impl C as Y {} // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.00f: = impl_self_witness %.Self, @I [symbolic_self] // CHECK:STDOUT: %impl.elem0.c0c: type = impl_witness_access %.00f, element0 [symbolic_self] -// CHECK:STDOUT: %I_where.type.d99: type = facet_type <@I where %impl.elem0.c0c = %empty_tuple.type> [concrete] +// CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0.c0c = %empty_tuple.type> [concrete] // CHECK:STDOUT: %.b7f: = impl_self_witness %C, @I [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness @C.as.I.impl.%I.impl_witness_table [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete] @@ -834,7 +834,7 @@ impl C as Y {} // CHECK:STDOUT: %rewrite.loc7_22.1 = requirement_rewrite %impl.elem0.loc7_19.1, %.loc7_25.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc7_19.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %rewrite.loc7_22.2 = requirement_rewrite %impl.elem0.loc7_19.2, %.loc7_25.2 [concrete] -// CHECK:STDOUT: %.loc7_13: type = where_expr [concrete = constants.%I_where.type.d99] { +// CHECK:STDOUT: %.loc7_13: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type.loc7 = requirement_base_facet_type %I.ref.loc7 [concrete] // CHECK:STDOUT: %rewrite.loc7_22.2 = requirement_rewrite %impl.elem0.loc7_19.2, %.loc7_25.2 [concrete] // CHECK:STDOUT: } @@ -871,7 +871,7 @@ impl C as Y {} // CHECK:STDOUT: %rewrite.loc11_22.1 = requirement_rewrite %impl.elem0.loc11_19.1, %.loc11_25.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc11_19.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %rewrite.loc11_22.2 = requirement_rewrite %impl.elem0.loc11_19.2, %.loc11_25.2 [concrete] -// CHECK:STDOUT: %.loc11_13: type = where_expr [concrete = constants.%I_where.type.d99] { +// CHECK:STDOUT: %.loc11_13: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type.loc11 = requirement_base_facet_type %I.ref.loc11 [concrete] // CHECK:STDOUT: %rewrite.loc11_22.2 = requirement_rewrite %impl.elem0.loc11_19.2, %.loc11_25.2 [concrete] // CHECK:STDOUT: } @@ -1178,7 +1178,7 @@ impl C as Y {} // CHECK:STDOUT: %.Self: %I.type.c9e = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.b67: = impl_self_witness %.Self, @I, @I(%C) [symbolic_self] // CHECK:STDOUT: %impl.elem0.f8c: type = impl_witness_access %.b67, element0 [symbolic_self] -// CHECK:STDOUT: %I_where.type.52d: type = facet_type <@I, @I(%C) where %impl.elem0.f8c = %C> [concrete] +// CHECK:STDOUT: %I_where.type: type = facet_type <@I, @I(%C) where %impl.elem0.f8c = %C> [concrete] // CHECK:STDOUT: %.fd4: = impl_self_witness %D, @I, @I(%C) [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness @D.as.I.impl.%I.impl_witness_table [concrete] // CHECK:STDOUT: %I.facet: %I.type.c9e = facet_value %D, (%I.impl_witness) [concrete] @@ -1227,7 +1227,7 @@ impl C as Y {} // CHECK:STDOUT: %rewrite.loc8_25.1 = requirement_rewrite %impl.elem0.loc8_22.1, %C.ref.loc8_27 [concrete] // CHECK:STDOUT: %impl.elem0.loc8_22.2: type = impl_witness_access constants.%.b67, element0 [symbolic_self = constants.%impl.elem0.f8c] // CHECK:STDOUT: %rewrite.loc8_25.2 = requirement_rewrite %impl.elem0.loc8_22.2, %C.ref.loc8_27 [concrete] -// CHECK:STDOUT: %.loc8_16: type = where_expr [concrete = constants.%I_where.type.52d] { +// CHECK:STDOUT: %.loc8_16: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type.loc8 = requirement_base_facet_type %I.type.loc8 [concrete] // CHECK:STDOUT: %rewrite.loc8_25.2 = requirement_rewrite %impl.elem0.loc8_22.2, %C.ref.loc8_27 [concrete] // CHECK:STDOUT: } @@ -1251,7 +1251,7 @@ impl C as Y {} // CHECK:STDOUT: %rewrite.loc11_25.1 = requirement_rewrite %impl.elem0.loc11_22.1, %C.ref.loc11_27 [concrete] // CHECK:STDOUT: %impl.elem0.loc11_22.2: type = impl_witness_access constants.%.b67, element0 [symbolic_self = constants.%impl.elem0.f8c] // CHECK:STDOUT: %rewrite.loc11_25.2 = requirement_rewrite %impl.elem0.loc11_22.2, %C.ref.loc11_27 [concrete] -// CHECK:STDOUT: %.loc11_16: type = where_expr [concrete = constants.%I_where.type.52d] { +// CHECK:STDOUT: %.loc11_16: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type.loc11 = requirement_base_facet_type %I.type.loc11 [concrete] // CHECK:STDOUT: %rewrite.loc11_25.2 = requirement_rewrite %impl.elem0.loc11_22.2, %C.ref.loc11_27 [concrete] // CHECK:STDOUT: } @@ -1625,7 +1625,7 @@ impl C as Y {} // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.00f: = impl_self_witness %.Self, @I [symbolic_self] // CHECK:STDOUT: %impl.elem0.c0c: type = impl_witness_access %.00f, element0 [symbolic_self] -// CHECK:STDOUT: %I_where.type.d99: type = facet_type <@I where %impl.elem0.c0c = %empty_tuple.type> [concrete] +// CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0.c0c = %empty_tuple.type> [concrete] // CHECK:STDOUT: %.b7f: = impl_self_witness %C, @I [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness @C.as.I.impl.%I.impl_witness_table [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete] @@ -1662,7 +1662,7 @@ impl C as Y {} // CHECK:STDOUT: %rewrite.loc9_22.1 = requirement_rewrite %impl.elem0.loc9_19.1, %.loc9_25.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc9_19.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %rewrite.loc9_22.2 = requirement_rewrite %impl.elem0.loc9_19.2, %.loc9_25.2 [concrete] -// CHECK:STDOUT: %.loc9_13: type = where_expr [concrete = constants.%I_where.type.d99] { +// CHECK:STDOUT: %.loc9_13: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type.loc9 = requirement_base_facet_type %I.ref.loc9 [concrete] // CHECK:STDOUT: %rewrite.loc9_22.2 = requirement_rewrite %impl.elem0.loc9_19.2, %.loc9_25.2 [concrete] // CHECK:STDOUT: } @@ -1683,7 +1683,7 @@ impl C as Y {} // CHECK:STDOUT: %rewrite.loc18_22.1 = requirement_rewrite %impl.elem0.loc18_19.1, %.loc18_25.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc18_19.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %rewrite.loc18_22.2 = requirement_rewrite %impl.elem0.loc18_19.2, %.loc18_25.2 [concrete] -// CHECK:STDOUT: %.loc18_13: type = where_expr [concrete = constants.%I_where.type.d99] { +// CHECK:STDOUT: %.loc18_13: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type.loc18 = requirement_base_facet_type %I.ref.loc18 [concrete] // CHECK:STDOUT: %rewrite.loc18_22.2 = requirement_rewrite %impl.elem0.loc18_19.2, %.loc18_25.2 [concrete] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/impl_as_named_constraint.carbon b/toolchain/check/testdata/impl/impl_as_named_constraint.carbon index d127f975add8..0a10bc002a9a 100644 --- a/toolchain/check/testdata/impl/impl_as_named_constraint.carbon +++ b/toolchain/check/testdata/impl/impl_as_named_constraint.carbon @@ -313,7 +313,7 @@ constraint Y { // CHECK:STDERR: impl () as Y {} -// --- fail_todo_member_access_in_extend_require.carbon +// --- member_access_in_extend_require.carbon library "[[@TEST_NAME]]"; interface I { let X: type; } @@ -332,13 +332,6 @@ constraint GivesI { // - Deduces for Self which tries to convert Self to type // - Requires the type of Self to be complete, and its type is GivesI // - Forms the self-specfic for GivesI's extend require....we have a loop. -// -// TODO: .X = () should satisfy the requirement that .X impls J. We're not -// finding the rewrite when checking requirements. -// CHECK:STDERR: fail_todo_member_access_in_extend_require.carbon:[[@LINE+4]]:1: error: constraint `GivesI where .(I.X) = ()` being implemented requires that `T.(I.X)` implements `J` [IdentifiedRequireImplsNotImplemented] -// CHECK:STDERR: impl forall [T: type] T as GivesI where .X = () {} -// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// CHECK:STDERR: impl forall [T: type] T as GivesI where .X = () {} // CHECK:STDOUT: --- fail_error_self_in_require.carbon diff --git a/toolchain/check/testdata/impl/impl_assoc_const_with_prelude.carbon b/toolchain/check/testdata/impl/impl_assoc_const_with_prelude.carbon index 904fb524bc8e..f6d65a2e9cc2 100644 --- a/toolchain/check/testdata/impl/impl_assoc_const_with_prelude.carbon +++ b/toolchain/check/testdata/impl/impl_assoc_const_with_prelude.carbon @@ -105,7 +105,7 @@ impl () as I where .X = {.a = true, .b = (1, 2)} and .X = {.a = false, .b = (3, // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.00f: = impl_self_witness %.Self, @I [symbolic_self] // CHECK:STDOUT: %impl.elem0.b6e: %struct_type.a.b.486 = impl_witness_access %.00f, element0 [symbolic_self] -// CHECK:STDOUT: %I_where.type.58a: type = facet_type <@I where %impl.elem0.b6e = %struct.247> [concrete] +// CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0.b6e = %struct.247> [concrete] // CHECK:STDOUT: %.2ef: = impl_self_witness %empty_tuple.type, @I [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness @empty_tuple.type.as.I.impl.%I.impl_witness_table [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %empty_tuple.type, (%I.impl_witness) [concrete] @@ -226,7 +226,7 @@ impl () as I where .X = {.a = true, .b = (1, 2)} and .X = {.a = false, .b = (3, // CHECK:STDOUT: %impl.elem0.loc6_54.2: %struct_type.a.b.486 = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.b6e] // CHECK:STDOUT: %impl.elem0.subst.loc6_54.2: %struct_type.a.b.486 = impl_witness_access_substituted %impl.elem0.loc6_54.2, %.loc6_48.3 [concrete = constants.%struct.247] // CHECK:STDOUT: %rewrite.loc6_57.2 = requirement_rewrite %impl.elem0.subst.loc6_54.2, %.loc6_95.3 [concrete] -// CHECK:STDOUT: %.loc6_14: type = where_expr [concrete = constants.%I_where.type.58a] { +// CHECK:STDOUT: %.loc6_14: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %rewrite.loc6_23.2 = requirement_rewrite %impl.elem0.loc6_20.2, %.loc6_48.3 [concrete] // CHECK:STDOUT: %rewrite.loc6_57.2 = requirement_rewrite %impl.elem0.subst.loc6_54.2, %.loc6_95.3 [concrete] diff --git a/toolchain/check/testdata/impl/import_interface_assoc_const.carbon b/toolchain/check/testdata/impl/import_interface_assoc_const.carbon index a24b11107265..70ae5c95c866 100644 --- a/toolchain/check/testdata/impl/import_interface_assoc_const.carbon +++ b/toolchain/check/testdata/impl/import_interface_assoc_const.carbon @@ -317,7 +317,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.00f: = impl_self_witness %.Self, @I [symbolic_self] // CHECK:STDOUT: %impl.elem0.c0c: type = impl_witness_access %.00f, element0 [symbolic_self] -// CHECK:STDOUT: %I_where.type.c16: type = facet_type <@I where %impl.elem0.c0c = %empty_struct_type> [concrete] +// CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0.c0c = %empty_struct_type> [concrete] // CHECK:STDOUT: %.169: = impl_self_witness %C1, @I [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness @C1.as.I.impl.%I.impl_witness_table [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C1, (%I.impl_witness) [concrete] @@ -358,7 +358,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %rewrite.loc5_23.1 = requirement_rewrite %impl.elem0.loc5_20.1, %.loc5_26.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc5_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %rewrite.loc5_23.2 = requirement_rewrite %impl.elem0.loc5_20.2, %.loc5_26.2 [concrete] -// CHECK:STDOUT: %.loc5_14: type = where_expr [concrete = constants.%I_where.type.c16] { +// CHECK:STDOUT: %.loc5_14: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %rewrite.loc5_23.2 = requirement_rewrite %impl.elem0.loc5_20.2, %.loc5_26.2 [concrete] // CHECK:STDOUT: } @@ -423,7 +423,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.00f: = impl_self_witness %.Self, @I [symbolic_self] // CHECK:STDOUT: %impl.elem0.c0c: type = impl_witness_access %.00f, element0 [symbolic_self] -// CHECK:STDOUT: %I_where.type.c16: type = facet_type <@I where %impl.elem0.c0c = %empty_struct_type> [concrete] +// CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0.c0c = %empty_struct_type> [concrete] // CHECK:STDOUT: %.bd3: = impl_self_witness %C2, @I [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness @C2.as.I.impl.%I.impl_witness_table [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C2, (%I.impl_witness) [concrete] @@ -464,7 +464,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %rewrite.loc5_23.1 = requirement_rewrite %impl.elem0.loc5_20.1, %.loc5_26.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc5_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %rewrite.loc5_23.2 = requirement_rewrite %impl.elem0.loc5_20.2, %.loc5_26.2 [concrete] -// CHECK:STDOUT: %.loc5_14: type = where_expr [concrete = constants.%I_where.type.c16] { +// CHECK:STDOUT: %.loc5_14: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type.loc5 = requirement_base_facet_type %I.ref.loc5 [concrete] // CHECK:STDOUT: %rewrite.loc5_23.2 = requirement_rewrite %impl.elem0.loc5_20.2, %.loc5_26.2 [concrete] // CHECK:STDOUT: } @@ -485,7 +485,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %rewrite.loc6_23.1 = requirement_rewrite %impl.elem0.loc6_20.1, %.loc6_26.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc6_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %rewrite.loc6_23.2 = requirement_rewrite %impl.elem0.loc6_20.2, %.loc6_26.2 [concrete] -// CHECK:STDOUT: %.loc6_14: type = where_expr [concrete = constants.%I_where.type.c16] { +// CHECK:STDOUT: %.loc6_14: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type.loc6 = requirement_base_facet_type %I.ref.loc6 [concrete] // CHECK:STDOUT: %rewrite.loc6_23.2 = requirement_rewrite %impl.elem0.loc6_20.2, %.loc6_26.2 [concrete] // CHECK:STDOUT: } @@ -551,7 +551,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.00f: = impl_self_witness %.Self, @I [symbolic_self] // CHECK:STDOUT: %impl.elem0.c0c: type = impl_witness_access %.00f, element0 [symbolic_self] -// CHECK:STDOUT: %I_where.type.c16: type = facet_type <@I where %impl.elem0.c0c = %empty_struct_type> [concrete] +// CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0.c0c = %empty_struct_type> [concrete] // CHECK:STDOUT: %I.impl_witness.877: = impl_witness @C3.as.I.impl.a518fc.2.%I.impl_witness_table [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C3, (%I.impl_witness.877) [concrete] // CHECK:STDOUT: } @@ -596,7 +596,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %rewrite.loc10_23.1 = requirement_rewrite %impl.elem0.loc10_20.1, %.loc10_26.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc10_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, %.loc10_26.2 [concrete] -// CHECK:STDOUT: %.loc10_14: type = where_expr [concrete = constants.%I_where.type.c16] { +// CHECK:STDOUT: %.loc10_14: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, %.loc10_26.2 [concrete] // CHECK:STDOUT: } @@ -1512,7 +1512,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.00f: = impl_self_witness %.Self, @I [symbolic_self] // CHECK:STDOUT: %impl.elem0.c0c: type = impl_witness_access %.00f, element0 [symbolic_self] -// CHECK:STDOUT: %I_where.type.c16: type = facet_type <@I where %impl.elem0.c0c = %empty_struct_type> [concrete] +// CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0.c0c = %empty_struct_type> [concrete] // CHECK:STDOUT: %.160: = impl_self_witness %CB, @I [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness @CB.as.I.impl.%I.impl_witness_table [concrete] // CHECK:STDOUT: %I.facet: %I.type = facet_value %CB, (%I.impl_witness) [concrete] @@ -1565,7 +1565,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %impl.elem0.loc6_32.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] // CHECK:STDOUT: %impl.elem0.subst.loc6_32.2: type = impl_witness_access_substituted %impl.elem0.loc6_32.2, %.loc6_26.2 [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %rewrite.loc6_35.2 = requirement_rewrite %impl.elem0.subst.loc6_32.2, %.loc6_38.2 [concrete] -// CHECK:STDOUT: %.loc6_14: type = where_expr [concrete = constants.%I_where.type.c16] { +// CHECK:STDOUT: %.loc6_14: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %rewrite.loc6_23.2 = requirement_rewrite %impl.elem0.loc6_20.2, %.loc6_26.2 [concrete] // CHECK:STDOUT: %rewrite.loc6_35.2 = requirement_rewrite %impl.elem0.subst.loc6_32.2, %.loc6_38.2 [concrete] @@ -1633,7 +1633,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %.Self: %NonType.type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.92a: = impl_self_witness %.Self, @NonType [symbolic_self] // CHECK:STDOUT: %impl.elem0.74f: %struct_type.a.225 = impl_witness_access %.92a, element0 [symbolic_self] -// CHECK:STDOUT: %NonType_where.type.182: type = facet_type <@NonType where %impl.elem0.74f = %struct> [concrete] +// CHECK:STDOUT: %NonType_where.type: type = facet_type <@NonType where %impl.elem0.74f = %struct> [concrete] // CHECK:STDOUT: %.910: = impl_self_witness %CC, @NonType [concrete] // CHECK:STDOUT: %NonType.impl_witness: = impl_witness @CC.as.NonType.impl.%NonType.impl_witness_table [concrete] // CHECK:STDOUT: %NonType.facet: %NonType.type = facet_value %CC, (%NonType.impl_witness) [concrete] @@ -1678,7 +1678,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %rewrite.loc6_29.1 = requirement_rewrite %impl.elem0.loc6_26.1, %.loc6_39.3 [concrete] // CHECK:STDOUT: %impl.elem0.loc6_26.2: %struct_type.a.225 = impl_witness_access constants.%.92a, element0 [symbolic_self = constants.%impl.elem0.74f] // CHECK:STDOUT: %rewrite.loc6_29.2 = requirement_rewrite %impl.elem0.loc6_26.2, %.loc6_39.3 [concrete] -// CHECK:STDOUT: %.loc6_20: type = where_expr [concrete = constants.%NonType_where.type.182] { +// CHECK:STDOUT: %.loc6_20: type = where_expr [concrete = constants.%NonType_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %NonType.ref [concrete] // CHECK:STDOUT: %rewrite.loc6_29.2 = requirement_rewrite %impl.elem0.loc6_26.2, %.loc6_39.3 [concrete] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/import_self_specific.carbon b/toolchain/check/testdata/impl/import_self_specific.carbon index 51cf3f10d1b0..095689096408 100644 --- a/toolchain/check/testdata/impl/import_self_specific.carbon +++ b/toolchain/check/testdata/impl/import_self_specific.carbon @@ -418,7 +418,7 @@ impl forall [N: E] D(N) as I where .Assoc = () { // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.00f: = impl_self_witness %.Self, @I [symbolic_self] // CHECK:STDOUT: %impl.elem0.e02: %Y.type = impl_witness_access %.00f, element0 [symbolic_self] -// CHECK:STDOUT: %I_where.type.4ba: type = facet_type <@I where %impl.elem0.e02 = %Y.facet> [concrete] +// CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0.e02 = %Y.facet> [concrete] // CHECK:STDOUT: %.a26: = impl_self_witness %D, @I [symbolic] // CHECK:STDOUT: %I.impl_witness: = impl_witness @D.as.I.impl.%I.impl_witness_table, @D.as.I.impl(%N) [symbolic] // CHECK:STDOUT: %.78e: = impl_self_witness %empty_tuple.type, @Z [concrete] @@ -506,7 +506,7 @@ impl forall [N: E] D(N) as I where .Assoc = () { // CHECK:STDOUT: %rewrite.loc20_43.1 = requirement_rewrite %impl.elem0.loc20_36.1, %.loc20_46.2 [concrete] // CHECK:STDOUT: %impl.elem0.loc20_36.2: %Y.type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.e02] // CHECK:STDOUT: %rewrite.loc20_43.2 = requirement_rewrite %impl.elem0.loc20_36.2, %.loc20_46.2 [concrete] -// CHECK:STDOUT: %.loc20_30: type = where_expr [concrete = constants.%I_where.type.4ba] { +// CHECK:STDOUT: %.loc20_30: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %rewrite.loc20_43.2 = requirement_rewrite %impl.elem0.loc20_36.2, %.loc20_46.2 [concrete] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/incomplete.carbon b/toolchain/check/testdata/impl/incomplete.carbon index 4b69603c4143..725beaf01a4d 100644 --- a/toolchain/check/testdata/impl/incomplete.carbon +++ b/toolchain/check/testdata/impl/incomplete.carbon @@ -579,7 +579,7 @@ interface B { // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self] // CHECK:STDOUT: %.b2e: = impl_self_witness %.Self, @J [symbolic_self] // CHECK:STDOUT: %impl.elem0.4f1: type = impl_witness_access %.b2e, element0 [symbolic_self] -// CHECK:STDOUT: %J_where.type.297: type = facet_type <@J where .Self impls @Incomplete and %impl.elem0.4f1 = %empty_tuple.type> [concrete] +// CHECK:STDOUT: %J_where.type: type = facet_type <@J where .Self impls @Incomplete and %impl.elem0.4f1 = %empty_tuple.type> [concrete] // CHECK:STDOUT: %.ffd: = impl_self_witness %C, @J [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness @C.as.J.impl.%J.impl_witness_table [concrete] // CHECK:STDOUT: %Self.d08: %Incomplete.type = symbolic_binding Self, 0 [symbolic] @@ -623,7 +623,7 @@ interface B { // CHECK:STDOUT: %impls.loc8_25.2 = requirement_impls %.loc8_19.2, %Incomplete.ref.loc8 [concrete] // CHECK:STDOUT: %impl.elem0.loc8_46.2: type = impl_witness_access constants.%.b2e, element0 [symbolic_self = constants.%impl.elem0.4f1] // CHECK:STDOUT: %rewrite.loc8_49.2 = requirement_rewrite %impl.elem0.loc8_46.2, %.loc8_52.2 [concrete] -// CHECK:STDOUT: %.loc8_13: type = where_expr [concrete = constants.%J_where.type.297] { +// CHECK:STDOUT: %.loc8_13: type = where_expr [concrete = constants.%J_where.type] { // CHECK:STDOUT: %base_facet_type.loc8 = requirement_base_facet_type %J.ref.loc8 [concrete] // CHECK:STDOUT: %impls.loc8_25.2 = requirement_impls %.loc8_19.2, %Incomplete.ref.loc8 [concrete] // CHECK:STDOUT: %rewrite.loc8_49.2 = requirement_rewrite %impl.elem0.loc8_46.2, %.loc8_52.2 [concrete] @@ -661,7 +661,7 @@ interface B { // CHECK:STDOUT: %impls.loc13_25.2 = requirement_impls %.loc13_19.2, %Incomplete.ref.loc13 [concrete] // CHECK:STDOUT: %impl.elem0.loc13_46.2: type = impl_witness_access constants.%.b2e, element0 [symbolic_self = constants.%impl.elem0.4f1] // CHECK:STDOUT: %rewrite.loc13_49.2 = requirement_rewrite %impl.elem0.loc13_46.2, %.loc13_52.2 [concrete] -// CHECK:STDOUT: %.loc13_13: type = where_expr [concrete = constants.%J_where.type.297] { +// CHECK:STDOUT: %.loc13_13: type = where_expr [concrete = constants.%J_where.type] { // CHECK:STDOUT: %base_facet_type.loc13 = requirement_base_facet_type %J.ref.loc13 [concrete] // CHECK:STDOUT: %impls.loc13_25.2 = requirement_impls %.loc13_19.2, %Incomplete.ref.loc13 [concrete] // CHECK:STDOUT: %rewrite.loc13_49.2 = requirement_rewrite %impl.elem0.loc13_46.2, %.loc13_52.2 [concrete] diff --git a/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon b/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon index d329bb9702ae..09d55e959138 100644 --- a/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon +++ b/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon @@ -106,7 +106,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %.Self: %IndexWith.type.d74 = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.300: = impl_self_witness %.Self, @IndexWith, @IndexWith(%SubscriptType.f8f) [symbolic_self] // CHECK:STDOUT: %impl.elem0.55a: type = impl_witness_access %.300, element0 [symbolic_self] -// CHECK:STDOUT: %IndexWith_where.type.192: type = facet_type <@IndexWith, @IndexWith(%SubscriptType.f8f) where %impl.elem0.55a = %ElementType> [concrete] +// CHECK:STDOUT: %IndexWith_where.type: type = facet_type <@IndexWith, @IndexWith(%SubscriptType.f8f) where %impl.elem0.55a = %ElementType> [concrete] // CHECK:STDOUT: %.769: = impl_self_witness %C, @IndexWith, @IndexWith(%SubscriptType.f8f) [concrete] // CHECK:STDOUT: %IndexWith.impl_witness: = impl_witness @C.as.IndexWith.impl.%IndexWith.impl_witness_table [concrete] // CHECK:STDOUT: %pattern_type.98b: type = pattern_type %C [concrete] @@ -180,7 +180,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %rewrite.loc8_60.1 = requirement_rewrite %impl.elem0.loc8_47.1, %ElementType.ref.loc8_62 [concrete] // CHECK:STDOUT: %impl.elem0.loc8_47.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.55a] // CHECK:STDOUT: %rewrite.loc8_60.2 = requirement_rewrite %impl.elem0.loc8_47.2, %ElementType.ref.loc8_62 [concrete] -// CHECK:STDOUT: %.loc8_41: type = where_expr [concrete = constants.%IndexWith_where.type.192] { +// CHECK:STDOUT: %.loc8_41: type = where_expr [concrete = constants.%IndexWith_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %IndexWith.type [concrete] // CHECK:STDOUT: %rewrite.loc8_60.2 = requirement_rewrite %impl.elem0.loc8_47.2, %ElementType.ref.loc8_62 [concrete] // CHECK:STDOUT: } @@ -320,7 +320,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %.Self: %IndexWith.type.385 = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.a93: = impl_self_witness %.Self, @IndexWith, @IndexWith(Core.IntLiteral) [symbolic_self] // CHECK:STDOUT: %impl.elem0.d9e: type = impl_witness_access %.a93, element0 [symbolic_self] -// CHECK:STDOUT: %IndexWith_where.type.4f3: type = facet_type <@IndexWith, @IndexWith(Core.IntLiteral) where %impl.elem0.d9e = %C> [concrete] +// CHECK:STDOUT: %IndexWith_where.type: type = facet_type <@IndexWith, @IndexWith(Core.IntLiteral) where %impl.elem0.d9e = %C> [concrete] // CHECK:STDOUT: %.291: = impl_self_witness %tuple.type.748, @IndexWith, @IndexWith(Core.IntLiteral) [concrete] // CHECK:STDOUT: %IndexWith.impl_witness: = impl_witness @tuple.type.as.IndexWith.impl.%IndexWith.impl_witness_table [concrete] // CHECK:STDOUT: %pattern_type.8b4: type = pattern_type %tuple.type.748 [concrete] @@ -391,7 +391,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %rewrite.loc8_67.1 = requirement_rewrite %impl.elem0.loc8_54.1, %C.ref.loc8_69 [concrete] // CHECK:STDOUT: %impl.elem0.loc8_54.2: type = impl_witness_access constants.%.a93, element0 [symbolic_self = constants.%impl.elem0.d9e] // CHECK:STDOUT: %rewrite.loc8_67.2 = requirement_rewrite %impl.elem0.loc8_54.2, %C.ref.loc8_69 [concrete] -// CHECK:STDOUT: %.loc8_48: type = where_expr [concrete = constants.%IndexWith_where.type.4f3] { +// CHECK:STDOUT: %.loc8_48: type = where_expr [concrete = constants.%IndexWith_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %IndexWith.type [concrete] // CHECK:STDOUT: %rewrite.loc8_67.2 = requirement_rewrite %impl.elem0.loc8_54.2, %C.ref.loc8_69 [concrete] // CHECK:STDOUT: } @@ -523,7 +523,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %.Self: %IndexWith.type.d74 = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %.300: = impl_self_witness %.Self, @IndexWith, @IndexWith(%SubscriptType.f8f) [symbolic_self] // CHECK:STDOUT: %impl.elem0.55a: type = impl_witness_access %.300, element0 [symbolic_self] -// CHECK:STDOUT: %IndexWith_where.type.192: type = facet_type <@IndexWith, @IndexWith(%SubscriptType.f8f) where %impl.elem0.55a = %ElementType> [concrete] +// CHECK:STDOUT: %IndexWith_where.type: type = facet_type <@IndexWith, @IndexWith(%SubscriptType.f8f) where %impl.elem0.55a = %ElementType> [concrete] // CHECK:STDOUT: %.769: = impl_self_witness %C, @IndexWith, @IndexWith(%SubscriptType.f8f) [concrete] // CHECK:STDOUT: %IndexWith.impl_witness: = impl_witness @C.as.IndexWith.impl.%IndexWith.impl_witness_table [concrete] // CHECK:STDOUT: %pattern_type.98b: type = pattern_type %C [concrete] @@ -592,7 +592,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %rewrite.loc8_60.1 = requirement_rewrite %impl.elem0.loc8_47.1, %ElementType.ref.loc8_62 [concrete] // CHECK:STDOUT: %impl.elem0.loc8_47.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.55a] // CHECK:STDOUT: %rewrite.loc8_60.2 = requirement_rewrite %impl.elem0.loc8_47.2, %ElementType.ref.loc8_62 [concrete] -// CHECK:STDOUT: %.loc8_41: type = where_expr [concrete = constants.%IndexWith_where.type.192] { +// CHECK:STDOUT: %.loc8_41: type = where_expr [concrete = constants.%IndexWith_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %IndexWith.type [concrete] // CHECK:STDOUT: %rewrite.loc8_60.2 = requirement_rewrite %impl.elem0.loc8_47.2, %ElementType.ref.loc8_62 [concrete] // CHECK:STDOUT: }