diff --git a/toolchain/check/context.h b/toolchain/check/context.h index 575fc5115311..f709948fa24d 100644 --- a/toolchain/check/context.h +++ b/toolchain/check/context.h @@ -188,7 +188,7 @@ class Context { // An ongoing impl lookup, used to ensure termination. struct ImplLookupStackEntry { - SemIR::ConstantId type_const_id; + SemIR::ConstantId query_self_const_id; SemIR::ConstantId query_facet_type_const_id; // The location of the impl being looked at for the stack entry. SemIR::InstId impl_loc = SemIR::InstId::None; diff --git a/toolchain/check/convert.cpp b/toolchain/check/convert.cpp index 1f3ccd0c1a53..f14f2eb0b6b4 100644 --- a/toolchain/check/convert.cpp +++ b/toolchain/check/convert.cpp @@ -1028,67 +1028,52 @@ static auto PerformBuiltinConversion(Context& context, SemIR::LocId loc_id, // The value is a type or facet value, so it has a constant value. We get // that to unwrap things like NameRef and get to the underlying type or // facet value instruction so that we can use `TryGetAs`. - auto lookup_inst_id = sem_ir.constant_values().GetConstantInstId(value_id); + auto const_value_id = sem_ir.constant_values().GetConstantInstId(value_id); if (auto facet_access_type_inst = - sem_ir.insts().TryGetAs(lookup_inst_id)) { + sem_ir.insts().TryGetAs(const_value_id)) { // Conversion from a `FacetAccessType` to a `FacetValue` of the target // `FacetType` if the instruction in the `FacetAccessType` is of a // `FacetType` that satisfies the requirements of the target `FacetType`. - auto facet_value_inst_id = facet_access_type_inst->facet_value_inst_id; - // If the `FacetType` exactly matches the target `FacetType` then we can // shortcut and use that value, and avoid impl lookup. + auto facet_value_inst_id = facet_access_type_inst->facet_value_inst_id; if (sem_ir.insts().Get(facet_value_inst_id).type_id() == target.type_id) { return facet_value_inst_id; } - - auto lookup_result = LookupImplWitness( - context, loc_id, context.constant_values().Get(facet_value_inst_id), - context.types().GetConstantId(target.type_id)); - if (lookup_result.has_value()) { - if (lookup_result.has_error_value()) { - return SemIR::ErrorInst::SingletonInstId; - } else { - return AddInst( - context, loc_id, - {.type_id = target.type_id, - .type_inst_id = lookup_inst_id, - .witnesses_block_id = lookup_result.inst_block_id()}); - } - } } - if (sem_ir.types().Is( - sem_ir.insts().Get(lookup_inst_id).type_id())) { - // Conversion from a facet value to a `FacetValue` of the target - // `FacetType`. We move up to the higher typish level, and convert the - // `FacetType` (which is of type TypeType) directly. If the `FacetType` - // itself implements the target `FacetType` (`impl Iface1 as Iface2`), - // then we will produce a `FacetValue` of the target `FacetType`. - lookup_inst_id = context.types().GetInstId( - sem_ir.insts().Get(lookup_inst_id).type_id()); - } - - if (sem_ir.types().Is( - sem_ir.insts().Get(lookup_inst_id).type_id())) { - // Conversion from a type value (which has type `type`) to a facet value - // (which has type `FacetType`), if the type satisfies the requirements of - // the target `FacetType`, as determined by finding an impl witness. This - // binds the value to the `FacetType` with a `FacetValue`. - auto lookup_result = LookupImplWitness( - context, loc_id, sem_ir.constant_values().Get(lookup_inst_id), - sem_ir.types().GetConstantId(target.type_id)); - if (lookup_result.has_value()) { - if (lookup_result.has_error_value()) { - return SemIR::ErrorInst::SingletonInstId; + // Conversion from a facet value (which has type `FacetType`) or a type + // value (which has type `TypeType`) to a facet value. We can do this if the + // type satisfies the requirements of the target `FacetType`, as determined + // by finding impl witnesses for the target FacetType. + auto lookup_result = LookupImplWitness( + context, loc_id, sem_ir.constant_values().Get(const_value_id), + sem_ir.types().GetConstantId(target.type_id)); + if (lookup_result.has_value()) { + if (lookup_result.has_error_value()) { + return SemIR::ErrorInst::SingletonInstId; + } else { + // We bind the input value to the target `FacetType` with a + // `FacetValue`, which requires an instruction of type `TypeType`. So if + // we are converting from a facet value, we get its `type` via an extra + // `FacetAccessType` instruction. + auto type_inst_id = SemIR::InstId::None; + if (sem_ir.types().Is(value_type_id)) { + type_inst_id = + AddInst(context, loc_id, + SemIR::FacetAccessType{ + .type_id = SemIR::TypeType::SingletonTypeId, + .facet_value_inst_id = const_value_id, + }); } else { - return AddInst( - context, loc_id, - {.type_id = target.type_id, - .type_inst_id = lookup_inst_id, - .witnesses_block_id = lookup_result.inst_block_id()}); + type_inst_id = const_value_id; } + return AddInst( + context, loc_id, + {.type_id = target.type_id, + .type_inst_id = type_inst_id, + .witnesses_block_id = lookup_result.inst_block_id()}); } } } diff --git a/toolchain/check/impl_lookup.cpp b/toolchain/check/impl_lookup.cpp index a36e95bc12c7..f04019faa26e 100644 --- a/toolchain/check/impl_lookup.cpp +++ b/toolchain/check/impl_lookup.cpp @@ -19,7 +19,7 @@ namespace Carbon::Check { static auto FindAssociatedImportIRs(Context& context, - SemIR::ConstantId type_const_id, + SemIR::ConstantId query_self_const_id, SemIR::ConstantId query_facet_type_const_id) -> llvm::SmallVector { llvm::SmallVector result; @@ -39,7 +39,7 @@ static auto FindAssociatedImportIRs(Context& context, }; llvm::SmallVector worklist; - worklist.push_back(context.constant_values().GetInstId(type_const_id)); + worklist.push_back(context.constant_values().GetInstId(query_self_const_id)); worklist.push_back( context.constant_values().GetInstId(query_facet_type_const_id)); @@ -121,7 +121,7 @@ static auto FindAssociatedImportIRs(Context& context, static auto FindAndDiagnoseImplLookupCycle( Context& context, const llvm::SmallVector& stack, - SemIR::LocId loc_id, SemIR::ConstantId type_const_id, + SemIR::LocId loc_id, SemIR::ConstantId query_self_const_id, SemIR::ConstantId query_facet_type_const_id) -> bool { // Deduction of the interface parameters can do further impl lookups, and we // need to ensure we terminate. @@ -136,7 +136,7 @@ static auto FindAndDiagnoseImplLookupCycle( // complexity of the types on the top of (or throughout?) the stack: // https://docs.carbon-lang.dev/docs/design/generics/details.html#termination-rule for (auto [i, entry] : llvm::enumerate(stack)) { - if (entry.type_const_id == type_const_id && + if (entry.query_self_const_id == query_self_const_id && entry.query_facet_type_const_id == query_facet_type_const_id) { auto facet_type_type_id = context.types().GetTypeIdForTypeConstantId(query_facet_type_const_id); @@ -145,7 +145,7 @@ static auto FindAndDiagnoseImplLookupCycle( SemIR::TypeId, SemIR::TypeId); auto builder = context.emitter().Build( loc_id, ImplLookupCycle, facet_type_type_id, - context.types().GetTypeIdForTypeConstantId(type_const_id)); + context.types().GetTypeIdForTypeConstantId(query_self_const_id)); for (const auto& active_entry : llvm::drop_begin(stack, i)) { if (active_entry.impl_loc.has_value()) { CARBON_DIAGNOSTIC(ImplLookupCycleNote, Note, @@ -179,7 +179,8 @@ static auto GetInterfacesFromConstantId( } static auto GetWitnessIdForImpl( - Context& context, SemIR::LocId loc_id, SemIR::ConstantId type_const_id, + Context& context, SemIR::LocId loc_id, + SemIR::ConstantId query_self_const_id, const SemIR::CompleteFacetType::RequiredInterface& interface, SemIR::ImplId impl_id) -> SemIR::InstId { // The impl may have generic arguments, in which case we need to deduce them @@ -196,7 +197,7 @@ static auto GetWitnessIdForImpl( {.self_id = impl.self_id, .generic_id = impl.generic_id, .specific_id = impl.interface.specific_id}, - type_const_id, interface.specific_id); + query_self_const_id, interface.specific_id); if (!specific_id.has_value()) { return SemIR::InstId::None; } @@ -210,7 +211,7 @@ static auto GetWitnessIdForImpl( // `impl T as ...` for some other type `T` and should not be considered. auto deduced_self_const_id = SemIR::GetConstantValueInSpecific( context.sem_ir(), specific_id, impl.self_id); - if (type_const_id != deduced_self_const_id) { + if (query_self_const_id != deduced_self_const_id) { return SemIR::InstId::None; } @@ -277,8 +278,8 @@ static auto FindWitnessInFacet( auto complete_facet_type_id = RequireCompleteFacetType( context, facet_type_id, loc_id, *facet_type_inst, [&]() -> DiagnosticBuilder { - // TODO: Find test that triggers this code path. - CARBON_FATAL("impl lookup for with incomplete facet type"); + context.TODO(loc_id, "impl lookup on incomplete facet type"); + return context.emitter().BuildSuppressed(); }); if (complete_facet_type_id.has_value()) { const auto& complete_facet_type = @@ -301,7 +302,8 @@ static auto FindWitnessInFacet( } static auto FindWitnessInImpls( - Context& context, SemIR::LocId loc_id, SemIR::ConstantId type_const_id, + Context& context, SemIR::LocId loc_id, + SemIR::ConstantId query_self_const_id, const SemIR::SpecificInterface& specific_interface) -> SemIR::InstId { auto& stack = context.impl_lookup_stack(); // TODO: Build this candidate list by matching against type structures to @@ -344,8 +346,8 @@ static auto FindWitnessInImpls( stack.back().impl_loc = loc_inst_id; // NOTE: GetWitnessIdForImpl() does deduction, which can cause new impls to // be imported, invalidating any pointer into `context.impls()`. - auto result_witness_id = GetWitnessIdForImpl(context, loc_id, type_const_id, - specific_interface, impl_id); + auto result_witness_id = GetWitnessIdForImpl( + context, loc_id, query_self_const_id, specific_interface, impl_id); if (result_witness_id.has_value()) { // We found a matching impl; don't keep looking for this interface. return result_witness_id; @@ -355,14 +357,28 @@ static auto FindWitnessInImpls( } auto LookupImplWitness(Context& context, SemIR::LocId loc_id, - SemIR::ConstantId type_const_id, + SemIR::ConstantId query_self_const_id, SemIR::ConstantId query_facet_type_const_id) -> SemIR::InstBlockIdOrError { - if (type_const_id == SemIR::ErrorInst::SingletonConstantId || + if (query_self_const_id == SemIR::ErrorInst::SingletonConstantId || query_facet_type_const_id == SemIR::ErrorInst::SingletonConstantId) { return SemIR::InstBlockIdOrError::MakeError(); } - auto import_irs = FindAssociatedImportIRs(context, type_const_id, + + { + // The query self value is a type value or a facet value. + auto query_self_type_id = + context.insts() + .Get(context.constant_values().GetInstId(query_self_const_id)) + .type_id(); + CARBON_CHECK(context.types().Is(query_self_type_id) || + context.types().Is(query_self_type_id)); + // The query facet type value is indeed a facet type. + CARBON_CHECK(context.insts().Is( + context.constant_values().GetInstId(query_facet_type_const_id))); + } + + auto import_irs = FindAssociatedImportIRs(context, query_self_const_id, query_facet_type_const_id); for (auto import_ir : import_irs) { // TODO: Instead of importing all impls, only import ones that are in some @@ -376,7 +392,7 @@ auto LookupImplWitness(Context& context, SemIR::LocId loc_id, } if (FindAndDiagnoseImplLookupCycle(context, context.impl_lookup_stack(), - loc_id, type_const_id, + loc_id, query_self_const_id, query_facet_type_const_id)) { return SemIR::InstBlockIdOrError::MakeError(); } @@ -396,20 +412,20 @@ auto LookupImplWitness(Context& context, SemIR::LocId loc_id, auto& stack = context.impl_lookup_stack(); stack.push_back({ - .type_const_id = type_const_id, + .query_self_const_id = query_self_const_id, .query_facet_type_const_id = query_facet_type_const_id, }); // We need to find a witness for each interface in `interfaces`. We return // them in the same order as they are found in the `CompleteFacetType`, which // is the same order as in `interfaces` here. for (const auto& interface : interfaces) { - // TODO: Since both `interfaces` and `type_const_id` are sorted lists, do an - // O(N+M) merge instead of O(N*M) nested loops. + // TODO: Since both `interfaces` and `query_self_const_id` are sorted lists, + // do an O(N+M) merge instead of O(N*M) nested loops. auto result_witness_id = - FindWitnessInFacet(context, loc_id, type_const_id, interface); + FindWitnessInFacet(context, loc_id, query_self_const_id, interface); if (!result_witness_id.has_value()) { result_witness_id = - FindWitnessInImpls(context, loc_id, type_const_id, interface); + FindWitnessInImpls(context, loc_id, query_self_const_id, interface); } if (result_witness_id.has_value()) { result_witness_ids.push_back(result_witness_id); @@ -424,8 +440,8 @@ auto LookupImplWitness(Context& context, SemIR::LocId loc_id, // `interface_const_id`. // All interfaces in the query facet type must have been found to be available - // through some impl (TODO: or directly on the type itself if `type_const_id` - // is a facet type). + // through some impl, or directly on the value's facet type if + // `query_self_const_id` is a facet value. if (result_witness_ids.size() != interfaces.size()) { return SemIR::InstBlockId::None; } diff --git a/toolchain/check/impl_lookup.h b/toolchain/check/impl_lookup.h index c2c02e3c1a0b..11d54f82c101 100644 --- a/toolchain/check/impl_lookup.h +++ b/toolchain/check/impl_lookup.h @@ -10,9 +10,12 @@ namespace Carbon::Check { -// Looks up the witnesses to use for a particular type and a facet type naming a -// set of interfaces required to be implemented for that type, as well as -// possible constraints on those interfaces. +// Looks up the witnesses to use for a type value or facet value, and a facet +// type naming a set of interfaces required to be implemented for that type, as +// well as possible constraints on those interfaces. +// +// N.B. In the future, `TypeType` will become a facet type, at which point type +// values will also be facet values. // // The return value is one of: // - An InstBlockId value, containing an `ImplWitness` instruction for each @@ -28,7 +31,7 @@ namespace Carbon::Check { // - An error value, indicating the program is invalid and a diagonstic has been // produced, either in this function or before. auto LookupImplWitness(Context& context, SemIR::LocId loc_id, - SemIR::ConstantId type_const_id, + SemIR::ConstantId query_self_const_id, SemIR::ConstantId query_facet_type_const_id) -> SemIR::InstBlockIdOrError; diff --git a/toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_facet_value.carbon b/toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_facet_value.carbon new file mode 100644 index 000000000000..941ce9983ddb --- /dev/null +++ b/toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_facet_value.carbon @@ -0,0 +1,1126 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// INCLUDE-FILE: toolchain/testing/min_prelude/facet_types.carbon +// EXTRA-ARGS: --custom-core +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_facet_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_facet_value.carbon + +// --- convert_facet_value_to_facet_value.carbon +library "[[@TEST_NAME]]"; + +interface Eats {} +interface Animal {} + +// TODO: This may be rejected in the future. +// https://github.com/carbon-language/carbon-lang/issues/4853 +impl Animal as Eats {} + +fn Feed(e:! Eats) {} + +fn F() { + Feed(Animal); +} + +// --- fail_facet_value_to_facet_type.carbon +library "[[@TEST_NAME]]"; + +interface Eats {} +interface Animal {} + +// TODO: This may be rejected in the future. +// https://github.com/carbon-language/carbon-lang/issues/4853 +impl Animal as Eats {} + +fn Feed(e:! Eats) {} + +class Goat {} +impl Goat as Animal {} + +fn F() { + // CHECK:STDERR: fail_facet_value_to_facet_type.carbon:[[@LINE+10]]:3: error: cannot implicitly convert type `Goat as Animal` that implements `Animal` into type implementing `Eats` [ConversionFailureFacetToFacet] + // CHECK:STDERR: Feed(Goat as Animal); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_facet_value_to_facet_type.carbon:[[@LINE+7]]:3: note: type `Animal` does not implement interface `Core.ImplicitAs(Eats)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: Feed(Goat as Animal); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_facet_value_to_facet_type.carbon:[[@LINE-12]]:9: note: initializing generic parameter `e` declared here [InitializingGenericParam] + // CHECK:STDERR: fn Feed(e:! Eats) {} + // CHECK:STDERR: ^ + // CHECK:STDERR: + Feed(Goat as Animal); +} + +// --- fail_convert_multi_interface_facet_value_to_facet_value.carbon +library "[[@TEST_NAME]]"; + +interface Eats {} +interface Animal {} +interface Climbs {} + +// TODO: This may be rejected in the future. +// https://github.com/carbon-language/carbon-lang/issues/4853 +impl Animal as Eats {} + +fn Feed(e:! Eats) {} + +class Goat {} +impl Goat as Animal {} +impl Goat as Climbs {} + +// These are expected to fail: +// https://github.com/carbon-language/carbon-lang/issues/4853#issuecomment-2707673344 +fn F() { + // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE+10]]:3: error: cannot implicitly convert type `Goat as Animal & Climbs` that implements `Animal & Climbs` into type implementing `Eats` [ConversionFailureFacetToFacet] + // CHECK:STDERR: Feed(Goat as (Animal & Climbs)); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE+7]]:3: note: type `Animal & Climbs` does not implement interface `Core.ImplicitAs(Eats)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: Feed(Goat as (Animal & Climbs)); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE-15]]:9: note: initializing generic parameter `e` declared here [InitializingGenericParam] + // CHECK:STDERR: fn Feed(e:! Eats) {} + // CHECK:STDERR: ^ + // CHECK:STDERR: + Feed(Goat as (Animal & Climbs)); + + // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE+10]]:3: error: cannot implicitly convert type `Animal & Climbs` into type implementing `Eats` [ConversionFailureTypeToFacet] + // CHECK:STDERR: Feed(Animal & Climbs); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE+7]]:3: note: type `type` does not implement interface `Core.ImplicitAs(Eats)` [MissingImplInMemberAccessNote] + // CHECK:STDERR: Feed(Animal & Climbs); + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE-27]]:9: note: initializing generic parameter `e` declared here [InitializingGenericParam] + // CHECK:STDERR: fn Feed(e:! Eats) {} + // CHECK:STDERR: ^ + // CHECK:STDERR: + Feed(Animal & Climbs); +} + +// CHECK:STDOUT: --- convert_facet_value_to_facet_value.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats> [concrete] +// CHECK:STDOUT: %Self.1b5: %Eats.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] +// CHECK:STDOUT: %Self.fd4: %Animal.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete] +// CHECK:STDOUT: %e: %Eats.type = bind_symbolic_name e, 0 [symbolic] +// CHECK:STDOUT: %e.patt: %Eats.type = symbolic_binding_pattern e, 0 [symbolic] +// CHECK:STDOUT: %Feed.type: type = fn_type @Feed [concrete] +// CHECK:STDOUT: %Feed: %Feed.type = struct_value () [concrete] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value %Animal.type, (%impl_witness) [concrete] +// CHECK:STDOUT: %Feed.specific_fn: = specific_function %Feed, @Feed(%Eats.facet) [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Eats = %Eats.decl +// CHECK:STDOUT: .Animal = %Animal.decl +// CHECK:STDOUT: .Feed = %Feed.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Eats.decl: type = interface_decl @Eats [concrete = constants.%Eats.type] {} {} +// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] {} { +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete = constants.%impl_witness] +// CHECK:STDOUT: %Feed.decl: %Feed.type = fn_decl @Feed [concrete = constants.%Feed] { +// CHECK:STDOUT: %e.patt.loc10_9.1: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc10_9.2 (constants.%e.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] +// CHECK:STDOUT: %e.loc10_9.1: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc10_9.2 (constants.%e)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Eats { +// CHECK:STDOUT: %Self: %Eats.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1b5] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Animal { +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl: %Animal.ref as %Eats.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Feed(%e.loc10_9.1: %Eats.type) { +// CHECK:STDOUT: %e.loc10_9.2: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc10_9.2 (constants.%e)] +// CHECK:STDOUT: %e.patt.loc10_9.2: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc10_9.2 (constants.%e.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%e.patt.loc10_9.1: %Eats.type) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value constants.%Animal.type, (constants.%impl_witness) [concrete = constants.%Eats.facet] +// CHECK:STDOUT: %.loc13: %Eats.type = converted %Animal.ref, %Eats.facet [concrete = constants.%Eats.facet] +// CHECK:STDOUT: %Feed.specific_fn: = specific_function %Feed.ref, @Feed(constants.%Eats.facet) [concrete = constants.%Feed.specific_fn] +// CHECK:STDOUT: %Feed.call: init %empty_tuple.type = call %Feed.specific_fn() +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Feed(constants.%e) { +// CHECK:STDOUT: %e.loc10_9.2 => constants.%e +// CHECK:STDOUT: %e.patt.loc10_9.2 => constants.%e +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Feed(constants.%Eats.facet) { +// CHECK:STDOUT: %e.loc10_9.2 => constants.%Eats.facet +// CHECK:STDOUT: %e.patt.loc10_9.2 => constants.%Eats.facet +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_facet_value_to_facet_type.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats> [concrete] +// CHECK:STDOUT: %Self.1b5: %Eats.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] +// CHECK:STDOUT: %Self.fd4: %Animal.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %impl_witness.1bc: = impl_witness () [concrete] +// CHECK:STDOUT: %e: %Eats.type = bind_symbolic_name e, 0 [symbolic] +// CHECK:STDOUT: %e.patt: %Eats.type = symbolic_binding_pattern e, 0 [symbolic] +// CHECK:STDOUT: %Feed.type: type = fn_type @Feed [concrete] +// CHECK:STDOUT: %Feed: %Feed.type = struct_value () [concrete] +// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%impl_witness.1bc) [concrete] +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.d62: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.519: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.275: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.42e: %Convert.type.275 = struct_value () [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.519 [symbolic] +// CHECK:STDOUT: %ImplicitAs.assoc_type.837: type = assoc_entity_type %ImplicitAs.type.d62 [symbolic] +// CHECK:STDOUT: %assoc0.02f: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.af9: type = facet_type <@ImplicitAs, @ImplicitAs(%Eats.type)> [concrete] +// CHECK:STDOUT: %Convert.type.9a9: type = fn_type @Convert, @ImplicitAs(%Eats.type) [concrete] +// CHECK:STDOUT: %Convert.35d: %Convert.type.9a9 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.9a7: type = assoc_entity_type %ImplicitAs.type.af9 [concrete] +// CHECK:STDOUT: %assoc0.ceb: %ImplicitAs.assoc_type.9a7 = assoc_entity element0, imports.%Core.import_ref.1c7 [concrete] +// CHECK:STDOUT: %assoc0.43d: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207 [symbolic] +// CHECK:STDOUT: %BitAnd.type: type = facet_type <@BitAnd> [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %impl_witness.b81: = impl_witness (imports.%Core.import_ref.bd4), @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op.type: type = fn_type @Op, @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op: %Op.type = struct_value () [symbolic] +// CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//prelude, loc13_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//prelude, inst65 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] +// CHECK:STDOUT: %Core.Convert = import_ref Core//prelude, Convert, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//prelude, loc13_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//prelude, inst65 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %Core.import_ref.ad0 = import_ref Core//prelude, inst100 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.3bf = import_ref Core//prelude, loc18_41, unloaded +// CHECK:STDOUT: %Core.Op = import_ref Core//prelude, Op, unloaded +// CHECK:STDOUT: %Core.import_ref.f80 = import_ref Core//prelude, loc21_36, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.3: type = import_ref Core//prelude, loc21_14, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: %Core.import_ref.583: type = import_ref Core//prelude, loc21_24, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: %Core.import_ref.9c1: type = import_ref Core//prelude, loc21_29, loaded [concrete = constants.%BitAnd.type] +// CHECK:STDOUT: %Core.import_ref.bd4 = import_ref Core//prelude, loc22_42, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.4: type = import_ref Core//prelude, loc21_14, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Eats = %Eats.decl +// CHECK:STDOUT: .Animal = %Animal.decl +// CHECK:STDOUT: .Feed = %Feed.decl +// CHECK:STDOUT: .Goat = %Goat.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Eats.decl: type = interface_decl @Eats [concrete = constants.%Eats.type] {} {} +// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} +// CHECK:STDOUT: impl_decl @impl.d75 [concrete] {} { +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness.loc8: = impl_witness () [concrete = constants.%impl_witness.1bc] +// CHECK:STDOUT: %Feed.decl: %Feed.type = fn_decl @Feed [concrete = constants.%Feed] { +// CHECK:STDOUT: %e.patt.loc10_9.1: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc10_9.2 (constants.%e.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] +// CHECK:STDOUT: %e.loc10_9.1: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc10_9.2 (constants.%e)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} +// CHECK:STDOUT: impl_decl @impl.27e [concrete] {} { +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness.loc13: = impl_witness () [concrete = constants.%impl_witness.1bc] +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Eats { +// CHECK:STDOUT: %Self: %Eats.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1b5] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Animal { +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.1: type) [from "toolchain/testing/min_prelude/facet_types.carbon"] { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.275)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = struct_value () [symbolic = %Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.837)] +// CHECK:STDOUT: %assoc0: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic = %assoc0 (constants.%assoc0.02f)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Core.import_ref.ff5 +// CHECK:STDOUT: .Convert = imports.%Core.import_ref.630 +// CHECK:STDOUT: witness = (imports.%Core.Convert) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @BitAnd [from "toolchain/testing/min_prelude/facet_types.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Core.import_ref.ad0 +// CHECK:STDOUT: .Op = imports.%Core.import_ref.3bf +// CHECK:STDOUT: witness = (imports.%Core.Op) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.d75: %Animal.ref as %Eats.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness.loc8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.27e: %Goat.ref as %Animal.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness.loc13 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.f92(imports.%Core.import_ref.5ab3ec.3: type) [from "toolchain/testing/min_prelude/facet_types.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: %impl_witness: = impl_witness (imports.%Core.import_ref.bd4), @impl.f92(%T) [symbolic = %impl_witness (constants.%impl_witness.b81)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Op.type: type = fn_type @Op, @impl.f92(%T) [symbolic = %Op.type (constants.%Op.type)] +// CHECK:STDOUT: %Op: @impl.f92.%Op.type (%Op.type) = struct_value () [symbolic = %Op (constants.%Op)] +// CHECK:STDOUT: %require_complete: = require_complete_type @impl.f92.%T (%T) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%Core.import_ref.583 as imports.%Core.import_ref.9c1 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Core.import_ref.f80 +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @Goat { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Goat +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Feed(%e.loc10_9.1: %Eats.type) { +// CHECK:STDOUT: %e.loc10_9.2: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc10_9.2 (constants.%e)] +// CHECK:STDOUT: %e.patt.loc10_9.2: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc10_9.2 (constants.%e.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%e.patt.loc10_9.1: %Eats.type) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness.1bc) [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc26_13: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] +// CHECK:STDOUT: %.loc26_22: %Eats.type = converted %.loc26_13, [concrete = ] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.2: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "toolchain/testing/min_prelude/facet_types.carbon"] { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type (%Self.as_type)]() -> @Convert.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op(imports.%Core.import_ref.5ab3ec.4: type) [from "toolchain/testing/min_prelude/facet_types.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.%T (%T)](%other.param_patt: @Op.%T (%T)) -> @Op.%T (%T) = "type.and"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Feed(constants.%e) { +// CHECK:STDOUT: %e.loc10_9.2 => constants.%e +// CHECK:STDOUT: %e.patt.loc10_9.2 => constants.%e +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.519) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d62 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Eats.type) { +// CHECK:STDOUT: %Dest => constants.%Eats.type +// CHECK:STDOUT: %Dest.patt => constants.%Eats.type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.af9 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9a9 +// CHECK:STDOUT: %Convert => constants.%Convert.35d +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.9a7 +// CHECK:STDOUT: %assoc0 => constants.%assoc0.ceb +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.f92(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %T.patt => constants.%T +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.b81 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.f92(%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- fail_convert_multi_interface_facet_value_to_facet_value.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats> [concrete] +// CHECK:STDOUT: %Self.1b5: %Eats.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] +// CHECK:STDOUT: %Self.fd4: %Animal.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Climbs.type: type = facet_type <@Climbs> [concrete] +// CHECK:STDOUT: %Self.fcc: %Climbs.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %impl_witness.1bc: = impl_witness () [concrete] +// CHECK:STDOUT: %e: %Eats.type = bind_symbolic_name e, 0 [symbolic] +// CHECK:STDOUT: %e.patt: %Eats.type = symbolic_binding_pattern e, 0 [symbolic] +// CHECK:STDOUT: %Feed.type: type = fn_type @Feed [concrete] +// CHECK:STDOUT: %Feed: %Feed.type = struct_value () [concrete] +// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] +// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] +// CHECK:STDOUT: %complete_type.357: = complete_type_witness %empty_struct_type [concrete] +// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] +// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] +// CHECK:STDOUT: %BitAnd.type: type = facet_type <@BitAnd> [concrete] +// CHECK:STDOUT: %Self.25f: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %BitAnd.assoc_type: type = assoc_entity_type %BitAnd.type [concrete] +// CHECK:STDOUT: %assoc0.a63: %BitAnd.assoc_type = assoc_entity element0, imports.%Core.import_ref.a93 [concrete] +// CHECK:STDOUT: %Op.type.27a: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Self.as_type.19f: type = facet_access_type %Self.25f [symbolic] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %impl_witness.db8: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op.type.f99: type = fn_type @Op.2, @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op.05a: %Op.type.f99 = struct_value () [symbolic] +// CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic] +// CHECK:STDOUT: %impl_witness.3ea: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(type) [concrete] +// CHECK:STDOUT: %impl_witness.b81: = impl_witness (imports.%Core.import_ref.bd4), @impl.f92(%T) [symbolic] +// CHECK:STDOUT: %Op.type.eb8: type = fn_type @Op.2, @impl.f92(type) [concrete] +// CHECK:STDOUT: %Op.444: %Op.type.eb8 = struct_value () [concrete] +// CHECK:STDOUT: %complete_type.473: = complete_type_witness type [concrete] +// CHECK:STDOUT: %BitAnd.facet: %BitAnd.type = facet_value type, (%impl_witness.3ea) [concrete] +// CHECK:STDOUT: %.2ac: type = fn_type_with_self_type %Op.type.27a, %BitAnd.facet [concrete] +// CHECK:STDOUT: %Op.bound: = bound_method %Animal.type, %Op.444 [concrete] +// CHECK:STDOUT: %Op.specific_fn: = specific_function %Op.444, @Op.2(type) [concrete] +// CHECK:STDOUT: %bound_method: = bound_method %Animal.type, %Op.specific_fn [concrete] +// CHECK:STDOUT: %facet_type: type = facet_type <@Animal & @Climbs> [concrete] +// CHECK:STDOUT: %facet_value: %facet_type = facet_value %Goat, (%impl_witness.1bc, %impl_witness.1bc) [concrete] +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.d62: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.519: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %Convert.type.275: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.42e: %Convert.type.275 = struct_value () [symbolic] +// CHECK:STDOUT: %Self.as_type.40a: type = facet_access_type %Self.519 [symbolic] +// CHECK:STDOUT: %ImplicitAs.assoc_type.837: type = assoc_entity_type %ImplicitAs.type.d62 [symbolic] +// CHECK:STDOUT: %assoc0.02f: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.af9: type = facet_type <@ImplicitAs, @ImplicitAs(%Eats.type)> [concrete] +// CHECK:STDOUT: %Convert.type.9a9: type = fn_type @Convert, @ImplicitAs(%Eats.type) [concrete] +// CHECK:STDOUT: %Convert.35d: %Convert.type.9a9 = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.assoc_type.9a7: type = assoc_entity_type %ImplicitAs.type.af9 [concrete] +// CHECK:STDOUT: %assoc0.ceb: %ImplicitAs.assoc_type.9a7 = assoc_entity element0, imports.%Core.import_ref.1c7 [concrete] +// CHECK:STDOUT: %assoc0.43d: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207 [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .BitAnd = %Core.BitAnd +// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs +// CHECK:STDOUT: import Core//prelude +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.ad0 = import_ref Core//prelude, inst100 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.08d: %BitAnd.assoc_type = import_ref Core//prelude, loc18_41, loaded [concrete = constants.%assoc0.a63] +// CHECK:STDOUT: %Core.Op = import_ref Core//prelude, Op, unloaded +// CHECK:STDOUT: %Core.import_ref.040: %BitAnd.type = import_ref Core//prelude, inst100 [no loc], loaded [symbolic = constants.%Self.25f] +// CHECK:STDOUT: %Core.import_ref.51c: = import_ref Core//prelude, loc21_36, loaded [symbolic = @impl.f92.%impl_witness (constants.%impl_witness.b81)] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.1: type = import_ref Core//prelude, loc21_14, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: %Core.import_ref.583: type = import_ref Core//prelude, loc21_24, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: %Core.import_ref.9c1: type = import_ref Core//prelude, loc21_29, loaded [concrete = constants.%BitAnd.type] +// CHECK:STDOUT: %Core.import_ref.1e6: @impl.f92.%Op.type (%Op.type.f99) = import_ref Core//prelude, loc22_42, loaded [symbolic = @impl.f92.%Op (constants.%Op.05a)] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//prelude, loc21_14, loaded [symbolic = @impl.f92.%T (constants.%T)] +// CHECK:STDOUT: %Core.import_ref.5ab3ec.3: type = import_ref Core//prelude, loc13_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//prelude, inst65 [no loc], unloaded +// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] +// CHECK:STDOUT: %Core.Convert = import_ref Core//prelude, Convert, unloaded +// CHECK:STDOUT: %Core.import_ref.5ab3ec.4: type = import_ref Core//prelude, loc13_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] +// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//prelude, inst65 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] +// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .Core = imports.%Core +// CHECK:STDOUT: .Eats = %Eats.decl +// CHECK:STDOUT: .Animal = %Animal.decl +// CHECK:STDOUT: .Climbs = %Climbs.decl +// CHECK:STDOUT: .Feed = %Feed.decl +// CHECK:STDOUT: .Goat = %Goat.decl +// CHECK:STDOUT: .F = %F.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import = import Core +// CHECK:STDOUT: %Eats.decl: type = interface_decl @Eats [concrete = constants.%Eats.type] {} {} +// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} +// CHECK:STDOUT: %Climbs.decl: type = interface_decl @Climbs [concrete = constants.%Climbs.type] {} {} +// CHECK:STDOUT: impl_decl @impl.d75 [concrete] {} { +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness.loc9: = impl_witness () [concrete = constants.%impl_witness.1bc] +// CHECK:STDOUT: %Feed.decl: %Feed.type = fn_decl @Feed [concrete = constants.%Feed] { +// CHECK:STDOUT: %e.patt.loc11_9.1: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc11_9.2 (constants.%e.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] +// CHECK:STDOUT: %e.loc11_9.1: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc11_9.2 (constants.%e)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} +// CHECK:STDOUT: impl_decl @impl.27e [concrete] {} { +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness.loc14: = impl_witness () [concrete = constants.%impl_witness.1bc] +// CHECK:STDOUT: impl_decl @impl.aad [concrete] {} { +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Climbs.ref: type = name_ref Climbs, file.%Climbs.decl [concrete = constants.%Climbs.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness.loc15: = impl_witness () [concrete = constants.%impl_witness.1bc] +// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Eats { +// CHECK:STDOUT: %Self: %Eats.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1b5] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Animal { +// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @Climbs { +// CHECK:STDOUT: %Self: %Climbs.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fcc] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: witness = () +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @BitAnd [from "toolchain/testing/min_prelude/facet_types.carbon"] { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Core.import_ref.ad0 +// CHECK:STDOUT: .Op = imports.%Core.import_ref.08d +// CHECK:STDOUT: witness = (imports.%Core.Op) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.3: type) [from "toolchain/testing/min_prelude/facet_types.carbon"] { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.275)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = struct_value () [symbolic = %Convert (constants.%Convert.42e)] +// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.837)] +// CHECK:STDOUT: %assoc0: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic = %assoc0 (constants.%assoc0.02f)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = imports.%Core.import_ref.ff5 +// CHECK:STDOUT: .Convert = imports.%Core.import_ref.630 +// CHECK:STDOUT: witness = (imports.%Core.Convert) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.d75: %Animal.ref as %Eats.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness.loc9 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.27e: %Goat.ref as %Animal.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness.loc14 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: impl @impl.aad: %Goat.ref as %Climbs.ref { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = file.%impl_witness.loc15 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl.f92(imports.%Core.import_ref.5ab3ec.1: type) [from "toolchain/testing/min_prelude/facet_types.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: %impl_witness: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(%T) [symbolic = %impl_witness (constants.%impl_witness.db8)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Op.type: type = fn_type @Op.2, @impl.f92(%T) [symbolic = %Op.type (constants.%Op.type.f99)] +// CHECK:STDOUT: %Op: @impl.f92.%Op.type (%Op.type.f99) = struct_value () [symbolic = %Op (constants.%Op.05a)] +// CHECK:STDOUT: %require_complete: = require_complete_type @impl.f92.%T (%T) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: imports.%Core.import_ref.583 as imports.%Core.import_ref.9c1 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: witness = imports.%Core.import_ref.51c +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: class @Goat { +// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357] +// CHECK:STDOUT: complete_type_witness = %complete_type +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = constants.%Goat +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Feed(%e.loc11_9.1: %Eats.type) { +// CHECK:STDOUT: %e.loc11_9.2: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc11_9.2 (constants.%e)] +// CHECK:STDOUT: %e.patt.loc11_9.2: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc11_9.2 (constants.%e.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn(%e.patt.loc11_9.1: %Eats.type) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F() { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %Feed.ref.loc30: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] +// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] +// CHECK:STDOUT: %Animal.ref.loc30: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %Climbs.ref.loc30: type = name_ref Climbs, file.%Climbs.decl [concrete = constants.%Climbs.type] +// CHECK:STDOUT: %impl.elem0.loc30: %.2ac = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc30_24.1: = bound_method %Animal.ref.loc30, %impl.elem0.loc30 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc30: = specific_function %impl.elem0.loc30, @Op.2(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc30_24.2: = bound_method %Animal.ref.loc30, %specific_fn.loc30 [concrete = constants.%bound_method] +// CHECK:STDOUT: %type.and.loc30: init type = call %bound_method.loc30_24.2(%Animal.ref.loc30, %Climbs.ref.loc30) [concrete = constants.%facet_type] +// CHECK:STDOUT: %.loc30_32.1: type = value_of_initializer %type.and.loc30 [concrete = constants.%facet_type] +// CHECK:STDOUT: %.loc30_32.2: type = converted %type.and.loc30, %.loc30_32.1 [concrete = constants.%facet_type] +// CHECK:STDOUT: %facet_value: %facet_type = facet_value constants.%Goat, (constants.%impl_witness.1bc, constants.%impl_witness.1bc) [concrete = constants.%facet_value] +// CHECK:STDOUT: %.loc30_13: %facet_type = converted %Goat.ref, %facet_value [concrete = constants.%facet_value] +// CHECK:STDOUT: %.loc30_33: %Eats.type = converted %.loc30_13, [concrete = ] +// CHECK:STDOUT: %Feed.ref.loc42: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] +// CHECK:STDOUT: %Animal.ref.loc42: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] +// CHECK:STDOUT: %Climbs.ref.loc42: type = name_ref Climbs, file.%Climbs.decl [concrete = constants.%Climbs.type] +// CHECK:STDOUT: %impl.elem0.loc42: %.2ac = impl_witness_access constants.%impl_witness.3ea, element0 [concrete = constants.%Op.444] +// CHECK:STDOUT: %bound_method.loc42_15.1: = bound_method %Animal.ref.loc42, %impl.elem0.loc42 [concrete = constants.%Op.bound] +// CHECK:STDOUT: %specific_fn.loc42: = specific_function %impl.elem0.loc42, @Op.2(type) [concrete = constants.%Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc42_15.2: = bound_method %Animal.ref.loc42, %specific_fn.loc42 [concrete = constants.%bound_method] +// CHECK:STDOUT: %type.and.loc42: init type = call %bound_method.loc42_15.2(%Animal.ref.loc42, %Climbs.ref.loc42) [concrete = constants.%facet_type] +// CHECK:STDOUT: %.loc42: %Eats.type = converted %type.and.loc42, [concrete = ] +// CHECK:STDOUT: return +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.1(imports.%Core.import_ref.040: %BitAnd.type) [from "toolchain/testing/min_prelude/facet_types.carbon"] { +// CHECK:STDOUT: %Self: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.25f)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.19f)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self.as_type (%Self.as_type.19f)](%other.param_patt: @Op.1.%Self.as_type (%Self.as_type.19f)) -> @Op.1.%Self.as_type (%Self.as_type.19f); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.2(imports.%Core.import_ref.5ab3ec.2: type) [from "toolchain/testing/min_prelude/facet_types.carbon"] { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.2.%T (%T)](%other.param_patt: @Op.2.%T (%T)) -> @Op.2.%T (%T) = "type.and"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.4: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "toolchain/testing/min_prelude/facet_types.carbon"] { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.40a)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type (%Self.as_type.40a)]() -> @Convert.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Feed(constants.%e) { +// CHECK:STDOUT: %e.loc11_9.2 => constants.%e +// CHECK:STDOUT: %e.patt.loc11_9.2 => constants.%e +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.1(constants.%Self.25f) { +// CHECK:STDOUT: %Self => constants.%Self.25f +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.19f +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.f92(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: %T.patt => constants.%T +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.db8 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.f92(%T) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.2(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl.f92(type) { +// CHECK:STDOUT: %T => type +// CHECK:STDOUT: %T.patt => type +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.3ea +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Op.type => constants.%Op.type.eb8 +// CHECK:STDOUT: %Op => constants.%Op.444 +// CHECK:STDOUT: %require_complete => constants.%complete_type.473 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.2(type) { +// CHECK:STDOUT: %T => type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %Dest.patt => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.519) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d62 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.40a +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Eats.type) { +// CHECK:STDOUT: %Dest => constants.%Eats.type +// CHECK:STDOUT: %Dest.patt => constants.%Eats.type +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.af9 +// CHECK:STDOUT: %Self => constants.%Self.519 +// CHECK:STDOUT: %Convert.type => constants.%Convert.type.9a9 +// CHECK:STDOUT: %Convert => constants.%Convert.35d +// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.9a7 +// CHECK:STDOUT: %assoc0 => constants.%assoc0.ceb +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- toolchain/testing/min_prelude/facet_types.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] +// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] +// CHECK:STDOUT: %As.type.b51: type = generic_interface_type @As [concrete] +// CHECK:STDOUT: %As.generic: %As.type.b51 = struct_value () [concrete] +// CHECK:STDOUT: %As.type.8ba: type = facet_type <@As, @As(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.b4e: %As.type.8ba = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Self.as_type.7f0: type = facet_access_type %Self.b4e [symbolic] +// CHECK:STDOUT: %Convert.type.ad1: type = fn_type @Convert.1, @As(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.0ed: %Convert.type.ad1 = struct_value () [symbolic] +// CHECK:STDOUT: %As.assoc_type: type = assoc_entity_type %As.type.8ba [symbolic] +// CHECK:STDOUT: %assoc0.ac5: %As.assoc_type = assoc_entity element0, @As.%Convert.decl [symbolic] +// CHECK:STDOUT: %ImplicitAs.type.96f: type = generic_interface_type @ImplicitAs [concrete] +// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.96f = struct_value () [concrete] +// CHECK:STDOUT: %ImplicitAs.type.07f: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] +// CHECK:STDOUT: %Self.0f3: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic] +// CHECK:STDOUT: %Self.as_type.419: type = facet_access_type %Self.0f3 [symbolic] +// CHECK:STDOUT: %Convert.type.4cf: type = fn_type @Convert.2, @ImplicitAs(%Dest) [symbolic] +// CHECK:STDOUT: %Convert.147: %Convert.type.4cf = struct_value () [symbolic] +// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type %ImplicitAs.type.07f [symbolic] +// CHECK:STDOUT: %assoc0.a50: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic] +// CHECK:STDOUT: %BitAnd.type: type = facet_type <@BitAnd> [concrete] +// CHECK:STDOUT: %Self.e44: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type.560: type = facet_access_type %Self.e44 [symbolic] +// CHECK:STDOUT: %Op.type.613: type = fn_type @Op.1 [concrete] +// CHECK:STDOUT: %Op.d98: %Op.type.613 = struct_value () [concrete] +// CHECK:STDOUT: %BitAnd.assoc_type: type = assoc_entity_type %BitAnd.type [concrete] +// CHECK:STDOUT: %assoc0.121: %BitAnd.assoc_type = assoc_entity element0, @BitAnd.%Op.decl [concrete] +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] +// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%Op.decl), @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.type.28d: type = fn_type @Op.2, @impl(%T) [symbolic] +// CHECK:STDOUT: %Op.902: %Op.type.28d = struct_value () [symbolic] +// CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic] +// CHECK:STDOUT: %BitAnd.facet: %BitAnd.type = facet_value %T, (%impl_witness) [symbolic] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: file { +// CHECK:STDOUT: package: = namespace [concrete] { +// CHECK:STDOUT: .As = %As.decl +// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl +// CHECK:STDOUT: .BitAnd = %BitAnd.decl +// CHECK:STDOUT: } +// CHECK:STDOUT: %As.decl: %As.type.b51 = interface_decl @As [concrete = constants.%As.generic] { +// CHECK:STDOUT: %Dest.patt.loc9_14.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc9_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc9_14.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc9_14.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { +// CHECK:STDOUT: %Dest.patt.loc13_22.1: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc13_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.loc13_22.1: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc13_22.2 (constants.%Dest)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %BitAnd.decl: type = interface_decl @BitAnd [concrete = constants.%BitAnd.type] {} {} +// CHECK:STDOUT: impl_decl @impl [concrete] { +// CHECK:STDOUT: %T.patt.loc21_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_14.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc21_14.1 [symbolic = %T.loc21_14.2 (constants.%T)] +// CHECK:STDOUT: %BitAnd.ref: type = name_ref BitAnd, file.%BitAnd.decl [concrete = constants.%BitAnd.type] +// CHECK:STDOUT: %T.loc21_14.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc21_14.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %impl_witness: = impl_witness (@impl.%Op.decl), @impl(constants.%T) [symbolic = @impl.%impl_witness (constants.%impl_witness)] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @As(%Dest.loc9_14.1: type) { +// CHECK:STDOUT: %Dest.loc9_14.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc9_14.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc9_14.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc9_14.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest.loc9_14.2)> [symbolic = %As.type (constants.%As.type.8ba)] +// CHECK:STDOUT: %Self.2: %As.type.8ba = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.b4e)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.1, @As(%Dest.loc9_14.2) [symbolic = %Convert.type (constants.%Convert.type.ad1)] +// CHECK:STDOUT: %Convert: @As.%Convert.type (%Convert.type.ad1) = struct_value () [symbolic = %Convert (constants.%Convert.0ed)] +// CHECK:STDOUT: %As.assoc_type: type = assoc_entity_type @As.%As.type (%As.type.8ba) [symbolic = %As.assoc_type (constants.%As.assoc_type)] +// CHECK:STDOUT: %assoc0.loc10_35.2: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc10_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: %Self.1: @As.%As.type (%As.type.8ba) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.b4e)] +// CHECK:STDOUT: %Convert.decl: @As.%Convert.type (%Convert.type.ad1) = fn_decl @Convert.1 [symbolic = @As.%Convert (constants.%Convert.0ed)] { +// CHECK:STDOUT: %self.patt: @Convert.1.%Self.as_type.loc10_20.1 (%Self.as_type.7f0) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.1.%Self.as_type.loc10_20.1 (%Self.as_type.7f0) = value_param_pattern %self.patt, call_param0 +// CHECK:STDOUT: %return.patt: @Convert.1.%Dest (%Dest) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.1.%Dest (%Dest) = out_param_pattern %return.patt, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @As.%Dest.loc9_14.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.1.%Self.as_type.loc10_20.1 (%Self.as_type.7f0) = value_param call_param0 +// CHECK:STDOUT: %.loc10_20.1: type = splice_block %.loc10_20.3 [symbolic = %Self.as_type.loc10_20.1 (constants.%Self.as_type.7f0)] { +// CHECK:STDOUT: %.loc10_20.2: @Convert.1.%As.type (%As.type.8ba) = specific_constant @As.%Self.1, @As(constants.%Dest) [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.ref: @Convert.1.%As.type (%As.type.8ba) = name_ref Self, %.loc10_20.2 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc10_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc10_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: %.loc10_20.3: type = converted %Self.ref, %Self.as_type.loc10_20.2 [symbolic = %Self.as_type.loc10_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.1.%Self.as_type.loc10_20.1 (%Self.as_type.7f0) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.1.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.1.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc10_35.1: @As.%As.assoc_type (%As.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc10_35.2 (constants.%assoc0.ac5)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc10_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic interface @ImplicitAs(%Dest.loc13_22.1: type) { +// CHECK:STDOUT: %Dest.loc13_22.2: type = bind_symbolic_name Dest, 0 [symbolic = %Dest.loc13_22.2 (constants.%Dest)] +// CHECK:STDOUT: %Dest.patt.loc13_22.2: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt.loc13_22.2 (constants.%Dest.patt)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest.loc13_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] +// CHECK:STDOUT: %Self.2: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.0f3)] +// CHECK:STDOUT: %Convert.type: type = fn_type @Convert.2, @ImplicitAs(%Dest.loc13_22.2) [symbolic = %Convert.type (constants.%Convert.type.4cf)] +// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.4cf) = struct_value () [symbolic = %Convert (constants.%Convert.147)] +// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type)] +// CHECK:STDOUT: %assoc0.loc14_35.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: interface { +// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.0f3)] +// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type.4cf) = fn_decl @Convert.2 [symbolic = @ImplicitAs.%Convert (constants.%Convert.147)] { +// CHECK:STDOUT: %self.patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param_pattern %self.patt, call_param0 +// CHECK:STDOUT: %return.patt: @Convert.2.%Dest (%Dest) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Convert.2.%Dest (%Dest) = out_param_pattern %return.patt, call_param1 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, @ImplicitAs.%Dest.loc13_22.1 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %self.param: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = value_param call_param0 +// CHECK:STDOUT: %.loc14_20.1: type = splice_block %.loc14_20.3 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] { +// CHECK:STDOUT: %.loc14_20.2: @Convert.2.%ImplicitAs.type (%ImplicitAs.type.07f) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%Dest) [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.ref: @Convert.2.%ImplicitAs.type (%ImplicitAs.type.07f) = name_ref Self, %.loc14_20.2 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: %.loc14_20.3: type = converted %Self.ref, %Self.as_type.loc14_20.2 [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419) = bind_name self, %self.param +// CHECK:STDOUT: %return.param: ref @Convert.2.%Dest (%Dest) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Convert.2.%Dest (%Dest) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0.loc14_35.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc14_35.2 (constants.%assoc0.a50)] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self.1 +// CHECK:STDOUT: .Dest = +// CHECK:STDOUT: .Convert = %assoc0.loc14_35.1 +// CHECK:STDOUT: witness = (%Convert.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @BitAnd { +// CHECK:STDOUT: %Self: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.e44] +// CHECK:STDOUT: %Op.decl: %Op.type.613 = fn_decl @Op.1 [concrete = constants.%Op.d98] { +// CHECK:STDOUT: %self.patt: @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560) = value_param_pattern %self.patt, call_param0 +// CHECK:STDOUT: %other.patt: @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560) = binding_pattern other +// CHECK:STDOUT: %other.param_patt: @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560) = value_param_pattern %other.patt, call_param1 +// CHECK:STDOUT: %return.patt: @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560) = out_param_pattern %return.patt, call_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Self.ref.loc18_37: %BitAnd.type = name_ref Self, @BitAnd.%Self [symbolic = %Self (constants.%Self.e44)] +// CHECK:STDOUT: %Self.as_type.loc18_37: type = facet_access_type %Self.ref.loc18_37 [symbolic = %Self.as_type.loc18_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: %.loc18_37: type = converted %Self.ref.loc18_37, %Self.as_type.loc18_37 [symbolic = %Self.as_type.loc18_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: %self.param: @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560) = value_param call_param0 +// CHECK:STDOUT: %.loc18_15.1: type = splice_block %.loc18_15.2 [symbolic = %Self.as_type.loc18_15.1 (constants.%Self.as_type.560)] { +// CHECK:STDOUT: %Self.ref.loc18_15: %BitAnd.type = name_ref Self, @BitAnd.%Self [symbolic = %Self (constants.%Self.e44)] +// CHECK:STDOUT: %Self.as_type.loc18_15.2: type = facet_access_type %Self.ref.loc18_15 [symbolic = %Self.as_type.loc18_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: %.loc18_15.2: type = converted %Self.ref.loc18_15, %Self.as_type.loc18_15.2 [symbolic = %Self.as_type.loc18_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %self: @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560) = bind_name self, %self.param +// CHECK:STDOUT: %other.param: @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560) = value_param call_param1 +// CHECK:STDOUT: %.loc18_28.1: type = splice_block %.loc18_28.2 [symbolic = %Self.as_type.loc18_15.1 (constants.%Self.as_type.560)] { +// CHECK:STDOUT: %Self.ref.loc18_28: %BitAnd.type = name_ref Self, @BitAnd.%Self [symbolic = %Self (constants.%Self.e44)] +// CHECK:STDOUT: %Self.as_type.loc18_28: type = facet_access_type %Self.ref.loc18_28 [symbolic = %Self.as_type.loc18_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: %.loc18_28.2: type = converted %Self.ref.loc18_28, %Self.as_type.loc18_28 [symbolic = %Self.as_type.loc18_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %other: @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560) = bind_name other, %other.param +// CHECK:STDOUT: %return.param: ref @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560) = out_param call_param2 +// CHECK:STDOUT: %return: ref @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: %assoc0: %BitAnd.assoc_type = assoc_entity element0, %Op.decl [concrete = constants.%assoc0.121] +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Self = %Self +// CHECK:STDOUT: .Op = %assoc0 +// CHECK:STDOUT: witness = (%Op.decl) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @impl(%T.loc21_14.1: type) { +// CHECK:STDOUT: %T.loc21_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc21_14.2 (constants.%T)] +// CHECK:STDOUT: %T.patt.loc21_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %impl_witness: = impl_witness (%Op.decl), @impl(%T.loc21_14.2) [symbolic = %impl_witness (constants.%impl_witness)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Op.type: type = fn_type @Op.2, @impl(%T.loc21_14.2) [symbolic = %Op.type (constants.%Op.type.28d)] +// CHECK:STDOUT: %Op: @impl.%Op.type (%Op.type.28d) = struct_value () [symbolic = %Op (constants.%Op.902)] +// CHECK:STDOUT: %require_complete: = require_complete_type @impl.%T.loc21_14.2 (%T) [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %T.ref as %BitAnd.ref { +// CHECK:STDOUT: %Op.decl: @impl.%Op.type (%Op.type.28d) = fn_decl @Op.2 [symbolic = @impl.%Op (constants.%Op.902)] { +// CHECK:STDOUT: %self.patt: @Op.2.%T (%T) = binding_pattern self +// CHECK:STDOUT: %self.param_patt: @Op.2.%T (%T) = value_param_pattern %self.patt, call_param0 +// CHECK:STDOUT: %other.patt: @Op.2.%T (%T) = binding_pattern other +// CHECK:STDOUT: %other.param_patt: @Op.2.%T (%T) = value_param_pattern %other.patt, call_param1 +// CHECK:STDOUT: %return.patt: @Op.2.%T (%T) = return_slot_pattern +// CHECK:STDOUT: %return.param_patt: @Op.2.%T (%T) = out_param_pattern %return.patt, call_param2 +// CHECK:STDOUT: } { +// CHECK:STDOUT: %Self.ref.loc22_37: type = name_ref Self, @impl.%T.ref [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %self.param: @Op.2.%T (%T) = value_param call_param0 +// CHECK:STDOUT: %Self.ref.loc22_15: type = name_ref Self, @impl.%T.ref [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %self: @Op.2.%T (%T) = bind_name self, %self.param +// CHECK:STDOUT: %other.param: @Op.2.%T (%T) = value_param call_param1 +// CHECK:STDOUT: %Self.ref.loc22_28: type = name_ref Self, @impl.%T.ref [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %other: @Op.2.%T (%T) = bind_name other, %other.param +// CHECK:STDOUT: %return.param: ref @Op.2.%T (%T) = out_param call_param2 +// CHECK:STDOUT: %return: ref @Op.2.%T (%T) = return_slot %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Op = %Op.decl +// CHECK:STDOUT: witness = file.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.1(@As.%Dest.loc9_14.1: type, @As.%Self.1: @As.%As.type (%As.type.8ba)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %As.type: type = facet_type <@As, @As(%Dest)> [symbolic = %As.type (constants.%As.type.8ba)] +// CHECK:STDOUT: %Self: %As.type.8ba = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.b4e)] +// CHECK:STDOUT: %Self.as_type.loc10_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc10_20.1 (constants.%Self.as_type.7f0)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.1.%Self.as_type.loc10_20.1 (%Self.as_type.7f0)]() -> @Convert.1.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Convert.2(@ImplicitAs.%Dest.loc13_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f)) { +// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] +// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] +// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.0f3)] +// CHECK:STDOUT: %Self.as_type.loc14_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc14_20.1 (constants.%Self.as_type.419)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Convert.2.%Self.as_type.loc14_20.1 (%Self.as_type.419)]() -> @Convert.2.%Dest (%Dest); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.1(@BitAnd.%Self: %BitAnd.type) { +// CHECK:STDOUT: %Self: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.e44)] +// CHECK:STDOUT: %Self.as_type.loc18_15.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc18_15.1 (constants.%Self.as_type.560)] +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560)](%other.param_patt: @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560)) -> @Op.1.%Self.as_type.loc18_15.1 (%Self.as_type.560); +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic fn @Op.2(@impl.%T.loc21_14.1: type) { +// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: fn[%self.param_patt: @Op.2.%T (%T)](%other.param_patt: @Op.2.%T (%T)) -> @Op.2.%T (%T) = "type.and"; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc9_14.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc9_14.2 => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.1(constants.%Dest, constants.%Self.b4e) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %As.type => constants.%As.type.8ba +// CHECK:STDOUT: %Self => constants.%Self.b4e +// CHECK:STDOUT: %Self.as_type.loc10_20.1 => constants.%Self.as_type.7f0 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(@Convert.1.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @As(%Dest.loc9_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { +// CHECK:STDOUT: %Dest.loc13_22.2 => constants.%Dest +// CHECK:STDOUT: %Dest.patt.loc13_22.2 => constants.%Dest +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Convert.2(constants.%Dest, constants.%Self.0f3) { +// CHECK:STDOUT: %Dest => constants.%Dest +// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.07f +// CHECK:STDOUT: %Self => constants.%Self.0f3 +// CHECK:STDOUT: %Self.as_type.loc14_20.1 => constants.%Self.as_type.419 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(@Convert.2.%Dest) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @ImplicitAs(%Dest.loc13_22.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.1(constants.%Self.e44) { +// CHECK:STDOUT: %Self => constants.%Self.e44 +// CHECK:STDOUT: %Self.as_type.loc18_15.1 => constants.%Self.as_type.560 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(constants.%T) { +// CHECK:STDOUT: %T.loc21_14.2 => constants.%T +// CHECK:STDOUT: %T.patt.loc21_14.2 => constants.%T +// CHECK:STDOUT: %impl_witness => constants.%impl_witness +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(%T.loc21_14.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.2(constants.%T) { +// CHECK:STDOUT: %T => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @Op.1(constants.%BitAnd.facet) { +// CHECK:STDOUT: %Self => constants.%BitAnd.facet +// CHECK:STDOUT: %Self.as_type.loc18_15.1 => constants.%T +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon b/toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon index 8d4b1f77845e..d2105e4424a8 100644 --- a/toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon +++ b/toolchain/check/testdata/builtin_conversions/min_prelude/convert_facet_value_to_narrowed_facet_type.carbon @@ -879,10 +879,10 @@ fn HandleTameAnimal2[W:! Animal & Tame](w: W) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type @HandleTameAnimal2.%W.as_type.loc11_44.2 (%W.as_type) [symbolic = %require_complete (constants.%require_complete.ba9)] -// CHECK:STDOUT: %W.as_wit.iface0.loc12_14.5: = facet_access_witness %W.loc11_22.2, element0 [symbolic = %W.as_wit.iface0.loc12_14.5 (constants.%W.as_wit.iface0)] -// CHECK:STDOUT: %Animal.facet.loc12_14.5: %Animal.type = facet_value %W.as_type.loc11_44.2, (%W.as_wit.iface0.loc12_14.5) [symbolic = %Animal.facet.loc12_14.5 (constants.%Animal.facet)] +// CHECK:STDOUT: %W.as_wit.iface0.loc12_14.3: = facet_access_witness %W.loc11_22.2, element0 [symbolic = %W.as_wit.iface0.loc12_14.3 (constants.%W.as_wit.iface0)] +// CHECK:STDOUT: %Animal.facet.loc12_14.3: %Animal.type = facet_value %W.as_type.loc11_44.2, (%W.as_wit.iface0.loc12_14.3) [symbolic = %Animal.facet.loc12_14.3 (constants.%Animal.facet)] // CHECK:STDOUT: %W.as_wit.iface1.loc12_14.3: = facet_access_witness %W.loc11_22.2, element1 [symbolic = %W.as_wit.iface1.loc12_14.3 (constants.%W.as_wit.iface1)] -// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl.e7b(%Animal.facet.loc12_14.5) [symbolic = %impl_witness (constants.%impl_witness.1d8)] +// CHECK:STDOUT: %impl_witness: = impl_witness (), @impl.e7b(%Animal.facet.loc12_14.3) [symbolic = %impl_witness (constants.%impl_witness.1d8)] // CHECK:STDOUT: %facet_value.loc12_14.3: %facet_type.6ff = facet_value %W.as_type.loc11_44.2, (%impl_witness, %W.as_wit.iface1.loc12_14.3) [symbolic = %facet_value.loc12_14.3 (constants.%facet_value)] // CHECK:STDOUT: %FeedTame2.specific_fn.loc12_3.2: = specific_function constants.%FeedTame2, @FeedTame2(%facet_value.loc12_14.3) [symbolic = %FeedTame2.specific_fn.loc12_3.2 (constants.%FeedTame2.specific_fn)] // CHECK:STDOUT: @@ -890,28 +890,18 @@ fn HandleTameAnimal2[W:! Animal & Tame](w: W) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %FeedTame2.ref: %FeedTame2.type = name_ref FeedTame2, file.%FeedTame2.decl [concrete = constants.%FeedTame2] // CHECK:STDOUT: %w.ref: @HandleTameAnimal2.%W.as_type.loc11_44.2 (%W.as_type) = name_ref w, %w -// CHECK:STDOUT: %W.as_type.loc12_14.1: type = facet_access_type constants.%W [symbolic = %W.as_type.loc11_44.2 (constants.%W.as_type)] -// CHECK:STDOUT: %.loc12_14.1: type = converted constants.%W, %W.as_type.loc12_14.1 [symbolic = %W.as_type.loc11_44.2 (constants.%W.as_type)] -// CHECK:STDOUT: %W.as_wit.iface0.loc12_14.1: = facet_access_witness constants.%W, element0 [symbolic = %W.as_wit.iface0.loc12_14.5 (constants.%W.as_wit.iface0)] -// CHECK:STDOUT: %Animal.facet.loc12_14.1: %Animal.type = facet_value constants.%W.as_type, (%W.as_wit.iface0.loc12_14.1) [symbolic = %Animal.facet.loc12_14.5 (constants.%Animal.facet)] -// CHECK:STDOUT: %.loc12_14.2: %Animal.type = converted %.loc12_14.1, %Animal.facet.loc12_14.1 [symbolic = %Animal.facet.loc12_14.5 (constants.%Animal.facet)] -// CHECK:STDOUT: %W.as_wit.iface0.loc12_14.2: = facet_access_witness constants.%W, element0 [symbolic = %W.as_wit.iface0.loc12_14.5 (constants.%W.as_wit.iface0)] -// CHECK:STDOUT: %Animal.facet.loc12_14.2: %Animal.type = facet_value constants.%W.as_type, (%W.as_wit.iface0.loc12_14.2) [symbolic = %Animal.facet.loc12_14.5 (constants.%Animal.facet)] -// CHECK:STDOUT: %.loc12_14.3: %Animal.type = converted constants.%W.as_type, %Animal.facet.loc12_14.2 [symbolic = %Animal.facet.loc12_14.5 (constants.%Animal.facet)] +// CHECK:STDOUT: %W.as_wit.iface0.loc12_14.1: = facet_access_witness constants.%W, element0 [symbolic = %W.as_wit.iface0.loc12_14.3 (constants.%W.as_wit.iface0)] +// CHECK:STDOUT: %Animal.facet.loc12_14.1: %Animal.type = facet_value constants.%W.as_type, (%W.as_wit.iface0.loc12_14.1) [symbolic = %Animal.facet.loc12_14.3 (constants.%Animal.facet)] +// CHECK:STDOUT: %.loc12_14.1: %Animal.type = converted constants.%W.as_type, %Animal.facet.loc12_14.1 [symbolic = %Animal.facet.loc12_14.3 (constants.%Animal.facet)] // CHECK:STDOUT: %W.as_wit.iface1.loc12_14.1: = facet_access_witness constants.%W, element1 [symbolic = %W.as_wit.iface1.loc12_14.3 (constants.%W.as_wit.iface1)] // CHECK:STDOUT: %facet_value.loc12_14.1: %facet_type.6ff = facet_value constants.%W.as_type, (constants.%impl_witness.1d8, %W.as_wit.iface1.loc12_14.1) [symbolic = %facet_value.loc12_14.3 (constants.%facet_value)] -// CHECK:STDOUT: %.loc12_14.4: %facet_type.6ff = converted constants.%W.as_type, %facet_value.loc12_14.1 [symbolic = %facet_value.loc12_14.3 (constants.%facet_value)] -// CHECK:STDOUT: %W.as_type.loc12_14.2: type = facet_access_type constants.%W [symbolic = %W.as_type.loc11_44.2 (constants.%W.as_type)] -// CHECK:STDOUT: %.loc12_14.5: type = converted constants.%W, %W.as_type.loc12_14.2 [symbolic = %W.as_type.loc11_44.2 (constants.%W.as_type)] -// CHECK:STDOUT: %W.as_wit.iface0.loc12_14.3: = facet_access_witness constants.%W, element0 [symbolic = %W.as_wit.iface0.loc12_14.5 (constants.%W.as_wit.iface0)] -// CHECK:STDOUT: %Animal.facet.loc12_14.3: %Animal.type = facet_value constants.%W.as_type, (%W.as_wit.iface0.loc12_14.3) [symbolic = %Animal.facet.loc12_14.5 (constants.%Animal.facet)] -// CHECK:STDOUT: %.loc12_14.6: %Animal.type = converted %.loc12_14.5, %Animal.facet.loc12_14.3 [symbolic = %Animal.facet.loc12_14.5 (constants.%Animal.facet)] -// CHECK:STDOUT: %W.as_wit.iface0.loc12_14.4: = facet_access_witness constants.%W, element0 [symbolic = %W.as_wit.iface0.loc12_14.5 (constants.%W.as_wit.iface0)] -// CHECK:STDOUT: %Animal.facet.loc12_14.4: %Animal.type = facet_value constants.%W.as_type, (%W.as_wit.iface0.loc12_14.4) [symbolic = %Animal.facet.loc12_14.5 (constants.%Animal.facet)] -// CHECK:STDOUT: %.loc12_14.7: %Animal.type = converted constants.%W.as_type, %Animal.facet.loc12_14.4 [symbolic = %Animal.facet.loc12_14.5 (constants.%Animal.facet)] +// CHECK:STDOUT: %.loc12_14.2: %facet_type.6ff = converted constants.%W.as_type, %facet_value.loc12_14.1 [symbolic = %facet_value.loc12_14.3 (constants.%facet_value)] +// CHECK:STDOUT: %W.as_wit.iface0.loc12_14.2: = facet_access_witness constants.%W, element0 [symbolic = %W.as_wit.iface0.loc12_14.3 (constants.%W.as_wit.iface0)] +// CHECK:STDOUT: %Animal.facet.loc12_14.2: %Animal.type = facet_value constants.%W.as_type, (%W.as_wit.iface0.loc12_14.2) [symbolic = %Animal.facet.loc12_14.3 (constants.%Animal.facet)] +// CHECK:STDOUT: %.loc12_14.3: %Animal.type = converted constants.%W.as_type, %Animal.facet.loc12_14.2 [symbolic = %Animal.facet.loc12_14.3 (constants.%Animal.facet)] // CHECK:STDOUT: %W.as_wit.iface1.loc12_14.2: = facet_access_witness constants.%W, element1 [symbolic = %W.as_wit.iface1.loc12_14.3 (constants.%W.as_wit.iface1)] // CHECK:STDOUT: %facet_value.loc12_14.2: %facet_type.6ff = facet_value constants.%W.as_type, (constants.%impl_witness.1d8, %W.as_wit.iface1.loc12_14.2) [symbolic = %facet_value.loc12_14.3 (constants.%facet_value)] -// CHECK:STDOUT: %.loc12_14.8: %facet_type.6ff = converted constants.%W.as_type, %facet_value.loc12_14.2 [symbolic = %facet_value.loc12_14.3 (constants.%facet_value)] +// CHECK:STDOUT: %.loc12_14.4: %facet_type.6ff = converted constants.%W.as_type, %facet_value.loc12_14.2 [symbolic = %facet_value.loc12_14.3 (constants.%facet_value)] // CHECK:STDOUT: %FeedTame2.specific_fn.loc12_3.1: = specific_function %FeedTame2.ref, @FeedTame2(constants.%facet_value) [symbolic = %FeedTame2.specific_fn.loc12_3.2 (constants.%FeedTame2.specific_fn)] // CHECK:STDOUT: %FeedTame2.call: init %empty_tuple.type = call %FeedTame2.specific_fn.loc12_3.1(%w.ref) // CHECK:STDOUT: return @@ -991,7 +981,7 @@ fn HandleTameAnimal2[W:! Animal & Tame](w: W) { // CHECK:STDOUT: %require_complete => constants.%require_complete.ba9 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @impl.e7b(@HandleTameAnimal2.%Animal.facet.loc12_14.5) {} +// CHECK:STDOUT: specific @impl.e7b(@HandleTameAnimal2.%Animal.facet.loc12_14.3) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @FeedTame2(@HandleTameAnimal2.%facet_value.loc12_14.3) {} // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_to_facet_value.carbon b/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_to_facet_value.carbon deleted file mode 100644 index 6266b696d826..000000000000 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_to_facet_value.carbon +++ /dev/null @@ -1,267 +0,0 @@ -// Part of the Carbon Language project, under the Apache License v2.0 with LLVM -// Exceptions. See /LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// AUTOUPDATE -// TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_to_facet_value.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_to_facet_value.carbon - -// --- core.carbon - -package Core; - -interface ImplicitAs(T:! type) { - fn Convert[self: Self]() -> T; -} - -// --- convert_facet_value_to_facet_value.carbon - -library "[[@TEST_NAME]]"; - -import Core; - -interface Eats {} -interface Animal {} - -// TODO: This may be rejected in the future. -// https://github.com/carbon-language/carbon-lang/issues/4853 -impl Animal as Eats {} - -fn Feed(e:! Eats) {} - -class Goat {} -impl Goat as Animal {} - -fn F() { - Feed(Goat as Animal); -} - -// CHECK:STDOUT: --- core.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic] -// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.96f: type = generic_interface_type @ImplicitAs [concrete] -// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.96f = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.type.07f: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%T) [symbolic] -// CHECK:STDOUT: %Convert: %Convert.type = struct_value () [symbolic] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type %ImplicitAs.type.07f [symbolic] -// CHECK:STDOUT: %assoc0: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.%Convert.decl [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.96f = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] { -// CHECK:STDOUT: %T.patt.loc4_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_22.2 (constants.%T.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %T.loc4_22.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_22.2 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(%T.loc4_22.1: type) { -// CHECK:STDOUT: %T.loc4_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_22.2 (constants.%T)] -// CHECK:STDOUT: %T.patt.loc4_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_22.2 (constants.%T.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T.loc4_22.2)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self.2: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%T.loc4_22.2) [symbolic = %Convert.type (constants.%Convert.type)] -// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type) = struct_value () [symbolic = %Convert (constants.%Convert)] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type)] -// CHECK:STDOUT: %assoc0.loc5_32.2: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_32.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)] -// CHECK:STDOUT: %Convert.decl: @ImplicitAs.%Convert.type (%Convert.type) = fn_decl @Convert [symbolic = @ImplicitAs.%Convert (constants.%Convert)] { -// CHECK:STDOUT: %self.patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = binding_pattern self -// CHECK:STDOUT: %self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param_pattern %self.patt, call_param0 -// CHECK:STDOUT: %return.patt: @Convert.%T (%T) = return_slot_pattern -// CHECK:STDOUT: %return.param_patt: @Convert.%T (%T) = out_param_pattern %return.patt, call_param1 -// CHECK:STDOUT: } { -// CHECK:STDOUT: %T.ref: type = name_ref T, @ImplicitAs.%T.loc4_22.1 [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %self.param: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc5_20.1: type = splice_block %.loc5_20.3 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %.loc5_20.2: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = specific_constant @ImplicitAs.%Self.1, @ImplicitAs(constants.%T) [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.ref: @Convert.%ImplicitAs.type (%ImplicitAs.type.07f) = name_ref Self, %.loc5_20.2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc5_20.3: type = converted %Self.ref, %Self.as_type.loc5_20.2 [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type) = bind_name self, %self.param -// CHECK:STDOUT: %return.param: ref @Convert.%T (%T) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Convert.%T (%T) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc5_32.1: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %Convert.decl [symbolic = %assoc0.loc5_32.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.1 -// CHECK:STDOUT: .T = -// CHECK:STDOUT: .Convert = %assoc0.loc5_32.1 -// CHECK:STDOUT: witness = (%Convert.decl) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(@ImplicitAs.%T.loc4_22.1: type, @ImplicitAs.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.07f)) { -// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.07f)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.07f = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_20.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_20.1 (constants.%Self.as_type)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type.loc5_20.1 (%Self.as_type)]() -> @Convert.%T (%T); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%T) { -// CHECK:STDOUT: %T.loc4_22.2 => constants.%T -// CHECK:STDOUT: %T.patt.loc4_22.2 => constants.%T -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%T, constants.%Self) { -// CHECK:STDOUT: %T => constants.%T -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.07f -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc5_20.1 => constants.%Self.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%T) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%T.loc4_22.2) {} -// CHECK:STDOUT: -// CHECK:STDOUT: --- convert_facet_value_to_facet_value.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: %Eats.type: type = facet_type <@Eats> [concrete] -// CHECK:STDOUT: %Self.1b5: %Eats.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %Animal.type: type = facet_type <@Animal> [concrete] -// CHECK:STDOUT: %Self.fd4: %Animal.type = bind_symbolic_name Self, 0 [symbolic] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness () [concrete] -// CHECK:STDOUT: %e: %Eats.type = bind_symbolic_name e, 0 [symbolic] -// CHECK:STDOUT: %e.patt: %Eats.type = symbolic_binding_pattern e, 0 [symbolic] -// CHECK:STDOUT: %Feed.type: type = fn_type @Feed [concrete] -// CHECK:STDOUT: %Feed: %Feed.type = struct_value () [concrete] -// CHECK:STDOUT: %Goat: type = class_type @Goat [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value %Goat, (%impl_witness) [concrete] -// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value %Animal.type, (%impl_witness) [concrete] -// CHECK:STDOUT: %Feed.specific_fn: = specific_function %Feed, @Feed(%Eats.facet) [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: import Core//default -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .Eats = %Eats.decl -// CHECK:STDOUT: .Animal = %Animal.decl -// CHECK:STDOUT: .Feed = %Feed.decl -// CHECK:STDOUT: .Goat = %Goat.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Eats.decl: type = interface_decl @Eats [concrete = constants.%Eats.type] {} {} -// CHECK:STDOUT: %Animal.decl: type = interface_decl @Animal [concrete = constants.%Animal.type] {} {} -// CHECK:STDOUT: impl_decl @impl.d75 [concrete] {} { -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness.loc11: = impl_witness () [concrete = constants.%impl_witness] -// CHECK:STDOUT: %Feed.decl: %Feed.type = fn_decl @Feed [concrete = constants.%Feed] { -// CHECK:STDOUT: %e.patt.loc13_9.1: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc13_9.2 (constants.%e.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %Eats.ref: type = name_ref Eats, file.%Eats.decl [concrete = constants.%Eats.type] -// CHECK:STDOUT: %e.loc13_9.1: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc13_9.2 (constants.%e)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %Goat.decl: type = class_decl @Goat [concrete = constants.%Goat] {} {} -// CHECK:STDOUT: impl_decl @impl.27e [concrete] {} { -// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness.loc16: = impl_witness () [concrete = constants.%impl_witness] -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Eats { -// CHECK:STDOUT: %Self: %Eats.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1b5] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: witness = () -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: interface @Animal { -// CHECK:STDOUT: %Self: %Animal.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.fd4] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: witness = () -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.d75: %Animal.ref as %Eats.ref { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness.loc11 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: impl @impl.27e: %Goat.ref as %Animal.ref { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: witness = file.%impl_witness.loc16 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @Goat { -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete = constants.%complete_type] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%Goat -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Feed(%e.loc13_9.1: %Eats.type) { -// CHECK:STDOUT: %e.loc13_9.2: %Eats.type = bind_symbolic_name e, 0 [symbolic = %e.loc13_9.2 (constants.%e)] -// CHECK:STDOUT: %e.patt.loc13_9.2: %Eats.type = symbolic_binding_pattern e, 0 [symbolic = %e.patt.loc13_9.2 (constants.%e.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%e.patt.loc13_9.1: %Eats.type) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] -// CHECK:STDOUT: %Goat.ref: type = name_ref Goat, file.%Goat.decl [concrete = constants.%Goat] -// CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] -// CHECK:STDOUT: %Animal.facet: %Animal.type = facet_value constants.%Goat, (constants.%impl_witness) [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %.loc19_13: %Animal.type = converted %Goat.ref, %Animal.facet [concrete = constants.%Animal.facet] -// CHECK:STDOUT: %Eats.facet: %Eats.type = facet_value constants.%Animal.type, (constants.%impl_witness) [concrete = constants.%Eats.facet] -// CHECK:STDOUT: %.loc19_22: %Eats.type = converted %.loc19_13, %Eats.facet [concrete = constants.%Eats.facet] -// CHECK:STDOUT: %Feed.specific_fn: = specific_function %Feed.ref, @Feed(constants.%Eats.facet) [concrete = constants.%Feed.specific_fn] -// CHECK:STDOUT: %Feed.call: init %empty_tuple.type = call %Feed.specific_fn() -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Feed(constants.%e) { -// CHECK:STDOUT: %e.loc13_9.2 => constants.%e -// CHECK:STDOUT: %e.patt.loc13_9.2 => constants.%e -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Feed(constants.%Eats.facet) { -// CHECK:STDOUT: %e.loc13_9.2 => constants.%Eats.facet -// CHECK:STDOUT: %e.patt.loc13_9.2 => constants.%Eats.facet -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_blanket_impl.carbon b/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_blanket_impl.carbon index 539e235aab5d..cb61d1202698 100644 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_blanket_impl.carbon +++ b/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_blanket_impl.carbon @@ -273,18 +273,12 @@ fn HandleAnimal[T:! Animal](a: T) { Feed(a); } // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] // CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc13_32.2 (%T.as_type.2ad) = name_ref a, %a -// CHECK:STDOUT: %T.as_type.loc13_43.1: type = facet_access_type constants.%T.fd4 [symbolic = %T.as_type.loc13_32.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %.loc13_43.1: type = converted constants.%T.fd4, %T.as_type.loc13_43.1 [symbolic = %T.as_type.loc13_32.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %.loc13_43.2: %Animal.type = converted %.loc13_43.1, constants.%T.fd4 [symbolic = %T.loc13_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %.loc13_43.3: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc13_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %.loc13_43.1: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc13_17.2 (constants.%T.fd4)] // CHECK:STDOUT: %Eats.facet.loc13_43.1: %Eats.type = facet_value constants.%T.as_type.2ad, (constants.%impl_witness.11010a.2) [symbolic = %Eats.facet.loc13_43.3 (constants.%Eats.facet)] -// CHECK:STDOUT: %.loc13_43.4: %Eats.type = converted constants.%T.as_type.2ad, %Eats.facet.loc13_43.1 [symbolic = %Eats.facet.loc13_43.3 (constants.%Eats.facet)] -// CHECK:STDOUT: %T.as_type.loc13_43.2: type = facet_access_type constants.%T.fd4 [symbolic = %T.as_type.loc13_32.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %.loc13_43.5: type = converted constants.%T.fd4, %T.as_type.loc13_43.2 [symbolic = %T.as_type.loc13_32.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %.loc13_43.6: %Animal.type = converted %.loc13_43.5, constants.%T.fd4 [symbolic = %T.loc13_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %.loc13_43.7: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc13_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %.loc13_43.2: %Eats.type = converted constants.%T.as_type.2ad, %Eats.facet.loc13_43.1 [symbolic = %Eats.facet.loc13_43.3 (constants.%Eats.facet)] +// CHECK:STDOUT: %.loc13_43.3: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc13_17.2 (constants.%T.fd4)] // CHECK:STDOUT: %Eats.facet.loc13_43.2: %Eats.type = facet_value constants.%T.as_type.2ad, (constants.%impl_witness.11010a.2) [symbolic = %Eats.facet.loc13_43.3 (constants.%Eats.facet)] -// CHECK:STDOUT: %.loc13_43.8: %Eats.type = converted constants.%T.as_type.2ad, %Eats.facet.loc13_43.2 [symbolic = %Eats.facet.loc13_43.3 (constants.%Eats.facet)] +// CHECK:STDOUT: %.loc13_43.4: %Eats.type = converted constants.%T.as_type.2ad, %Eats.facet.loc13_43.2 [symbolic = %Eats.facet.loc13_43.3 (constants.%Eats.facet)] // CHECK:STDOUT: %Feed.specific_fn.loc13_37.1: = specific_function %Feed.ref, @Feed(constants.%Eats.facet) [symbolic = %Feed.specific_fn.loc13_37.2 (constants.%Feed.specific_fn)] // CHECK:STDOUT: %Feed.call: init %empty_tuple.type = call %Feed.specific_fn.loc13_37.1(%a.ref) // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon b/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon index 7b493c9973d2..3d6efefc384c 100644 --- a/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon +++ b/toolchain/check/testdata/builtin_conversions/no_prelude/convert_facet_value_value_to_generic_facet_value_value.carbon @@ -444,13 +444,9 @@ fn F() { // CHECK:STDOUT: %.loc23_76.1: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc23_29.2 (constants.%Food.5fe)] // CHECK:STDOUT: %.loc23_76.2: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc23_29.2 (constants.%Food.5fe)] // CHECK:STDOUT: %.loc23_76.3: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc23_29.2 (constants.%Food.5fe)] -// CHECK:STDOUT: %T.as_type.loc23_76: type = facet_access_type constants.%T.fd4 [symbolic = %T.as_type.loc23_47.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %.loc23_76.4: type = converted constants.%T.fd4, %T.as_type.loc23_76 [symbolic = %T.as_type.loc23_47.2 (constants.%T.as_type.2ad)] -// CHECK:STDOUT: %.loc23_76.5: %Animal.type = converted %.loc23_76.4, constants.%T.fd4 [symbolic = %T.loc23_17.2 (constants.%T.fd4)] -// CHECK:STDOUT: %.loc23_76.6: %Edible.type = converted constants.%Food.as_type.fae, constants.%Food.5fe [symbolic = %Food.loc23_29.2 (constants.%Food.5fe)] -// CHECK:STDOUT: %.loc23_76.7: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc23_17.2 (constants.%T.fd4)] +// CHECK:STDOUT: %.loc23_76.4: %Animal.type = converted constants.%T.as_type.2ad, constants.%T.fd4 [symbolic = %T.loc23_17.2 (constants.%T.fd4)] // CHECK:STDOUT: %Eats.facet.loc23_76.1: @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) = facet_value constants.%T.as_type.2ad, (constants.%impl_witness.c7c36b.2) [symbolic = %Eats.facet.loc23_76.2 (constants.%Eats.facet.97e)] -// CHECK:STDOUT: %.loc23_76.8: @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) = converted constants.%T.as_type.2ad, %Eats.facet.loc23_76.1 [symbolic = %Eats.facet.loc23_76.2 (constants.%Eats.facet.97e)] +// CHECK:STDOUT: %.loc23_76.5: @HandleAnimal.%Eats.type (%Eats.type.f54c3d.2) = converted constants.%T.as_type.2ad, %Eats.facet.loc23_76.1 [symbolic = %Eats.facet.loc23_76.2 (constants.%Eats.facet.97e)] // CHECK:STDOUT: %Feed.specific_fn.loc23_64.1: = specific_function %Feed.ref, @Feed(constants.%Food.5fe, constants.%Eats.facet.97e) [symbolic = %Feed.specific_fn.loc23_64.2 (constants.%Feed.specific_fn.387)] // CHECK:STDOUT: %Feed.call: init %empty_tuple.type = call %Feed.specific_fn.loc23_64.1(%a.ref, %food.ref) // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/facet/min_prelude/fail_todo_call_combined_impl_witness.carbon b/toolchain/check/testdata/facet/min_prelude/call_combined_impl_witness.carbon similarity index 82% rename from toolchain/check/testdata/facet/min_prelude/fail_todo_call_combined_impl_witness.carbon rename to toolchain/check/testdata/facet/min_prelude/call_combined_impl_witness.carbon index f5e6a0378981..5104fec85b6b 100644 --- a/toolchain/check/testdata/facet/min_prelude/fail_todo_call_combined_impl_witness.carbon +++ b/toolchain/check/testdata/facet/min_prelude/call_combined_impl_witness.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/fail_todo_call_combined_impl_witness.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/min_prelude/call_combined_impl_witness.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/fail_todo_call_combined_impl_witness.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/min_prelude/call_combined_impl_witness.carbon interface Empty { } @@ -36,24 +36,7 @@ fn G[T:! A & Empty & B](t: T) { T.AA(); T.BB(); - // TODO: Qualified lookup of `AA` and `BB` should also be possible here, using - // the witnesses found in type deduction. - - // CHECK:STDERR: fail_todo_call_combined_impl_witness.carbon:[[@LINE+7]]:3: error: cannot implicitly convert type `T` that implements `Empty & A & B` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: T.(A.AA)(); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_todo_call_combined_impl_witness.carbon:[[@LINE+4]]:3: note: type `Empty & A & B` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: T.(A.AA)(); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: T.(A.AA)(); - // CHECK:STDERR: fail_todo_call_combined_impl_witness.carbon:[[@LINE+7]]:3: error: cannot implicitly convert type `T` that implements `Empty & A & B` into type implementing `B` [ConversionFailureFacetToFacet] - // CHECK:STDERR: T.(B.BB)(); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_todo_call_combined_impl_witness.carbon:[[@LINE+4]]:3: note: type `Empty & A & B` does not implement interface `Core.ImplicitAs(B)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: T.(B.BB)(); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: T.(B.BB)(); } @@ -61,7 +44,7 @@ fn F() { G({} as C); } -// CHECK:STDOUT: --- fail_todo_call_combined_impl_witness.carbon +// CHECK:STDOUT: --- call_combined_impl_witness.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %Empty.type: type = facet_type <@Empty> [concrete] @@ -96,7 +79,7 @@ fn F() { // CHECK:STDOUT: %BitAnd.assoc_type: type = assoc_entity_type %BitAnd.type [concrete] // CHECK:STDOUT: %assoc0.a63: %BitAnd.assoc_type = assoc_entity element0, imports.%Core.import_ref.a93 [concrete] // CHECK:STDOUT: %Op.type.27a: type = fn_type @Op.1 [concrete] -// CHECK:STDOUT: %Self.as_type.19f: type = facet_access_type %Self.25f [symbolic] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.25f [symbolic] // CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic] // CHECK:STDOUT: %T.patt.e01: type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %impl_witness.db8: = impl_witness (imports.%Core.import_ref.1e6), @impl.f92(%T.8b3) [symbolic] @@ -133,26 +116,6 @@ fn F() { // CHECK:STDOUT: %.a5b: type = fn_type_with_self_type %BB.type.64d, %B.facet.abf [symbolic] // CHECK:STDOUT: %impl.elem0.097: %.a5b = impl_witness_access %T.as_wit.iface2, element0 [symbolic] // CHECK:STDOUT: %specific_fn.9fa: = specific_function %impl.elem0.097, @BB.1(%B.facet.abf) [symbolic] -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.d62: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] -// CHECK:STDOUT: %Self.519: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic] -// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] -// CHECK:STDOUT: %Convert.type.275: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic] -// CHECK:STDOUT: %Convert.42e: %Convert.type.275 = struct_value () [symbolic] -// CHECK:STDOUT: %Self.as_type.40a: type = facet_access_type %Self.519 [symbolic] -// CHECK:STDOUT: %ImplicitAs.assoc_type.837: type = assoc_entity_type %ImplicitAs.type.d62 [symbolic] -// CHECK:STDOUT: %assoc0.02f: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.2d2: type = facet_type <@ImplicitAs, @ImplicitAs(%A.type)> [concrete] -// CHECK:STDOUT: %Convert.type.597: type = fn_type @Convert, @ImplicitAs(%A.type) [concrete] -// CHECK:STDOUT: %Convert.d1e: %Convert.type.597 = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.assoc_type.568: type = assoc_entity_type %ImplicitAs.type.2d2 [concrete] -// CHECK:STDOUT: %assoc0.e1d: %ImplicitAs.assoc_type.568 = assoc_entity element0, imports.%Core.import_ref.1c7 [concrete] -// CHECK:STDOUT: %assoc0.43d: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.8a4: type = facet_type <@ImplicitAs, @ImplicitAs(%B.type)> [concrete] -// CHECK:STDOUT: %Convert.type.f1c: type = fn_type @Convert, @ImplicitAs(%B.type) [concrete] -// CHECK:STDOUT: %Convert.e93: %Convert.type.f1c = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.assoc_type.f97: type = assoc_entity_type %ImplicitAs.type.8a4 [concrete] -// CHECK:STDOUT: %assoc0.824: %ImplicitAs.assoc_type.f97 = assoc_entity element0, imports.%Core.import_ref.1c7 [concrete] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] @@ -167,7 +130,6 @@ fn F() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .BitAnd = %Core.BitAnd -// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import_ref.ad0 = import_ref Core//prelude, inst100 [no loc], unloaded @@ -180,13 +142,6 @@ fn F() { // CHECK:STDOUT: %Core.import_ref.9c1: type = import_ref Core//prelude, loc21_29, loaded [concrete = constants.%BitAnd.type] // CHECK:STDOUT: %Core.import_ref.1e6: @impl.f92.%Op.type (%Op.type.f99) = import_ref Core//prelude, loc22_42, loaded [symbolic = @impl.f92.%Op (constants.%Op.05a)] // CHECK:STDOUT: %Core.import_ref.5ab3ec.2: type = import_ref Core//prelude, loc21_14, loaded [symbolic = @impl.f92.%T (constants.%T.8b3)] -// CHECK:STDOUT: %Core.import_ref.5ab3ec.3: type = import_ref Core//prelude, loc13_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ff5 = import_ref Core//prelude, inst65 [no loc], unloaded -// CHECK:STDOUT: %Core.import_ref.630: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%assoc0 (constants.%assoc0.43d)] -// CHECK:STDOUT: %Core.Convert = import_ref Core//prelude, Convert, unloaded -// CHECK:STDOUT: %Core.import_ref.5ab3ec.4: type = import_ref Core//prelude, loc13_22, loaded [symbolic = @ImplicitAs.%Dest (constants.%Dest)] -// CHECK:STDOUT: %Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) = import_ref Core//prelude, inst65 [no loc], loaded [symbolic = @ImplicitAs.%Self (constants.%Self.519)] -// CHECK:STDOUT: %Core.import_ref.1c7: @ImplicitAs.%Convert.type (%Convert.type.275) = import_ref Core//prelude, loc14_35, loaded [symbolic = @ImplicitAs.%Convert (constants.%Convert.42e)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -296,26 +251,6 @@ fn F() { // CHECK:STDOUT: witness = (imports.%Core.Op) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.5ab3ec.3: type) [from "toolchain/testing/min_prelude/facet_types.carbon"] { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] -// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.275)] -// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.275) = struct_value () [symbolic = %Convert (constants.%Convert.42e)] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.837)] -// CHECK:STDOUT: %assoc0: @ImplicitAs.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.837) = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic = %assoc0 (constants.%assoc0.02f)] -// CHECK:STDOUT: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%Core.import_ref.ff5 -// CHECK:STDOUT: .Convert = imports.%Core.import_ref.630 -// CHECK:STDOUT: witness = (imports.%Core.Convert) -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: impl @impl.d78: %C.ref as %Empty.ref { // CHECK:STDOUT: !members: // CHECK:STDOUT: witness = file.%impl_witness.loc24 @@ -381,9 +316,9 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Op.1(imports.%Core.import_ref.040: %BitAnd.type) [from "toolchain/testing/min_prelude/facet_types.carbon"] { // CHECK:STDOUT: %Self: %BitAnd.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.25f)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.19f)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self.as_type (%Self.as_type.19f)](%other.param_patt: @Op.1.%Self.as_type (%Self.as_type.19f)) -> @Op.1.%Self.as_type (%Self.as_type.19f); +// CHECK:STDOUT: fn[%self.param_patt: @Op.1.%Self.as_type (%Self.as_type)](%other.param_patt: @Op.1.%Self.as_type (%Self.as_type)) -> @Op.1.%Self.as_type (%Self.as_type); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @Op.2(imports.%Core.import_ref.5ab3ec.2: type) [from "toolchain/testing/min_prelude/facet_types.carbon"] { @@ -402,15 +337,15 @@ fn F() { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type @G.%T.as_type.loc32_28.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete.383)] // CHECK:STDOUT: %T.as_wit.iface1.loc33_4.2: = facet_access_witness %T.loc32_6.2, element1 [symbolic = %T.as_wit.iface1.loc33_4.2 (constants.%T.as_wit.iface1)] -// CHECK:STDOUT: %A.facet: %A.type = facet_value %T.as_type.loc32_28.2, (%T.as_wit.iface1.loc33_4.2) [symbolic = %A.facet (constants.%A.facet.5b4)] -// CHECK:STDOUT: %.loc33_4.2: type = fn_type_with_self_type constants.%AA.type.b97, %A.facet [symbolic = %.loc33_4.2 (constants.%.860)] +// CHECK:STDOUT: %A.facet.loc33: %A.type = facet_value %T.as_type.loc32_28.2, (%T.as_wit.iface1.loc33_4.2) [symbolic = %A.facet.loc33 (constants.%A.facet.5b4)] +// CHECK:STDOUT: %.loc33_4.2: type = fn_type_with_self_type constants.%AA.type.b97, %A.facet.loc33 [symbolic = %.loc33_4.2 (constants.%.860)] // CHECK:STDOUT: %impl.elem0.loc33_4.2: @G.%.loc33_4.2 (%.860) = impl_witness_access %T.as_wit.iface1.loc33_4.2, element0 [symbolic = %impl.elem0.loc33_4.2 (constants.%impl.elem0.656)] -// CHECK:STDOUT: %specific_fn.loc33_4.2: = specific_function %impl.elem0.loc33_4.2, @AA.1(%A.facet) [symbolic = %specific_fn.loc33_4.2 (constants.%specific_fn.74e)] +// CHECK:STDOUT: %specific_fn.loc33_4.2: = specific_function %impl.elem0.loc33_4.2, @AA.1(%A.facet.loc33) [symbolic = %specific_fn.loc33_4.2 (constants.%specific_fn.74e)] // CHECK:STDOUT: %T.as_wit.iface2.loc34_4.2: = facet_access_witness %T.loc32_6.2, element2 [symbolic = %T.as_wit.iface2.loc34_4.2 (constants.%T.as_wit.iface2)] -// CHECK:STDOUT: %B.facet: %B.type = facet_value %T.as_type.loc32_28.2, (%T.as_wit.iface2.loc34_4.2) [symbolic = %B.facet (constants.%B.facet.abf)] -// CHECK:STDOUT: %.loc34_4.2: type = fn_type_with_self_type constants.%BB.type.64d, %B.facet [symbolic = %.loc34_4.2 (constants.%.a5b)] +// CHECK:STDOUT: %B.facet.loc34: %B.type = facet_value %T.as_type.loc32_28.2, (%T.as_wit.iface2.loc34_4.2) [symbolic = %B.facet.loc34 (constants.%B.facet.abf)] +// CHECK:STDOUT: %.loc34_4.2: type = fn_type_with_self_type constants.%BB.type.64d, %B.facet.loc34 [symbolic = %.loc34_4.2 (constants.%.a5b)] // CHECK:STDOUT: %impl.elem0.loc34_4.2: @G.%.loc34_4.2 (%.a5b) = impl_witness_access %T.as_wit.iface2.loc34_4.2, element0 [symbolic = %impl.elem0.loc34_4.2 (constants.%impl.elem0.097)] -// CHECK:STDOUT: %specific_fn.loc34_4.2: = specific_function %impl.elem0.loc34_4.2, @BB.1(%B.facet) [symbolic = %specific_fn.loc34_4.2 (constants.%specific_fn.9fa)] +// CHECK:STDOUT: %specific_fn.loc34_4.2: = specific_function %impl.elem0.loc34_4.2, @BB.1(%B.facet.loc34) [symbolic = %specific_fn.loc34_4.2 (constants.%specific_fn.9fa)] // CHECK:STDOUT: // CHECK:STDOUT: fn[%T.patt.loc32_6.1: %facet_type.242](%t.param_patt: @G.%T.as_type.loc32_28.2 (%T.as_type)) { // CHECK:STDOUT: !entry: @@ -446,43 +381,48 @@ fn F() { // CHECK:STDOUT: %impl.elem0.loc37: @G.%.loc34_4.2 (%.a5b) = impl_witness_access %T.as_wit.iface2.loc37, element0 [symbolic = %impl.elem0.loc34_4.2 (constants.%impl.elem0.097)] // CHECK:STDOUT: %specific_fn.loc37: = specific_function %impl.elem0.loc37, @BB.1(constants.%B.facet.abf) [symbolic = %specific_fn.loc34_4.2 (constants.%specific_fn.9fa)] // CHECK:STDOUT: %BB.call.loc37: init %empty_tuple.type = call %specific_fn.loc37() -// CHECK:STDOUT: %T.ref.loc49: %facet_type.242 = name_ref T, %T.loc32_6.1 [symbolic = %T.loc32_6.2 (constants.%T.2df)] -// CHECK:STDOUT: %A.ref.loc49: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %AA.ref.loc49: %A.assoc_type = name_ref AA, @A.%assoc0 [concrete = constants.%assoc0.f33] -// CHECK:STDOUT: %.loc49: %A.type = converted %T.ref.loc49, [concrete = ] -// CHECK:STDOUT: %T.ref.loc57: %facet_type.242 = name_ref T, %T.loc32_6.1 [symbolic = %T.loc32_6.2 (constants.%T.2df)] -// CHECK:STDOUT: %B.ref.loc57: type = name_ref B, file.%B.decl [concrete = constants.%B.type] -// CHECK:STDOUT: %BB.ref.loc57: %B.assoc_type = name_ref BB, @B.%assoc0 [concrete = constants.%assoc0.019] -// CHECK:STDOUT: %.loc57: %B.type = converted %T.ref.loc57, [concrete = ] +// CHECK:STDOUT: %T.ref.loc39: %facet_type.242 = name_ref T, %T.loc32_6.1 [symbolic = %T.loc32_6.2 (constants.%T.2df)] +// CHECK:STDOUT: %A.ref.loc39: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %AA.ref.loc39: %A.assoc_type = name_ref AA, @A.%assoc0 [concrete = constants.%assoc0.f33] +// CHECK:STDOUT: %T.as_wit.iface1.loc39: = facet_access_witness constants.%T.2df, element1 [symbolic = %T.as_wit.iface1.loc33_4.2 (constants.%T.as_wit.iface1)] +// CHECK:STDOUT: %T.as_type.loc39: type = facet_access_type constants.%T.2df [symbolic = %T.as_type.loc32_28.2 (constants.%T.as_type)] +// CHECK:STDOUT: %A.facet.loc39: %A.type = facet_value %T.as_type.loc39, (%T.as_wit.iface1.loc39) [symbolic = %A.facet.loc33 (constants.%A.facet.5b4)] +// CHECK:STDOUT: %.loc39: %A.type = converted %T.ref.loc39, %A.facet.loc39 [symbolic = %A.facet.loc33 (constants.%A.facet.5b4)] +// CHECK:STDOUT: %as_wit.iface0.loc39: = facet_access_witness %.loc39, element0 [symbolic = %T.as_wit.iface1.loc33_4.2 (constants.%T.as_wit.iface1)] +// CHECK:STDOUT: %impl.elem0.loc39: @G.%.loc33_4.2 (%.860) = impl_witness_access %as_wit.iface0.loc39, element0 [symbolic = %impl.elem0.loc33_4.2 (constants.%impl.elem0.656)] +// CHECK:STDOUT: %specific_fn.loc39: = specific_function %impl.elem0.loc39, @AA.1(constants.%A.facet.5b4) [symbolic = %specific_fn.loc33_4.2 (constants.%specific_fn.74e)] +// CHECK:STDOUT: %AA.call.loc39: init %empty_tuple.type = call %specific_fn.loc39() +// CHECK:STDOUT: %T.ref.loc40: %facet_type.242 = name_ref T, %T.loc32_6.1 [symbolic = %T.loc32_6.2 (constants.%T.2df)] +// CHECK:STDOUT: %B.ref.loc40: type = name_ref B, file.%B.decl [concrete = constants.%B.type] +// CHECK:STDOUT: %BB.ref.loc40: %B.assoc_type = name_ref BB, @B.%assoc0 [concrete = constants.%assoc0.019] +// CHECK:STDOUT: %T.as_wit.iface2.loc40: = facet_access_witness constants.%T.2df, element2 [symbolic = %T.as_wit.iface2.loc34_4.2 (constants.%T.as_wit.iface2)] +// CHECK:STDOUT: %T.as_type.loc40: type = facet_access_type constants.%T.2df [symbolic = %T.as_type.loc32_28.2 (constants.%T.as_type)] +// CHECK:STDOUT: %B.facet.loc40: %B.type = facet_value %T.as_type.loc40, (%T.as_wit.iface2.loc40) [symbolic = %B.facet.loc34 (constants.%B.facet.abf)] +// CHECK:STDOUT: %.loc40: %B.type = converted %T.ref.loc40, %B.facet.loc40 [symbolic = %B.facet.loc34 (constants.%B.facet.abf)] +// CHECK:STDOUT: %as_wit.iface0.loc40: = facet_access_witness %.loc40, element0 [symbolic = %T.as_wit.iface2.loc34_4.2 (constants.%T.as_wit.iface2)] +// CHECK:STDOUT: %impl.elem0.loc40: @G.%.loc34_4.2 (%.a5b) = impl_witness_access %as_wit.iface0.loc40, element0 [symbolic = %impl.elem0.loc34_4.2 (constants.%impl.elem0.097)] +// CHECK:STDOUT: %specific_fn.loc40: = specific_function %impl.elem0.loc40, @BB.1(constants.%B.facet.abf) [symbolic = %specific_fn.loc34_4.2 (constants.%specific_fn.9fa)] +// CHECK:STDOUT: %BB.call.loc40: init %empty_tuple.type = call %specific_fn.loc40() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Convert(imports.%Core.import_ref.5ab3ec.4: type, imports.%Core.import_ref.ce1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.d62)) [from "toolchain/testing/min_prelude/facet_types.carbon"] { -// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] -// CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] -// CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.40a)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type (%Self.as_type.40a)]() -> @Convert.%Dest (%Dest); -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G] -// CHECK:STDOUT: %.loc61_6.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc44_6.1: %empty_struct_type = struct_literal () // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc61_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc61_6.3: init %C = class_init (), %.loc61_6.2 [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc61_6.4: ref %C = temporary %.loc61_6.2, %.loc61_6.3 -// CHECK:STDOUT: %.loc61_8.1: ref %C = converted %.loc61_6.1, %.loc61_6.4 -// CHECK:STDOUT: %facet_value.loc61_12.1: %facet_type.242 = facet_value constants.%C, (constants.%impl_witness.1bc, constants.%impl_witness.97a, constants.%impl_witness.fe4) [concrete = constants.%facet_value] -// CHECK:STDOUT: %.loc61_12.1: %facet_type.242 = converted constants.%C, %facet_value.loc61_12.1 [concrete = constants.%facet_value] -// CHECK:STDOUT: %facet_value.loc61_12.2: %facet_type.242 = facet_value constants.%C, (constants.%impl_witness.1bc, constants.%impl_witness.97a, constants.%impl_witness.fe4) [concrete = constants.%facet_value] -// CHECK:STDOUT: %.loc61_12.2: %facet_type.242 = converted constants.%C, %facet_value.loc61_12.2 [concrete = constants.%facet_value] +// CHECK:STDOUT: %.loc44_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc44_6.3: init %C = class_init (), %.loc44_6.2 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc44_6.4: ref %C = temporary %.loc44_6.2, %.loc44_6.3 +// CHECK:STDOUT: %.loc44_8.1: ref %C = converted %.loc44_6.1, %.loc44_6.4 +// CHECK:STDOUT: %facet_value.loc44_12.1: %facet_type.242 = facet_value constants.%C, (constants.%impl_witness.1bc, constants.%impl_witness.97a, constants.%impl_witness.fe4) [concrete = constants.%facet_value] +// CHECK:STDOUT: %.loc44_12.1: %facet_type.242 = converted constants.%C, %facet_value.loc44_12.1 [concrete = constants.%facet_value] +// CHECK:STDOUT: %facet_value.loc44_12.2: %facet_type.242 = facet_value constants.%C, (constants.%impl_witness.1bc, constants.%impl_witness.97a, constants.%impl_witness.fe4) [concrete = constants.%facet_value] +// CHECK:STDOUT: %.loc44_12.2: %facet_type.242 = converted constants.%C, %facet_value.loc44_12.2 [concrete = constants.%facet_value] // CHECK:STDOUT: %G.specific_fn: = specific_function %G.ref, @G(constants.%facet_value) [concrete = constants.%G.specific_fn] -// CHECK:STDOUT: %.loc61_8.2: %C = bind_value %.loc61_8.1 -// CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.specific_fn(%.loc61_8.2) +// CHECK:STDOUT: %.loc44_8.2: %C = bind_value %.loc44_8.1 +// CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.specific_fn(%.loc44_8.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -496,7 +436,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: specific @Op.1(constants.%Self.25f) { // CHECK:STDOUT: %Self => constants.%Self.25f -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.19f +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl.f92(constants.%T.8b3) { @@ -538,51 +478,9 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: specific @BB.1(constants.%B.facet.abf) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { -// CHECK:STDOUT: %Dest => constants.%Dest -// CHECK:STDOUT: %Dest.patt => constants.%Dest -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @AA.1(@G.%A.facet.loc33) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(%Dest) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.519) { -// CHECK:STDOUT: %Dest => constants.%Dest -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d62 -// CHECK:STDOUT: %Self => constants.%Self.519 -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.40a -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%A.type) { -// CHECK:STDOUT: %Dest => constants.%A.type -// CHECK:STDOUT: %Dest.patt => constants.%A.type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2d2 -// CHECK:STDOUT: %Self => constants.%Self.519 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.597 -// CHECK:STDOUT: %Convert => constants.%Convert.d1e -// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.568 -// CHECK:STDOUT: %assoc0 => constants.%assoc0.e1d -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%B.type) { -// CHECK:STDOUT: %Dest => constants.%B.type -// CHECK:STDOUT: %Dest.patt => constants.%B.type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.8a4 -// CHECK:STDOUT: %Self => constants.%Self.519 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.f1c -// CHECK:STDOUT: %Convert => constants.%Convert.e93 -// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.f97 -// CHECK:STDOUT: %assoc0 => constants.%assoc0.824 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @AA.1(@G.%A.facet) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @BB.1(@G.%B.facet) {} +// CHECK:STDOUT: specific @BB.1(@G.%B.facet.loc34) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%facet_value) { // CHECK:STDOUT: %T.loc32_6.2 => constants.%facet_value @@ -592,12 +490,12 @@ fn F() { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete => constants.%complete_type.357 // CHECK:STDOUT: %T.as_wit.iface1.loc33_4.2 => constants.%impl_witness.97a -// CHECK:STDOUT: %A.facet => constants.%A.facet.213 +// CHECK:STDOUT: %A.facet.loc33 => constants.%A.facet.213 // CHECK:STDOUT: %.loc33_4.2 => constants.%.4b2 // CHECK:STDOUT: %impl.elem0.loc33_4.2 => constants.%AA.95d // CHECK:STDOUT: %specific_fn.loc33_4.2 => constants.%AA.specific_fn // CHECK:STDOUT: %T.as_wit.iface2.loc34_4.2 => constants.%impl_witness.fe4 -// CHECK:STDOUT: %B.facet => constants.%B.facet.f74 +// CHECK:STDOUT: %B.facet.loc34 => constants.%B.facet.f74 // CHECK:STDOUT: %.loc34_4.2 => constants.%.2b4 // CHECK:STDOUT: %impl.elem0.loc34_4.2 => constants.%BB.fe8 // CHECK:STDOUT: %specific_fn.loc34_4.2 => constants.%BB.specific_fn diff --git a/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_alias.carbon b/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_alias.carbon index 757906f19794..6e715aaf9fd2 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_alias.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_alias.carbon @@ -26,6 +26,10 @@ interface I { interface J { alias U = I.T; + // CHECK:STDERR: fail_alias_to_different_interface.carbon:[[@LINE+11]]:13: error: semantics TODO: `impl lookup on incomplete facet type` [SemanticsTodo] + // CHECK:STDERR: fn F() -> U; + // CHECK:STDERR: ^ + // CHECK:STDERR: // CHECK:STDERR: fail_alias_to_different_interface.carbon:[[@LINE+7]]:13: error: cannot implicitly convert type `Self` that implements `J` into type implementing `I` [ConversionFailureFacetToFacet] // CHECK:STDERR: fn F() -> U; // CHECK:STDERR: ^ @@ -51,6 +55,10 @@ impl forall [V:! J2] V as I2 where .T2 = () {} interface J2 { alias U2 = I2.T2; + // CHECK:STDERR: fail_todo_alias_to_different_interface_with_requires.carbon:[[@LINE+11]]:14: error: semantics TODO: `impl lookup on incomplete facet type` [SemanticsTodo] + // CHECK:STDERR: fn F2() -> U2; + // CHECK:STDERR: ^~ + // CHECK:STDERR: // CHECK:STDERR: fail_todo_alias_to_different_interface_with_requires.carbon:[[@LINE+7]]:14: error: cannot implicitly convert type `Self` that implements `J2` into type implementing `I2` [ConversionFailureFacetToFacet] // CHECK:STDERR: fn F2() -> U2; // CHECK:STDERR: ^~ @@ -269,7 +277,7 @@ interface C { // CHECK:STDOUT: %return.patt: = return_slot_pattern // CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, call_param0 // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc18: %I.type = converted @J.%Self, [concrete = ] +// CHECK:STDOUT: %.loc22: %I.type = converted @J.%Self, [concrete = ] // CHECK:STDOUT: %U.ref: = name_ref U, [concrete = ] // CHECK:STDOUT: %return.param: ref = out_param call_param0 // CHECK:STDOUT: %return: ref = return_slot %return.param @@ -372,28 +380,25 @@ interface C { // CHECK:STDOUT: %I2.facet: %I2.type = facet_value %.Self.as_type, (%.Self.as_wit.iface0) [symbolic_self] // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit.iface0, element0 [symbolic_self] // CHECK:STDOUT: %I2_where.type: type = facet_type <@I2 where %impl.elem0 = %empty_tuple.type> [concrete] -// CHECK:STDOUT: %impl_witness: = impl_witness (%empty_tuple.type), @impl(%V) [symbolic] +// CHECK:STDOUT: %impl_witness.ec95d0.1: = impl_witness (%empty_tuple.type), @impl(%V) [symbolic] // CHECK:STDOUT: %Self.541: %J2.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self.as_type.f5c: type = facet_access_type %Self.541 [symbolic] +// CHECK:STDOUT: %impl_witness.ec95d0.2: = impl_witness (%empty_tuple.type), @impl(%Self.541) [symbolic] // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic] // CHECK:STDOUT: %ImplicitAs.type.d62: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic] // CHECK:STDOUT: %Self.519: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic] // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic] // CHECK:STDOUT: %Convert.type.275: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic] // CHECK:STDOUT: %Convert.42e: %Convert.type.275 = struct_value () [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.519 [symbolic] +// CHECK:STDOUT: %Self.as_type.40a: type = facet_access_type %Self.519 [symbolic] // CHECK:STDOUT: %ImplicitAs.assoc_type.837: type = assoc_entity_type %ImplicitAs.type.d62 [symbolic] // CHECK:STDOUT: %assoc0.02f: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.1c7 [symbolic] -// CHECK:STDOUT: %ImplicitAs.type.40d: type = facet_type <@ImplicitAs, @ImplicitAs(%J2.type)> [concrete] -// CHECK:STDOUT: %Convert.type.099: type = fn_type @Convert, @ImplicitAs(%J2.type) [concrete] -// CHECK:STDOUT: %Convert.7ee: %Convert.type.099 = struct_value () [concrete] -// CHECK:STDOUT: %ImplicitAs.assoc_type.4e8: type = assoc_entity_type %ImplicitAs.type.40d [concrete] -// CHECK:STDOUT: %assoc0.78f: %ImplicitAs.assoc_type.4e8 = assoc_entity element0, imports.%Core.import_ref.1c7 [concrete] -// CHECK:STDOUT: %assoc0.43d: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207 [symbolic] // CHECK:STDOUT: %ImplicitAs.type.2eb: type = facet_type <@ImplicitAs, @ImplicitAs(%I2.type)> [concrete] // CHECK:STDOUT: %Convert.type.b16: type = fn_type @Convert, @ImplicitAs(%I2.type) [concrete] // CHECK:STDOUT: %Convert.b2c: %Convert.type.b16 = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.assoc_type.ede: type = assoc_entity_type %ImplicitAs.type.2eb [concrete] // CHECK:STDOUT: %assoc0.76a: %ImplicitAs.assoc_type.ede = assoc_entity element0, imports.%Core.import_ref.1c7 [concrete] +// CHECK:STDOUT: %assoc0.43d: %ImplicitAs.assoc_type.837 = assoc_entity element0, imports.%Core.import_ref.207 [symbolic] // CHECK:STDOUT: %F2.type: type = fn_type @F2 [concrete] // CHECK:STDOUT: %F2: %F2.type = struct_value () [concrete] // CHECK:STDOUT: %J2.assoc_type: type = assoc_entity_type %J2.type [concrete] @@ -445,7 +450,7 @@ interface C { // CHECK:STDOUT: %J2.ref: type = name_ref J2, file.%J2.decl.loc9 [concrete = constants.%J2.type] // CHECK:STDOUT: %V.loc11_14.1: %J2.type = bind_symbolic_name V, 0 [symbolic = %V.loc11_14.2 (constants.%V)] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl_witness: = impl_witness (constants.%empty_tuple.type), @impl(constants.%V) [symbolic = @impl.%impl_witness (constants.%impl_witness)] +// CHECK:STDOUT: %impl_witness: = impl_witness (constants.%empty_tuple.type), @impl(constants.%V) [symbolic = @impl.%impl_witness (constants.%impl_witness.ec95d0.1)] // CHECK:STDOUT: %J2.decl.loc13: type = interface_decl @J2 [concrete = constants.%J2.type] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -470,8 +475,10 @@ interface C { // CHECK:STDOUT: %return.patt: = return_slot_pattern // CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, call_param0 // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc22_14.1: %J2.type = converted constants.%J2.type, [concrete = ] -// CHECK:STDOUT: %.loc22_14.2: %I2.type = converted @J2.%Self, [concrete = ] +// CHECK:STDOUT: %Self.as_type.loc26_14.2: type = facet_access_type constants.%Self.541 [symbolic = %Self.as_type.loc26_14.1 (constants.%Self.as_type.f5c)] +// CHECK:STDOUT: %.loc26_14.1: type = converted constants.%Self.541, %Self.as_type.loc26_14.2 [symbolic = %Self.as_type.loc26_14.1 (constants.%Self.as_type.f5c)] +// CHECK:STDOUT: %.loc26_14.2: %J2.type = converted %.loc26_14.1, constants.%Self.541 [symbolic = %Self (constants.%Self.541)] +// CHECK:STDOUT: %.loc26_14.3: %I2.type = converted @J2.%Self, [concrete = ] // CHECK:STDOUT: %U2.ref: = name_ref U2, [concrete = ] // CHECK:STDOUT: %return.param: ref = out_param call_param0 // CHECK:STDOUT: %return: ref = return_slot %return.param @@ -514,7 +521,7 @@ interface C { // CHECK:STDOUT: %V.loc11_14.2: %J2.type = bind_symbolic_name V, 0 [symbolic = %V.loc11_14.2 (constants.%V)] // CHECK:STDOUT: %V.patt.loc11_14.2: %J2.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc11_14.2 (constants.%V.patt)] // CHECK:STDOUT: %V.as_type.loc11_22.2: type = facet_access_type %V.loc11_14.2 [symbolic = %V.as_type.loc11_22.2 (constants.%V.as_type)] -// CHECK:STDOUT: %impl_witness: = impl_witness (constants.%empty_tuple.type), @impl(%V.loc11_14.2) [symbolic = %impl_witness (constants.%impl_witness)] +// CHECK:STDOUT: %impl_witness: = impl_witness (constants.%empty_tuple.type), @impl(%V.loc11_14.2) [symbolic = %impl_witness (constants.%impl_witness.ec95d0.1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -528,12 +535,15 @@ interface C { // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)] // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%Dest)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.d62)] // CHECK:STDOUT: %Self: %ImplicitAs.type.d62 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.519)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.40a)] // CHECK:STDOUT: -// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type (%Self.as_type)]() -> @Convert.%Dest (%Dest); +// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self.as_type (%Self.as_type.40a)]() -> @Convert.%Dest (%Dest); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @F2(@J2.%Self: %J2.type) { +// CHECK:STDOUT: %Self: %J2.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.541)] +// CHECK:STDOUT: %Self.as_type.loc26_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc26_14.1 (constants.%Self.as_type.f5c)] +// CHECK:STDOUT: // CHECK:STDOUT: fn() -> ; // CHECK:STDOUT: } // CHECK:STDOUT: @@ -545,11 +555,18 @@ interface C { // CHECK:STDOUT: %V.loc11_14.2 => constants.%V // CHECK:STDOUT: %V.patt.loc11_14.2 => constants.%V // CHECK:STDOUT: %V.as_type.loc11_22.2 => constants.%V.as_type -// CHECK:STDOUT: %impl_witness => constants.%impl_witness +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.ec95d0.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @impl(%V.loc11_14.2) {} // CHECK:STDOUT: +// CHECK:STDOUT: specific @impl(constants.%Self.541) { +// CHECK:STDOUT: %V.loc11_14.2 => constants.%Self.541 +// CHECK:STDOUT: %V.patt.loc11_14.2 => constants.%Self.541 +// CHECK:STDOUT: %V.as_type.loc11_22.2 => constants.%Self.as_type.f5c +// CHECK:STDOUT: %impl_witness => constants.%impl_witness.ec95d0.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) { // CHECK:STDOUT: %Dest => constants.%Dest // CHECK:STDOUT: %Dest.patt => constants.%Dest @@ -563,20 +580,7 @@ interface C { // CHECK:STDOUT: %Dest => constants.%Dest // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.d62 // CHECK:STDOUT: %Self => constants.%Self.519 -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @ImplicitAs(constants.%J2.type) { -// CHECK:STDOUT: %Dest => constants.%J2.type -// CHECK:STDOUT: %Dest.patt => constants.%J2.type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.40d -// CHECK:STDOUT: %Self => constants.%Self.519 -// CHECK:STDOUT: %Convert.type => constants.%Convert.type.099 -// CHECK:STDOUT: %Convert => constants.%Convert.7ee -// CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.4e8 -// CHECK:STDOUT: %assoc0 => constants.%assoc0.78f +// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.40a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @ImplicitAs(constants.%I2.type) { @@ -592,7 +596,10 @@ interface C { // CHECK:STDOUT: %assoc0 => constants.%assoc0.76a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F2(constants.%Self.541) {} +// CHECK:STDOUT: specific @F2(constants.%Self.541) { +// CHECK:STDOUT: %Self => constants.%Self.541 +// CHECK:STDOUT: %Self.as_type.loc26_14.1 => constants.%Self.as_type.f5c +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_call_method_alias.carbon // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/generic.carbon b/toolchain/check/testdata/interface/no_prelude/generic.carbon index 32b2f15b8f02..64a7fb81dbb7 100644 --- a/toolchain/check/testdata/interface/no_prelude/generic.carbon +++ b/toolchain/check/testdata/interface/no_prelude/generic.carbon @@ -510,6 +510,10 @@ fn G(T:! Generic(B)) { // CHECK:STDOUT: specific @Generic(constants.%B) { // CHECK:STDOUT: %T.loc4_19.2 => constants.%B // CHECK:STDOUT: %T.patt.loc4_19.2 => constants.%B +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Generic.type => constants.%Generic.type.4ce +// CHECK:STDOUT: %Self.2 => constants.%Self // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%T.bae) { diff --git a/toolchain/check/testdata/where_expr/equal_rewrite.carbon b/toolchain/check/testdata/where_expr/equal_rewrite.carbon index c201b49f408b..5c49c6ac6c7e 100644 --- a/toolchain/check/testdata/where_expr/equal_rewrite.carbon +++ b/toolchain/check/testdata/where_expr/equal_rewrite.carbon @@ -62,7 +62,7 @@ fn Reversed(N:! J where .L = bool and .K = ()) { Alphabetical(N); } -// --- fail_rewrites_mismatch_right.carbon +// --- todo_fail_rewrites_mismatch_right.carbon library "[[@TEST_NAME]]"; @@ -73,20 +73,11 @@ interface O { fn WithInteger(Q:! O where .P = i32) {} fn WithBool(R:! O where .P = bool) { - // CHECK:STDERR: fail_rewrites_mismatch_right.carbon:[[@LINE+10]]:3: error: cannot implicitly convert type `R` that implements `O where .(O.P) = bool` into type implementing `O where .(O.P) = i32` [ConversionFailureFacetToFacet] - // CHECK:STDERR: WithInteger(R); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_rewrites_mismatch_right.carbon:[[@LINE+7]]:3: note: type `O where .(O.P) = bool` does not implement interface `Core.ImplicitAs(O where .(O.P) = i32)` [MissingImplInMemberAccessNote] - // CHECK:STDERR: WithInteger(R); - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_rewrites_mismatch_right.carbon:[[@LINE-9]]:16: note: initializing generic parameter `Q` declared here [InitializingGenericParam] - // CHECK:STDERR: fn WithInteger(Q:! O where .P = i32) {} - // CHECK:STDERR: ^ - // CHECK:STDERR: + // TODO: This should fail. WithInteger(R); } -// --- fail_rewrites_mismatch_left.carbon +// --- todo_fail_rewrites_mismatch_left.carbon library "[[@TEST_NAME]]"; @@ -98,16 +89,7 @@ interface S { fn WithT(V:! S where .T = ()) {} fn WithU(W:! S where .U = ()) { - // CHECK:STDERR: fail_rewrites_mismatch_left.carbon:[[@LINE+10]]:3: error: cannot implicitly convert type `W` that implements `S where .(S.U) = ()` into type implementing `S where .(S.T) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: WithT(W); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_rewrites_mismatch_left.carbon:[[@LINE+7]]:3: note: type `S where .(S.U) = ()` does not implement interface `Core.ImplicitAs(S where .(S.T) = ())` [MissingImplInMemberAccessNote] - // CHECK:STDERR: WithT(W); - // CHECK:STDERR: ^~~~~~~~ - // CHECK:STDERR: fail_rewrites_mismatch_left.carbon:[[@LINE-9]]:10: note: initializing generic parameter `V` declared here [InitializingGenericParam] - // CHECK:STDERR: fn WithT(V:! S where .T = ()) {} - // CHECK:STDERR: ^ - // CHECK:STDERR: + // TODO: This should fail. WithT(W); } @@ -847,17 +829,18 @@ let K: (E where .F = .Self.G) = bool; // CHECK:STDOUT: // CHECK:STDOUT: specific @Alphabetical(@Reversed.%N.loc11_13.2) {} // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_rewrites_mismatch_right.carbon +// CHECK:STDOUT: --- todo_fail_rewrites_mismatch_right.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %O.type: type = facet_type <@O> [concrete] -// CHECK:STDOUT: %Self.040: %O.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self: %O.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %O.assoc_type: type = assoc_entity_type %O.type [concrete] -// CHECK:STDOUT: %assoc0.0e4: %O.assoc_type = assoc_entity element0, @O.%P [concrete] +// CHECK:STDOUT: %assoc0: %O.assoc_type = assoc_entity element0, @O.%P [concrete] // CHECK:STDOUT: %.Self: %O.type = bind_symbolic_name .Self [symbolic_self] +// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self] // CHECK:STDOUT: %.Self.as_wit.iface0: = facet_access_witness %.Self, element0 [symbolic_self] -// CHECK:STDOUT: %O.facet: %O.type = facet_value %.Self.as_type, (%.Self.as_wit.iface0) [symbolic_self] +// CHECK:STDOUT: %O.facet.22f: %O.type = facet_value %.Self.as_type, (%.Self.as_wit.iface0) [symbolic_self] // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit.iface0, element0 [symbolic_self] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] @@ -873,13 +856,16 @@ let K: (E where .F = .Self.G) = bool; // CHECK:STDOUT: %R.patt: %O_where.type.741 = symbolic_binding_pattern R, 0 [symbolic] // CHECK:STDOUT: %WithBool.type: type = fn_type @WithBool [concrete] // CHECK:STDOUT: %WithBool: %WithBool.type = struct_value () [concrete] +// CHECK:STDOUT: %R.as_wit.iface0: = facet_access_witness %R, element0 [symbolic] +// CHECK:STDOUT: %R.as_type: type = facet_access_type %R [symbolic] +// CHECK:STDOUT: %O.facet.3ed: %O_where.type.fe1 = facet_value %R.as_type, (%R.as_wit.iface0) [symbolic] +// CHECK:STDOUT: %WithInteger.specific_fn: = specific_function %WithInteger, @WithInteger(%O.facet.3ed) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int // CHECK:STDOUT: .Bool = %Core.Bool -// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -901,7 +887,7 @@ let K: (E where .F = .Self.G) = bool; // CHECK:STDOUT: %O.ref: type = name_ref O, file.%O.decl [concrete = constants.%O.type] // CHECK:STDOUT: %.Self: %O.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self] // CHECK:STDOUT: %.Self.ref: %O.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %P.ref: %O.assoc_type = name_ref P, @P.%assoc0 [concrete = constants.%assoc0.0e4] +// CHECK:STDOUT: %P.ref: %O.assoc_type = name_ref P, @P.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type] // CHECK:STDOUT: %.loc8_28: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type] // CHECK:STDOUT: %.Self.as_wit.iface0: = facet_access_witness %.Self.ref, element0 [symbolic_self = constants.%.Self.as_wit.iface0] @@ -921,7 +907,7 @@ let K: (E where .F = .Self.G) = bool; // CHECK:STDOUT: %O.ref: type = name_ref O, file.%O.decl [concrete = constants.%O.type] // CHECK:STDOUT: %.Self: %O.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self] // CHECK:STDOUT: %.Self.ref: %O.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %P.ref: %O.assoc_type = name_ref P, @P.%assoc0 [concrete = constants.%assoc0.0e4] +// CHECK:STDOUT: %P.ref: %O.assoc_type = name_ref P, @P.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type] // CHECK:STDOUT: %.loc10_25: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type] // CHECK:STDOUT: %.Self.as_wit.iface0: = facet_access_witness %.Self.ref, element0 [symbolic_self = constants.%.Self.as_wit.iface0] @@ -938,9 +924,9 @@ let K: (E where .F = .Self.G) = bool; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @O { -// CHECK:STDOUT: %Self: %O.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.040] +// CHECK:STDOUT: %Self: %O.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] // CHECK:STDOUT: %P: type = assoc_const_decl @P [concrete] { -// CHECK:STDOUT: %assoc0: %O.assoc_type = assoc_entity element0, @O.%P [concrete = constants.%assoc0.0e4] +// CHECK:STDOUT: %assoc0: %O.assoc_type = assoc_entity element0, @O.%P [concrete = constants.%assoc0] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -970,19 +956,28 @@ let K: (E where .F = .Self.G) = bool; // CHECK:STDOUT: %R.patt.loc10_13.2: %O_where.type.741 = symbolic_binding_pattern R, 0 [symbolic = %R.patt.loc10_13.2 (constants.%R.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %R.as_wit.iface0.loc12_16.2: = facet_access_witness %R.loc10_13.2, element0 [symbolic = %R.as_wit.iface0.loc12_16.2 (constants.%R.as_wit.iface0)] +// CHECK:STDOUT: %R.as_type.loc12_16.2: type = facet_access_type %R.loc10_13.2 [symbolic = %R.as_type.loc12_16.2 (constants.%R.as_type)] +// CHECK:STDOUT: %O.facet.loc12_16.2: %O_where.type.fe1 = facet_value %R.as_type.loc12_16.2, (%R.as_wit.iface0.loc12_16.2) [symbolic = %O.facet.loc12_16.2 (constants.%O.facet.3ed)] +// CHECK:STDOUT: %WithInteger.specific_fn.loc12_3.2: = specific_function constants.%WithInteger, @WithInteger(%O.facet.loc12_16.2) [symbolic = %WithInteger.specific_fn.loc12_3.2 (constants.%WithInteger.specific_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%R.patt.loc10_13.1: %O_where.type.741) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %WithInteger.ref: %WithInteger.type = name_ref WithInteger, file.%WithInteger.decl [concrete = constants.%WithInteger] // CHECK:STDOUT: %R.ref: %O_where.type.741 = name_ref R, %R.loc10_13.1 [symbolic = %R.loc10_13.2 (constants.%R)] -// CHECK:STDOUT: %.loc21: %O_where.type.fe1 = converted %R.ref, [concrete = ] +// CHECK:STDOUT: %R.as_wit.iface0.loc12_16.1: = facet_access_witness constants.%R, element0 [symbolic = %R.as_wit.iface0.loc12_16.2 (constants.%R.as_wit.iface0)] +// CHECK:STDOUT: %R.as_type.loc12_16.1: type = facet_access_type constants.%R [symbolic = %R.as_type.loc12_16.2 (constants.%R.as_type)] +// CHECK:STDOUT: %O.facet.loc12_16.1: %O_where.type.fe1 = facet_value %R.as_type.loc12_16.1, (%R.as_wit.iface0.loc12_16.1) [symbolic = %O.facet.loc12_16.2 (constants.%O.facet.3ed)] +// CHECK:STDOUT: %.loc12: %O_where.type.fe1 = converted %R.ref, %O.facet.loc12_16.1 [symbolic = %O.facet.loc12_16.2 (constants.%O.facet.3ed)] +// CHECK:STDOUT: %WithInteger.specific_fn.loc12_3.1: = specific_function %WithInteger.ref, @WithInteger(constants.%O.facet.3ed) [symbolic = %WithInteger.specific_fn.loc12_3.2 (constants.%WithInteger.specific_fn)] +// CHECK:STDOUT: %WithInteger.call: init %empty_tuple.type = call %WithInteger.specific_fn.loc12_3.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @P(constants.%Self.040) {} +// CHECK:STDOUT: specific @P(constants.%Self) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @P(constants.%O.facet) {} +// CHECK:STDOUT: specific @P(constants.%O.facet.22f) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @WithInteger(constants.%Q) { // CHECK:STDOUT: %Q.loc8_16.2 => constants.%Q @@ -994,19 +989,28 @@ let K: (E where .F = .Self.G) = bool; // CHECK:STDOUT: %R.patt.loc10_13.2 => constants.%R // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_rewrites_mismatch_left.carbon +// CHECK:STDOUT: specific @WithInteger(constants.%O.facet.3ed) { +// CHECK:STDOUT: %Q.loc8_16.2 => constants.%O.facet.3ed +// CHECK:STDOUT: %Q.patt.loc8_16.2 => constants.%O.facet.3ed +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @WithInteger(@WithBool.%O.facet.loc12_16.2) {} +// CHECK:STDOUT: +// CHECK:STDOUT: --- todo_fail_rewrites_mismatch_left.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: %S.type: type = facet_type <@S> [concrete] -// CHECK:STDOUT: %Self.b33: %S.type = bind_symbolic_name Self, 0 [symbolic] +// CHECK:STDOUT: %Self: %S.type = bind_symbolic_name Self, 0 [symbolic] // CHECK:STDOUT: %S.assoc_type: type = assoc_entity_type %S.type [concrete] -// CHECK:STDOUT: %assoc0.720: %S.assoc_type = assoc_entity element0, @S.%T [concrete] +// CHECK:STDOUT: %assoc0: %S.assoc_type = assoc_entity element0, @S.%T [concrete] // CHECK:STDOUT: %assoc1: %S.assoc_type = assoc_entity element1, @S.%U [concrete] // CHECK:STDOUT: %.Self: %S.type = bind_symbolic_name .Self [symbolic_self] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self] // CHECK:STDOUT: %.Self.as_wit.iface0: = facet_access_witness %.Self, element0 [symbolic_self] -// CHECK:STDOUT: %S.facet: %S.type = facet_value %.Self.as_type, (%.Self.as_wit.iface0) [symbolic_self] +// CHECK:STDOUT: %S.facet.140: %S.type = facet_value %.Self.as_type, (%.Self.as_wit.iface0) [symbolic_self] // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit.iface0, element0 [symbolic_self] // CHECK:STDOUT: %S_where.type.15b: type = facet_type <@S where %impl.elem0 = %empty_tuple.type> [concrete] // CHECK:STDOUT: %V: %S_where.type.15b = bind_symbolic_name V, 0 [symbolic] @@ -1019,11 +1023,14 @@ let K: (E where .F = .Self.G) = bool; // CHECK:STDOUT: %W.patt: %S_where.type.0be = symbolic_binding_pattern W, 0 [symbolic] // CHECK:STDOUT: %WithU.type: type = fn_type @WithU [concrete] // CHECK:STDOUT: %WithU: %WithU.type = struct_value () [concrete] +// CHECK:STDOUT: %W.as_wit.iface0: = facet_access_witness %W, element0 [symbolic] +// CHECK:STDOUT: %W.as_type: type = facet_access_type %W [symbolic] +// CHECK:STDOUT: %S.facet.6fe: %S_where.type.15b = facet_value %W.as_type, (%W.as_wit.iface0) [symbolic] +// CHECK:STDOUT: %WithT.specific_fn: = specific_function %WithT, @WithT(%S.facet.6fe) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -1045,7 +1052,7 @@ let K: (E where .F = .Self.G) = bool; // CHECK:STDOUT: %S.ref: type = name_ref S, file.%S.decl [concrete = constants.%S.type] // CHECK:STDOUT: %.Self: %S.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self] // CHECK:STDOUT: %.Self.ref: %S.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %T.ref: %S.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0.720] +// CHECK:STDOUT: %T.ref: %S.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type] // CHECK:STDOUT: %.loc9_22: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type] // CHECK:STDOUT: %.Self.as_wit.iface0: = facet_access_witness %.Self.ref, element0 [symbolic_self = constants.%.Self.as_wit.iface0] @@ -1081,9 +1088,9 @@ let K: (E where .F = .Self.G) = bool; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @S { -// CHECK:STDOUT: %Self: %S.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.b33] +// CHECK:STDOUT: %Self: %S.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self] // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] { -// CHECK:STDOUT: %assoc0: %S.assoc_type = assoc_entity element0, @S.%T [concrete = constants.%assoc0.720] +// CHECK:STDOUT: %assoc0: %S.assoc_type = assoc_entity element0, @S.%T [concrete = constants.%assoc0] // CHECK:STDOUT: } // CHECK:STDOUT: %U: type = assoc_const_decl @U [concrete] { // CHECK:STDOUT: %assoc1: %S.assoc_type = assoc_entity element1, @S.%U [concrete = constants.%assoc1] @@ -1121,34 +1128,52 @@ let K: (E where .F = .Self.G) = bool; // CHECK:STDOUT: %W.patt.loc11_10.2: %S_where.type.0be = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc11_10.2 (constants.%W.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: +// CHECK:STDOUT: %W.as_wit.iface0.loc13_10.2: = facet_access_witness %W.loc11_10.2, element0 [symbolic = %W.as_wit.iface0.loc13_10.2 (constants.%W.as_wit.iface0)] +// CHECK:STDOUT: %W.as_type.loc13_10.2: type = facet_access_type %W.loc11_10.2 [symbolic = %W.as_type.loc13_10.2 (constants.%W.as_type)] +// CHECK:STDOUT: %S.facet.loc13_10.2: %S_where.type.15b = facet_value %W.as_type.loc13_10.2, (%W.as_wit.iface0.loc13_10.2) [symbolic = %S.facet.loc13_10.2 (constants.%S.facet.6fe)] +// CHECK:STDOUT: %WithT.specific_fn.loc13_3.2: = specific_function constants.%WithT, @WithT(%S.facet.loc13_10.2) [symbolic = %WithT.specific_fn.loc13_3.2 (constants.%WithT.specific_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%W.patt.loc11_10.1: %S_where.type.0be) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %WithT.ref: %WithT.type = name_ref WithT, file.%WithT.decl [concrete = constants.%WithT] // CHECK:STDOUT: %W.ref: %S_where.type.0be = name_ref W, %W.loc11_10.1 [symbolic = %W.loc11_10.2 (constants.%W)] -// CHECK:STDOUT: %.loc22: %S_where.type.15b = converted %W.ref, [concrete = ] +// CHECK:STDOUT: %W.as_wit.iface0.loc13_10.1: = facet_access_witness constants.%W, element0 [symbolic = %W.as_wit.iface0.loc13_10.2 (constants.%W.as_wit.iface0)] +// CHECK:STDOUT: %W.as_type.loc13_10.1: type = facet_access_type constants.%W [symbolic = %W.as_type.loc13_10.2 (constants.%W.as_type)] +// CHECK:STDOUT: %S.facet.loc13_10.1: %S_where.type.15b = facet_value %W.as_type.loc13_10.1, (%W.as_wit.iface0.loc13_10.1) [symbolic = %S.facet.loc13_10.2 (constants.%S.facet.6fe)] +// CHECK:STDOUT: %.loc13: %S_where.type.15b = converted %W.ref, %S.facet.loc13_10.1 [symbolic = %S.facet.loc13_10.2 (constants.%S.facet.6fe)] +// CHECK:STDOUT: %WithT.specific_fn.loc13_3.1: = specific_function %WithT.ref, @WithT(constants.%S.facet.6fe) [symbolic = %WithT.specific_fn.loc13_3.2 (constants.%WithT.specific_fn)] +// CHECK:STDOUT: %WithT.call: init %empty_tuple.type = call %WithT.specific_fn.loc13_3.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @T(constants.%Self.b33) {} +// CHECK:STDOUT: specific @T(constants.%Self) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @U(constants.%Self.b33) {} +// CHECK:STDOUT: specific @U(constants.%Self) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @T(constants.%S.facet) {} +// CHECK:STDOUT: specific @T(constants.%S.facet.140) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @WithT(constants.%V) { // CHECK:STDOUT: %V.loc9_10.2 => constants.%V // CHECK:STDOUT: %V.patt.loc9_10.2 => constants.%V // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @U(constants.%S.facet) {} +// CHECK:STDOUT: specific @U(constants.%S.facet.140) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @WithU(constants.%W) { // CHECK:STDOUT: %W.loc11_10.2 => constants.%W // CHECK:STDOUT: %W.patt.loc11_10.2 => constants.%W // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @WithT(constants.%S.facet.6fe) { +// CHECK:STDOUT: %V.loc9_10.2 => constants.%S.facet.6fe +// CHECK:STDOUT: %V.patt.loc9_10.2 => constants.%S.facet.6fe +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @WithT(@WithU.%S.facet.loc13_10.2) {} +// CHECK:STDOUT: // CHECK:STDOUT: --- fail_import_rewrites.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants {