diff --git a/toolchain/check/convert.cpp b/toolchain/check/convert.cpp index 985440093e22..e942c6b97296 100644 --- a/toolchain/check/convert.cpp +++ b/toolchain/check/convert.cpp @@ -954,16 +954,47 @@ struct InheritanceEdge { // derived to base. using InheritancePath = llvm::SmallVector; +// Try to complete the type if it's a class type or contains a class type. This +// allows us to look up information about base and adapt relationships which are +// defined in the class body. +static auto TryToCompleteClassType(Context& context, SemIR::TypeId type_id, + SemIR::LocId loc_id) -> bool { + // We want to complete the type if it _is_ a class, or there's a class type + // somewhere inside it, such as a tuple with a class. + // + // TODO: For now, we use a heuristic to find types that may contain a class + // type. This matches the types that we recurse into in + // TypeCompleter::AddNestedIncompleteTypes. + // + // FacetType is intentionally omitted from this list. We do not recurse into + // facet types looking for class types in TypeCompleter. + if (!(context.types().Is(type_id) || + context.types().Is(type_id) || + context.types().Is(type_id) || + context.types().Is(type_id) || + context.types().Is(type_id) || + context.types().Is(type_id) || + context.types().Is(type_id) || + context.types().Is(type_id))) { + return true; + } + return TryToCompleteType(context, type_id, loc_id); +} + // Computes the inheritance path from class `derived_id` to class `base_id`. // Returns nullopt if `derived_id` is not a class derived from `base_id`. static auto ComputeInheritancePath(Context& context, SemIR::LocId loc_id, SemIR::TypeId derived_id, SemIR::TypeId base_id) -> std::optional { + if (!context.types().Is(derived_id)) { + // Don't try to complete non-class types. + return std::nullopt; + } // We intend for NRVO to be applied to `result`. All `return` statements in // this function should `return result;`. std::optional result(std::in_place); - if (!TryToCompleteType(context, derived_id, loc_id)) { + if (!TryToCompleteClassType(context, derived_id, loc_id)) { // TODO: Should we give an error here? If we don't, and there is an // inheritance path when the class is defined, we may have a coherence // problem. @@ -1473,8 +1504,8 @@ static auto PerformBuiltinConversion(Context& context, SemIR::LocId loc_id, context.types().GetTypeIdForTypeInstId(src_pointer_type->pointee_id); // Try to complete the pointee types so that we can walk through adapters // to their adapted types. - TryToCompleteType(context, target_pointee_id, loc_id); - TryToCompleteType(context, src_pointee_id, loc_id); + TryToCompleteClassType(context, target_pointee_id, loc_id); + TryToCompleteClassType(context, src_pointee_id, loc_id); auto [unqual_target_pointee_type_id, target_quals] = sem_ir.types().GetTransitiveUnqualifiedAdaptedType(target_pointee_id); auto [unqual_src_pointee_type_id, src_quals] = @@ -2009,7 +2040,11 @@ auto Convert(Context& context, SemIR::LocId loc_id, SemIR::InstId expr_id, // TODO: Is there a risk of coherence problems if the source type is // incomplete, but a conversion would have been possible or would have behaved // differently if it were complete? - TryToCompleteType(context, context.insts().Get(expr_id).type_id(), loc_id); + // TODO: We should not need to do this unless we're looking for a base or + // adapt. But lower crashes without it, so we must be failing to complete a + // type somewhere else when it is required. + TryToCompleteClassType(context, context.insts().Get(expr_id).type_id(), + loc_id); // Check whether any builtin conversion applies. expr_id = PerformBuiltinConversion(context, loc_id, expr_id, target); diff --git a/toolchain/check/testdata/facet/convert_class_type_to_generic_facet_value.carbon b/toolchain/check/testdata/facet/convert_class_type_to_generic_facet_value.carbon index d00afd2f1f8c..4d1bcc6f90f1 100644 --- a/toolchain/check/testdata/facet/convert_class_type_to_generic_facet_value.carbon +++ b/toolchain/check/testdata/facet/convert_class_type_to_generic_facet_value.carbon @@ -74,11 +74,11 @@ fn G() { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %Generic.generic: %Generic.type.30d = struct_value () [concrete] // CHECK:STDOUT: %Generic.type.ee14e9.1: type = facet_type <@Generic, @Generic(%Scalar)> [symbolic] -// CHECK:STDOUT: %Self.8ea1ea.1: %Generic.type.ee14e9.1 = symbolic_binding Self, 1 [symbolic] -// CHECK:STDOUT: %Generic.WithSelf.F.type.390775.1: type = fn_type @Generic.WithSelf.F, @Generic.WithSelf(%Scalar, %Self.8ea1ea.1) [symbolic] -// CHECK:STDOUT: %Generic.WithSelf.F.b85a66.1: %Generic.WithSelf.F.type.390775.1 = struct_value () [symbolic] -// CHECK:STDOUT: %Generic.assoc_type.d7021d.1: type = assoc_entity_type @Generic, @Generic(%Scalar) [symbolic] -// CHECK:STDOUT: %assoc0.31052a.1: %Generic.assoc_type.d7021d.1 = assoc_entity element0, @Generic.WithSelf.%Generic.WithSelf.F.decl [symbolic] +// CHECK:STDOUT: %Self.8ea: %Generic.type.ee14e9.1 = symbolic_binding Self, 1 [symbolic] +// CHECK:STDOUT: %Generic.WithSelf.F.type.390: type = fn_type @Generic.WithSelf.F, @Generic.WithSelf(%Scalar, %Self.8ea) [symbolic] +// CHECK:STDOUT: %Generic.WithSelf.F.b85: %Generic.WithSelf.F.type.390 = struct_value () [symbolic] +// CHECK:STDOUT: %Generic.assoc_type.d70: type = assoc_entity_type @Generic, @Generic(%Scalar) [symbolic] +// CHECK:STDOUT: %assoc0.310: %Generic.assoc_type.d70 = assoc_entity element0, @Generic.WithSelf.%Generic.WithSelf.F.decl [symbolic] // CHECK:STDOUT: %GenericParam: type = class_type @GenericParam [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] @@ -87,7 +87,7 @@ fn G() { // CHECK:STDOUT: %.e53: = impl_self_witness %ImplsGeneric, @Generic, @Generic(%GenericParam) [concrete] // CHECK:STDOUT: %Generic.impl_witness: = impl_witness @ImplsGeneric.as.Generic.impl.%Generic.impl_witness_table [concrete] // CHECK:STDOUT: %Self.685: %Generic.type.b40 = symbolic_binding Self, 1 [symbolic] -// CHECK:STDOUT: %Generic.WithSelf.F.type.e39: type = fn_type @Generic.WithSelf.F, @Generic.WithSelf(%GenericParam, %Self.8ea1ea.1) [symbolic] +// CHECK:STDOUT: %Generic.WithSelf.F.type.e39: type = fn_type @Generic.WithSelf.F, @Generic.WithSelf(%GenericParam, %Self.8ea) [symbolic] // CHECK:STDOUT: %Generic.WithSelf.F.d19: %Generic.WithSelf.F.type.e39 = struct_value () [symbolic] // CHECK:STDOUT: %Generic.assoc_type.c13: type = assoc_entity_type @Generic, @Generic(%GenericParam) [concrete] // CHECK:STDOUT: %assoc0.b4a: %Generic.assoc_type.c13 = assoc_entity element0, @Generic.WithSelf.%Generic.WithSelf.F.decl [concrete] @@ -113,11 +113,6 @@ fn G() { // CHECK:STDOUT: %U.af9edd.2: %Generic.type.ee14e9.2 = symbolic_binding U, 1 [symbolic] // CHECK:STDOUT: %PassThroughToGenericMethod.type: type = fn_type @PassThroughToGenericMethod [concrete] // CHECK:STDOUT: %PassThroughToGenericMethod: %PassThroughToGenericMethod.type = struct_value () [concrete] -// CHECK:STDOUT: %Self.8ea1ea.2: %Generic.type.ee14e9.2 = symbolic_binding Self, 1 [symbolic] -// CHECK:STDOUT: %Generic.WithSelf.F.type.390775.2: type = fn_type @Generic.WithSelf.F, @Generic.WithSelf(%T, %Self.8ea1ea.1) [symbolic] -// CHECK:STDOUT: %Generic.WithSelf.F.b85a66.2: %Generic.WithSelf.F.type.390775.2 = struct_value () [symbolic] -// CHECK:STDOUT: %Generic.assoc_type.d7021d.2: type = assoc_entity_type @Generic, @Generic(%T) [symbolic] -// CHECK:STDOUT: %assoc0.31052a.2: %Generic.assoc_type.d7021d.2 = assoc_entity element0, @Generic.WithSelf.%Generic.WithSelf.F.decl [symbolic] // CHECK:STDOUT: %CallGenericMethod.specific_fn.151: = specific_function %CallGenericMethod, @CallGenericMethod(%T, %U.af9edd.2) [symbolic] // CHECK:STDOUT: %H.type: type = fn_type @H [concrete] // CHECK:STDOUT: %H: %H.type = struct_value () [concrete] @@ -206,15 +201,15 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%Scalar.loc4_25.1)> [symbolic = %Generic.type (constants.%Generic.type.ee14e9.1)] -// CHECK:STDOUT: %Self.loc4_33.2: @Generic.%Generic.type (%Generic.type.ee14e9.1) = symbolic_binding Self, 1 [symbolic = %Self.loc4_33.2 (constants.%Self.8ea1ea.1)] +// CHECK:STDOUT: %Self.loc4_33.2: @Generic.%Generic.type (%Generic.type.ee14e9.1) = symbolic_binding Self, 1 [symbolic = %Self.loc4_33.2 (constants.%Self.8ea)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc4_33.1: @Generic.%Generic.type (%Generic.type.ee14e9.1) = symbolic_binding Self, 1 [symbolic = %Self.loc4_33.2 (constants.%Self.8ea1ea.1)] +// CHECK:STDOUT: %Self.loc4_33.1: @Generic.%Generic.type (%Generic.type.ee14e9.1) = symbolic_binding Self, 1 [symbolic = %Self.loc4_33.2 (constants.%Self.8ea)] // CHECK:STDOUT: %Generic.WithSelf.decl = interface_with_self_decl @Generic [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !with Self: -// CHECK:STDOUT: %Generic.WithSelf.F.decl: @Generic.WithSelf.%Generic.WithSelf.F.type (%Generic.WithSelf.F.type.390775.1) = fn_decl @Generic.WithSelf.F [symbolic = @Generic.WithSelf.%Generic.WithSelf.F (constants.%Generic.WithSelf.F.b85a66.1)] {} {} -// CHECK:STDOUT: %assoc0.loc5_9.1: @Generic.WithSelf.%Generic.assoc_type (%Generic.assoc_type.d7021d.1) = assoc_entity element0, %Generic.WithSelf.F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.31052a.1)] +// CHECK:STDOUT: %Generic.WithSelf.F.decl: @Generic.WithSelf.%Generic.WithSelf.F.type (%Generic.WithSelf.F.type.390) = fn_decl @Generic.WithSelf.F [symbolic = @Generic.WithSelf.%Generic.WithSelf.F (constants.%Generic.WithSelf.F.b85)] {} {} +// CHECK:STDOUT: %assoc0.loc5_9.1: @Generic.WithSelf.%Generic.assoc_type (%Generic.assoc_type.d70) = assoc_entity element0, %Generic.WithSelf.F.decl [symbolic = %assoc0.loc5_9.2 (constants.%assoc0.310)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self.loc4_33.1 @@ -328,9 +323,9 @@ fn G() { // CHECK:STDOUT: %Scalar.loc4_25.1 => constants.%Scalar // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic.WithSelf(constants.%Scalar, constants.%Self.8ea1ea.1) {} +// CHECK:STDOUT: specific @Generic.WithSelf(constants.%Scalar, constants.%Self.8ea) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic.WithSelf.F(constants.%Scalar, constants.%Self.8ea1ea.1) {} +// CHECK:STDOUT: specific @Generic.WithSelf.F(constants.%Scalar, constants.%Self.8ea) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%GenericParam) { // CHECK:STDOUT: %Scalar.patt.loc4_25.2 => constants.%Scalar.patt @@ -341,11 +336,11 @@ fn G() { // CHECK:STDOUT: %Self.loc4_33.2 => constants.%Self.685 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic.WithSelf(constants.%GenericParam, constants.%Self.8ea1ea.1) { +// CHECK:STDOUT: specific @Generic.WithSelf(constants.%GenericParam, constants.%Self.8ea) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Scalar => constants.%GenericParam // CHECK:STDOUT: %Generic.type => constants.%Generic.type.b40 -// CHECK:STDOUT: %Self => constants.%Self.8ea1ea.1 +// CHECK:STDOUT: %Self => constants.%Self.8ea // CHECK:STDOUT: %Generic.WithSelf.F.type => constants.%Generic.WithSelf.F.type.e39 // CHECK:STDOUT: %Generic.WithSelf.F => constants.%Generic.WithSelf.F.d19 // CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.c13 @@ -368,10 +363,6 @@ fn G() { // CHECK:STDOUT: specific @Generic(constants.%T) { // CHECK:STDOUT: %Scalar.patt.loc4_25.2 => constants.%Scalar.patt // CHECK:STDOUT: %Scalar.loc4_25.1 => constants.%T -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Generic.type => constants.%Generic.type.ee14e9.2 -// CHECK:STDOUT: %Self.loc4_33.2 => constants.%Self.8ea1ea.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @CallGenericMethod(constants.%T, constants.%U.af9edd.1) { @@ -403,17 +394,6 @@ fn G() { // CHECK:STDOUT: %U.loc21_57.1 => constants.%U.af9edd.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic.WithSelf(constants.%T, constants.%Self.8ea1ea.1) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Scalar => constants.%T -// CHECK:STDOUT: %Generic.type => constants.%Generic.type.ee14e9.2 -// CHECK:STDOUT: %Self => constants.%Self.8ea1ea.1 -// CHECK:STDOUT: %Generic.WithSelf.F.type => constants.%Generic.WithSelf.F.type.390775.2 -// CHECK:STDOUT: %Generic.WithSelf.F => constants.%Generic.WithSelf.F.b85a66.2 -// CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.d7021d.2 -// CHECK:STDOUT: %assoc0.loc5_9.2 => constants.%assoc0.31052a.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: specific @CallGenericMethod(constants.%T, constants.%U.af9edd.2) { // CHECK:STDOUT: %T.patt.loc15_31.2 => constants.%T.patt // CHECK:STDOUT: %T.loc15_31.1 => constants.%T diff --git a/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon b/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon index 8d7757e7f76a..8cdeb498d1b5 100644 --- a/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon +++ b/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon @@ -134,11 +134,6 @@ fn B() { // CHECK:STDOUT: %pattern_type.4e0: type = pattern_type %Generic.type.ee14e9.2 [symbolic] // CHECK:STDOUT: %U.patt.8a6: %pattern_type.4e0 = symbolic_binding_pattern U, 1 [symbolic] // CHECK:STDOUT: %U: %Generic.type.ee14e9.2 = symbolic_binding U, 1 [symbolic] -// CHECK:STDOUT: %Self.8ea1ea.2: %Generic.type.ee14e9.2 = symbolic_binding Self, 1 [symbolic] -// CHECK:STDOUT: %Generic.WithSelf.F.type.390775.2: type = fn_type @Generic.WithSelf.F, @Generic.WithSelf(%T, %Self.8ea1ea.1) [symbolic] -// CHECK:STDOUT: %Generic.WithSelf.F.b85a66.2: %Generic.WithSelf.F.type.390775.2 = struct_value () [symbolic] -// CHECK:STDOUT: %Generic.assoc_type.d7021d.2: type = assoc_entity_type @Generic, @Generic(%T) [symbolic] -// CHECK:STDOUT: %assoc0.31052a.2: %Generic.assoc_type.d7021d.2 = assoc_entity element0, @Generic.WithSelf.%Generic.WithSelf.F.decl [symbolic] // CHECK:STDOUT: %U.as_type: type = facet_access_type %U [symbolic] // CHECK:STDOUT: %pattern_type.70f: type = pattern_type %U.as_type [symbolic] // CHECK:STDOUT: %a.param_patt.98a: %pattern_type.70f = value_param_pattern [symbolic] @@ -150,6 +145,11 @@ fn B() { // CHECK:STDOUT: %CallGenericMethod: %CallGenericMethod.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete.096: = require_complete_type %U.as_type [symbolic] // CHECK:STDOUT: %require_complete.944: = require_complete_type %T [symbolic] +// CHECK:STDOUT: %Self.8ea1ea.2: %Generic.type.ee14e9.2 = symbolic_binding Self, 1 [symbolic] +// CHECK:STDOUT: %Generic.WithSelf.F.type.390775.2: type = fn_type @Generic.WithSelf.F, @Generic.WithSelf(%T, %Self.8ea1ea.1) [symbolic] +// CHECK:STDOUT: %Generic.WithSelf.F.b85a66.2: %Generic.WithSelf.F.type.390775.2 = struct_value () [symbolic] +// CHECK:STDOUT: %Generic.assoc_type.d7021d.2: type = assoc_entity_type @Generic, @Generic(%T) [symbolic] +// CHECK:STDOUT: %assoc0.31052a.2: %Generic.assoc_type.d7021d.2 = assoc_entity element0, @Generic.WithSelf.%Generic.WithSelf.F.decl [symbolic] // CHECK:STDOUT: %require_complete.13f: = require_complete_type %Generic.type.ee14e9.2 [symbolic] // CHECK:STDOUT: %Generic.WithSelf.F.type.a70: type = fn_type @Generic.WithSelf.F, @Generic.WithSelf(%T, %U) [symbolic] // CHECK:STDOUT: %Generic.WithSelf.F.5e8: %Generic.WithSelf.F.type.a70 = struct_value () [symbolic] @@ -446,17 +446,6 @@ fn B() { // CHECK:STDOUT: %Self.loc4_33.2 => constants.%Self.8ea1ea.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic.WithSelf(constants.%T, constants.%Self.8ea1ea.1) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Scalar => constants.%T -// CHECK:STDOUT: %Generic.type => constants.%Generic.type.ee14e9.2 -// CHECK:STDOUT: %Self => constants.%Self.8ea1ea.1 -// CHECK:STDOUT: %Generic.WithSelf.F.type => constants.%Generic.WithSelf.F.type.390775.2 -// CHECK:STDOUT: %Generic.WithSelf.F => constants.%Generic.WithSelf.F.b85a66.2 -// CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.d7021d.2 -// CHECK:STDOUT: %assoc0.loc5_9.2 => constants.%assoc0.31052a.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: specific @CallGenericMethod(constants.%T, constants.%U) { // CHECK:STDOUT: %T.patt.loc15_23.2 => constants.%T.patt // CHECK:STDOUT: %T.loc15_23.1 => constants.%T @@ -473,6 +462,17 @@ fn B() { // CHECK:STDOUT: %s.patt.loc15_67.2 => constants.%s.patt.a4f // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @Generic.WithSelf(constants.%T, constants.%Self.8ea1ea.1) { +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: %Scalar => constants.%T +// CHECK:STDOUT: %Generic.type => constants.%Generic.type.ee14e9.2 +// CHECK:STDOUT: %Self => constants.%Self.8ea1ea.1 +// CHECK:STDOUT: %Generic.WithSelf.F.type => constants.%Generic.WithSelf.F.type.390775.2 +// CHECK:STDOUT: %Generic.WithSelf.F => constants.%Generic.WithSelf.F.b85a66.2 +// CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.d7021d.2 +// CHECK:STDOUT: %assoc0.loc5_9.2 => constants.%assoc0.31052a.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @Generic.WithSelf(constants.%T, constants.%U) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Scalar => constants.%T @@ -546,7 +546,6 @@ fn B() { // CHECK:STDOUT: %pattern_type.bd4: type = pattern_type %I.type.722 [concrete] // CHECK:STDOUT: %T.patt.be3: %pattern_type.bd4 = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %T.a08: %I.type.722 = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %Self.9e2: %I.type.722 = symbolic_binding Self, 2 [symbolic] // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.a08 [symbolic] // CHECK:STDOUT: %pattern_type.d7b: type = pattern_type %T.as_type [symbolic] // CHECK:STDOUT: %t.param_patt.be8: %pattern_type.d7b = value_param_pattern [symbolic] @@ -559,6 +558,7 @@ fn B() { // CHECK:STDOUT: %C.val: %C = struct_value () [concrete] // CHECK:STDOUT: %.793: = impl_self_witness %C, @I, @I(%empty_struct_type, %empty_tuple.type) [concrete] // CHECK:STDOUT: %I.impl_witness.a7c: = impl_witness @C.as.I.impl.%I.impl_witness_table, @C.as.I.impl(%empty_struct_type) [concrete] +// CHECK:STDOUT: %Self.9e2: %I.type.722 = symbolic_binding Self, 2 [symbolic] // CHECK:STDOUT: %complete_type.dfa: = complete_type_witness %I.type.722 [concrete] // CHECK:STDOUT: %I.facet.831: %I.type.722 = facet_value %C, (%I.impl_witness.a7c) [concrete] // CHECK:STDOUT: %pattern_type.98b: type = pattern_type %C [concrete] @@ -789,10 +789,6 @@ fn B() { // CHECK:STDOUT: %Self.loc3_31.2 => constants.%Self.9e2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I.WithSelf(constants.%empty_struct_type, constants.%empty_tuple.type, constants.%Self.299) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%T.a08) { // CHECK:STDOUT: %T.patt.loc9_7.2 => constants.%T.patt.be3 // CHECK:STDOUT: %T.loc9_7.1 => constants.%T.a08 @@ -813,6 +809,10 @@ fn B() { // CHECK:STDOUT: %require_complete => constants.%complete_type.dfa // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: specific @I.WithSelf(constants.%empty_struct_type, constants.%empty_tuple.type, constants.%Self.299) { +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%I.facet.831) { // CHECK:STDOUT: %T.patt.loc9_7.2 => constants.%T.patt.be3 // CHECK:STDOUT: %T.loc9_7.1 => constants.%I.facet.831 @@ -857,7 +857,6 @@ fn B() { // CHECK:STDOUT: %pattern_type.5c6: type = pattern_type %I.type.6c0 [concrete] // CHECK:STDOUT: %T.patt.c4c: %pattern_type.5c6 = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %T.b75: %I.type.6c0 = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %Self.136: %I.type.6c0 = symbolic_binding Self, 2 [symbolic] // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.b75 [symbolic] // CHECK:STDOUT: %pattern_type.67d: type = pattern_type %T.as_type [symbolic] // CHECK:STDOUT: %t.param_patt: %pattern_type.67d = value_param_pattern [symbolic] @@ -1063,14 +1062,6 @@ fn B() { // CHECK:STDOUT: %V.loc3_14.1 => constants.%empty_struct_type // CHECK:STDOUT: %W.patt.loc3_23.2 => constants.%W.patt // CHECK:STDOUT: %W.loc3_23.1 => constants.%empty_struct_type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %I.type => constants.%I.type.6c0 -// CHECK:STDOUT: %Self.loc3_31.2 => constants.%Self.136 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @I.WithSelf(constants.%empty_struct_type, constants.%empty_struct_type, constants.%Self.299) { -// CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%T.b75) { diff --git a/toolchain/check/testdata/facet/convert_facet_value_to_narrowed_facet_type.carbon b/toolchain/check/testdata/facet/convert_facet_value_to_narrowed_facet_type.carbon index 8df366d4537e..e9da21d11ad0 100644 --- a/toolchain/check/testdata/facet/convert_facet_value_to_narrowed_facet_type.carbon +++ b/toolchain/check/testdata/facet/convert_facet_value_to_narrowed_facet_type.carbon @@ -270,13 +270,9 @@ fn CallsWithTypeExplicit(generic U: type) { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats.WithSelf(constants.%Self.23e) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Eats.WithSelf(constants.%Self.23e) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Animal.WithSelf(constants.%Self.f00) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Animal.WithSelf(constants.%Self.f00) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Feed(constants.%T) { // CHECK:STDOUT: %T.patt.loc6_10.2 => constants.%T.patt @@ -522,17 +518,11 @@ fn CallsWithTypeExplicit(generic U: type) { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats.WithSelf(constants.%Self.23e) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Eats.WithSelf(constants.%Self.23e) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Animal.WithSelf(constants.%Self.f00) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Animal.WithSelf(constants.%Self.f00) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Tame.WithSelf(constants.%Self.0f0) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Tame.WithSelf(constants.%Self.0f0) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @FeedTame(constants.%V) { // CHECK:STDOUT: %V.patt.loc7_14.2 => constants.%V.patt @@ -822,13 +812,9 @@ fn CallsWithTypeExplicit(generic U: type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Animal.WithSelf(constants.%Self.f00) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Animal.WithSelf(constants.%Self.f00) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Tame.WithSelf(constants.%Self.0f0) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Tame.WithSelf(constants.%Self.0f0) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @A.as_type.as.Eats.impl(constants.%A) { // CHECK:STDOUT: %A.patt.loc7_15.2 => constants.%A.patt @@ -1040,9 +1026,7 @@ fn CallsWithTypeExplicit(generic U: type) { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @A.WithSelf(constants.%Self) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @A.WithSelf(constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @TakesA(constants.%T) { // CHECK:STDOUT: %T.patt.loc7_12.2 => constants.%T.patt diff --git a/toolchain/check/testdata/facet/convert_facet_value_value_to_blanket_impl.carbon b/toolchain/check/testdata/facet/convert_facet_value_value_to_blanket_impl.carbon index bade648652a7..c4c3cf131d5b 100644 --- a/toolchain/check/testdata/facet/convert_facet_value_value_to_blanket_impl.carbon +++ b/toolchain/check/testdata/facet/convert_facet_value_value_to_blanket_impl.carbon @@ -228,9 +228,7 @@ fn HandleAnimal[T: Animal](a: T) { Feed(a); } // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Animal.WithSelf(constants.%Self.f00) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Animal.WithSelf(constants.%Self.f00) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @A.as_type.as.Eats.impl(constants.%A) { // CHECK:STDOUT: %A.patt.loc18_15.2 => constants.%A.patt diff --git a/toolchain/check/testdata/facet/convert_facet_value_value_to_generic_facet_value_value.carbon b/toolchain/check/testdata/facet/convert_facet_value_value_to_generic_facet_value_value.carbon index 92a9eb5efe01..69838bf0489b 100644 --- a/toolchain/check/testdata/facet/convert_facet_value_value_to_generic_facet_value_value.carbon +++ b/toolchain/check/testdata/facet/convert_facet_value_value_to_generic_facet_value_value.carbon @@ -83,7 +83,6 @@ fn F() { // CHECK:STDOUT: %pattern_type.560: type = pattern_type %Eats.type.eb4 [symbolic] // CHECK:STDOUT: %T.patt.02f: %pattern_type.560 = symbolic_binding_pattern T, 1 [symbolic] // CHECK:STDOUT: %T.b01: %Eats.type.eb4 = symbolic_binding T, 1 [symbolic] -// CHECK:STDOUT: %Self.377: %Eats.type.eb4 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: %T.as_type.b84: type = facet_access_type %T.b01 [symbolic] // CHECK:STDOUT: %pattern_type.371: type = pattern_type %T.as_type.b84 [symbolic] // CHECK:STDOUT: %e.param_patt.32e: %pattern_type.371 = value_param_pattern [symbolic] @@ -565,14 +564,6 @@ fn F() { // CHECK:STDOUT: specific @Eats(constants.%Food.as_type.bca) { // CHECK:STDOUT: %Food.patt.loc21_20.2 => constants.%Food.patt.d47 // CHECK:STDOUT: %Food.loc21_20.1 => constants.%Food.as_type.bca -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Eats.type => constants.%Eats.type.eb4 -// CHECK:STDOUT: %Self.loc21_28.2 => constants.%Self.377 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats.WithSelf(constants.%Food.as_type.bca, constants.%Self.db3) { -// CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Feed(constants.%Food.196, constants.%T.b01) { diff --git a/toolchain/check/testdata/facet/fail_convert_facet_value_to_missing_impl.carbon b/toolchain/check/testdata/facet/fail_convert_facet_value_to_missing_impl.carbon index 9da26c9230bb..39904fe3fc87 100644 --- a/toolchain/check/testdata/facet/fail_convert_facet_value_to_missing_impl.carbon +++ b/toolchain/check/testdata/facet/fail_convert_facet_value_to_missing_impl.carbon @@ -171,13 +171,9 @@ fn HandleAnimal[T: Animal](a: T) { Feed(a); } // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Eats.WithSelf(constants.%Self.23e) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Eats.WithSelf(constants.%Self.23e) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Animal.WithSelf(constants.%Self.f00) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Animal.WithSelf(constants.%Self.f00) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Feed(constants.%T.672) { // CHECK:STDOUT: %T.patt.loc18_10.2 => constants.%T.patt.9e8 diff --git a/toolchain/check/testdata/function/generic/fail_deduce_imported_function.carbon b/toolchain/check/testdata/function/generic/fail_deduce_imported_function.carbon index eff56c5850db..c2a708582d00 100644 --- a/toolchain/check/testdata/function/generic/fail_deduce_imported_function.carbon +++ b/toolchain/check/testdata/function/generic/fail_deduce_imported_function.carbon @@ -121,9 +121,7 @@ fn B() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%T) { // CHECK:STDOUT: %T.patt.loc4_7.2 => constants.%T.patt @@ -259,9 +257,7 @@ fn B() { // CHECK:STDOUT: fn; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @A.loc4(constants.%T) { // CHECK:STDOUT: %T.patt.loc4_7.2 => constants.%T.patt diff --git a/toolchain/check/testdata/impl/generic_redeclaration.carbon b/toolchain/check/testdata/impl/generic_redeclaration.carbon index 4c8229340036..5568f3b83a72 100644 --- a/toolchain/check/testdata/impl/generic_redeclaration.carbon +++ b/toolchain/check/testdata/impl/generic_redeclaration.carbon @@ -434,21 +434,13 @@ impl forall [T: type] T as I { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I.WithSelf(constants.%Self.37e) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @I.WithSelf(constants.%Self.37e) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @J.WithSelf(constants.%Self.653) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @J.WithSelf(constants.%Self.653) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @K.WithSelf(constants.%Self.a32) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @K.WithSelf(constants.%Self.a32) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @L.WithSelf(constants.%Self.480) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @L.WithSelf(constants.%Self.480) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @T.as_type.as.Interface.impl.72f(constants.%T.dda) { // CHECK:STDOUT: %T.patt.loc12_15.2 => constants.%T.patt.1df @@ -618,9 +610,7 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I.WithSelf(constants.%Self.37e) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @I.WithSelf(constants.%Self.37e) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @J.WithSelf(constants.%Self.653) { // CHECK:STDOUT: !definition: diff --git a/toolchain/check/testdata/impl/impl_as_named_constraint.carbon b/toolchain/check/testdata/impl/impl_as_named_constraint.carbon index b6feb7771ae1..d127f975add8 100644 --- a/toolchain/check/testdata/impl/impl_as_named_constraint.carbon +++ b/toolchain/check/testdata/impl/impl_as_named_constraint.carbon @@ -313,6 +313,34 @@ constraint Y { // CHECK:STDERR: impl () as Y {} +// --- fail_todo_member_access_in_extend_require.carbon +library "[[@TEST_NAME]]"; + +interface I { let X: type; } +interface J {} + +impl () as J {} + +constraint GivesI { + extend require impls I where .X impls J; +} + +// When we check this we check that GivesI is complete, which: +// - Forms the self-specific for GivesI's extend require +// - Creates Self.(I.X) which has a LookupImplWitness for `Self as I` +// - Evaluates the witness which finds this impl +// - Deduces for Self which tries to convert Self to type +// - Requires the type of Self to be complete, and its type is GivesI +// - Forms the self-specfic for GivesI's extend require....we have a loop. +// +// TODO: .X = () should satisfy the requirement that .X impls J. We're not +// finding the rewrite when checking requirements. +// CHECK:STDERR: fail_todo_member_access_in_extend_require.carbon:[[@LINE+4]]:1: error: constraint `GivesI where .(I.X) = ()` being implemented requires that `T.(I.X)` implements `J` [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: impl forall [T: type] T as GivesI where .X = () {} +// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// CHECK:STDERR: +impl forall [T: type] T as GivesI where .X = () {} + // CHECK:STDOUT: --- fail_error_self_in_require.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/interface/fail_member_lookup.carbon b/toolchain/check/testdata/interface/fail_member_lookup.carbon index 38932dc91ef0..ff815c84cc35 100644 --- a/toolchain/check/testdata/interface/fail_member_lookup.carbon +++ b/toolchain/check/testdata/interface/fail_member_lookup.carbon @@ -184,9 +184,7 @@ fn G(generic U: Different) -> U.(Interface.T); // CHECK:STDOUT: // CHECK:STDOUT: specific @Interface.WithSelf.F(constants.%Self.3ce) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Different.WithSelf(constants.%Self.8ba) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Different.WithSelf(constants.%Self.8ba) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%U) { // CHECK:STDOUT: %U.patt.loc32_15.2 => constants.%U.patt diff --git a/toolchain/check/testdata/interface/generic.carbon b/toolchain/check/testdata/interface/generic.carbon index fa78c45a0948..74d4f7e84574 100644 --- a/toolchain/check/testdata/interface/generic.carbon +++ b/toolchain/check/testdata/interface/generic.carbon @@ -484,7 +484,7 @@ fn F(unused generic T: Generic((), ())) {} // CHECK:STDOUT: %Generic.type.30d: type = generic_interface_type @Generic [concrete] // CHECK:STDOUT: %Generic.generic: %Generic.type.30d = struct_value () [concrete] // CHECK:STDOUT: %Generic.type.ee1: type = facet_type <@Generic, @Generic(%T.67d)> [symbolic] -// CHECK:STDOUT: %Self.8ea: %Generic.type.ee1 = symbolic_binding Self, 1 [symbolic] +// CHECK:STDOUT: %Self: %Generic.type.ee1 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: %A: type = class_type @A [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] @@ -501,7 +501,6 @@ fn F(unused generic T: Generic((), ())) {} // CHECK:STDOUT: %T.f18: %Generic.type.57d = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %G.type: type = fn_type @G [concrete] // CHECK:STDOUT: %G: %G.type = struct_value () [concrete] -// CHECK:STDOUT: %Self.cb2: %Generic.type.57d = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.f18 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -554,10 +553,10 @@ fn F(unused generic T: Generic((), ())) {} // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%T.loc4_20.1)> [symbolic = %Generic.type (constants.%Generic.type.ee1)] -// CHECK:STDOUT: %Self.loc4_28.2: @Generic.%Generic.type (%Generic.type.ee1) = symbolic_binding Self, 1 [symbolic = %Self.loc4_28.2 (constants.%Self.8ea)] +// CHECK:STDOUT: %Self.loc4_28.2: @Generic.%Generic.type (%Generic.type.ee1) = symbolic_binding Self, 1 [symbolic = %Self.loc4_28.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc4_28.1: @Generic.%Generic.type (%Generic.type.ee1) = symbolic_binding Self, 1 [symbolic = %Self.loc4_28.2 (constants.%Self.8ea)] +// CHECK:STDOUT: %Self.loc4_28.1: @Generic.%Generic.type (%Generic.type.ee1) = symbolic_binding Self, 1 [symbolic = %Self.loc4_28.2 (constants.%Self)] // CHECK:STDOUT: %Generic.WithSelf.decl = interface_with_self_decl @Generic [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -612,7 +611,7 @@ fn F(unused generic T: Generic((), ())) {} // CHECK:STDOUT: %T.loc4_20.1 => constants.%T.67d // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic.WithSelf(constants.%T.67d, constants.%Self.8ea) {} +// CHECK:STDOUT: specific @Generic.WithSelf(constants.%T.67d, constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic(constants.%A) { // CHECK:STDOUT: %T.patt.loc4_20.2 => constants.%T.patt.d47 @@ -627,10 +626,6 @@ fn F(unused generic T: Generic((), ())) {} // CHECK:STDOUT: specific @Generic(constants.%B) { // CHECK:STDOUT: %T.patt.loc4_20.2 => constants.%T.patt.d47 // CHECK:STDOUT: %T.loc4_20.1 => constants.%B -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Generic.type => constants.%Generic.type.57d -// CHECK:STDOUT: %Self.loc4_28.2 => constants.%Self.cb2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%T.f18) { @@ -638,10 +633,6 @@ fn F(unused generic T: Generic((), ())) {} // CHECK:STDOUT: %T.loc10_15.1 => constants.%T.f18 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic.WithSelf(constants.%B, constants.%Self.8ea) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_args_count_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { diff --git a/toolchain/check/testdata/interface/require.carbon b/toolchain/check/testdata/interface/require.carbon index d688a6ac9e2c..42c2ceac0283 100644 --- a/toolchain/check/testdata/interface/require.carbon +++ b/toolchain/check/testdata/interface/require.carbon @@ -552,9 +552,7 @@ interface Z(T: type) { // CHECK:STDOUT: %Self.as_type.loc9_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_11.2 (constants.%Self.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.cb6) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.cb6) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%Self.cb6) { // CHECK:STDOUT: %Self => constants.%Self.cb6 @@ -605,9 +603,7 @@ interface Z(T: type) { // CHECK:STDOUT: %Self.as_type.loc9_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_11.2 (constants.%Self.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.cb6) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.cb6) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%Self.cb6) { // CHECK:STDOUT: %Self => constants.%Self.cb6 diff --git a/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon b/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon index e080ad077ebe..6fd3cf2e244b 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon @@ -4069,9 +4069,7 @@ fn F() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I.WithSelf(constants.%Self) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @I.WithSelf(constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @EchoValue(constants.%ValueT, constants.%value) { // CHECK:STDOUT: %ValueT.patt.loc10_20.2 => constants.%ValueT.patt diff --git a/toolchain/check/testdata/interop/cpp/operators/arithmetic_operators.carbon b/toolchain/check/testdata/interop/cpp/operators/arithmetic_operators.carbon index 2b3064f6e09c..10ed4b4d5942 100644 --- a/toolchain/check/testdata/interop/cpp/operators/arithmetic_operators.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/arithmetic_operators.carbon @@ -1059,8 +1059,6 @@ fn TestUnaryOperators(a: Cpp.Int16, b: Cpp.Int32) { // CHECK:STDOUT: %pattern_type.82d: type = pattern_type %AddAssignWith.type.2c8890.2 [symbolic] // CHECK:STDOUT: %T.patt.a22: %pattern_type.82d = symbolic_binding_pattern T, 1 [symbolic] // CHECK:STDOUT: %T.792: %AddAssignWith.type.2c8890.2 = symbolic_binding T, 1 [symbolic] -// CHECK:STDOUT: %AddAssignWith.assoc_type.8ddaf4.2: type = assoc_entity_type @AddAssignWith.1, @AddAssignWith.1(%U.67d) [symbolic] -// CHECK:STDOUT: %assoc0.8c5739.2: %AddAssignWith.assoc_type.8ddaf4.2 = assoc_entity element0, imports.%Core.import_ref.3b2 [symbolic] // CHECK:STDOUT: %T.as_type.50c: type = facet_access_type %T.792 [symbolic] // CHECK:STDOUT: %pattern_type.643306.2: type = pattern_type %T.as_type.50c [symbolic] // CHECK:STDOUT: %x.patt.227: %pattern_type.643306.2 = ref_binding_pattern x [symbolic] @@ -1068,6 +1066,8 @@ fn TestUnaryOperators(a: Cpp.Int16, b: Cpp.Int32) { // CHECK:STDOUT: %pattern_type.51d1c4.4: type = pattern_type %U.67d [symbolic] // CHECK:STDOUT: %y.param_patt.be3: %pattern_type.51d1c4.4 = value_param_pattern [symbolic] // CHECK:STDOUT: %y.patt.b85: %pattern_type.51d1c4.4 = at_binding_pattern y, %y.param_patt.be3 [symbolic] +// CHECK:STDOUT: %AddAssignWith.assoc_type.8ddaf4.2: type = assoc_entity_type @AddAssignWith.1, @AddAssignWith.1(%U.67d) [symbolic] +// CHECK:STDOUT: %assoc0.8c5739.2: %AddAssignWith.assoc_type.8ddaf4.2 = assoc_entity element0, imports.%Core.import_ref.3b2 [symbolic] // CHECK:STDOUT: %require_complete.2a8: = require_complete_type %AddAssignWith.type.2c8890.2 [symbolic] // CHECK:STDOUT: %assoc0.86d: %AddAssignWith.assoc_type.8ddaf4.1 = assoc_entity element0, imports.%Core.import_ref.87e [symbolic] // CHECK:STDOUT: %AddAssignWith.lookup_impl_witness: = lookup_impl_witness %T.792, @AddAssignWith.1, @AddAssignWith.1(%U.67d) [symbolic] @@ -1084,12 +1084,12 @@ fn TestUnaryOperators(a: Cpp.Int16, b: Cpp.Int32) { // CHECK:STDOUT: %pattern_type.260: type = pattern_type %SubAssignWith.type.7e53cf.2 [symbolic] // CHECK:STDOUT: %T.patt.f45: %pattern_type.260 = symbolic_binding_pattern T, 1 [symbolic] // CHECK:STDOUT: %T.f6c: %SubAssignWith.type.7e53cf.2 = symbolic_binding T, 1 [symbolic] -// CHECK:STDOUT: %SubAssignWith.assoc_type.6e3877.2: type = assoc_entity_type @SubAssignWith.1, @SubAssignWith.1(%U.67d) [symbolic] -// CHECK:STDOUT: %assoc0.701e5f.2: %SubAssignWith.assoc_type.6e3877.2 = assoc_entity element0, imports.%Core.import_ref.8f2 [symbolic] // CHECK:STDOUT: %T.as_type.3ff: type = facet_access_type %T.f6c [symbolic] // CHECK:STDOUT: %pattern_type.f08ed5.2: type = pattern_type %T.as_type.3ff [symbolic] // CHECK:STDOUT: %x.patt.95a: %pattern_type.f08ed5.2 = ref_binding_pattern x [symbolic] // CHECK:STDOUT: %x.param_patt.a45: %pattern_type.f08ed5.2 = var_param_pattern %x.patt.95a [symbolic] +// CHECK:STDOUT: %SubAssignWith.assoc_type.6e3877.2: type = assoc_entity_type @SubAssignWith.1, @SubAssignWith.1(%U.67d) [symbolic] +// CHECK:STDOUT: %assoc0.701e5f.2: %SubAssignWith.assoc_type.6e3877.2 = assoc_entity element0, imports.%Core.import_ref.8f2 [symbolic] // CHECK:STDOUT: %require_complete.862: = require_complete_type %SubAssignWith.type.7e53cf.2 [symbolic] // CHECK:STDOUT: %assoc0.b8e: %SubAssignWith.assoc_type.6e3877.1 = assoc_entity element0, imports.%Core.import_ref.e7f [symbolic] // CHECK:STDOUT: %SubAssignWith.lookup_impl_witness: = lookup_impl_witness %T.f6c, @SubAssignWith.1, @SubAssignWith.1(%U.67d) [symbolic] @@ -1106,12 +1106,12 @@ fn TestUnaryOperators(a: Cpp.Int16, b: Cpp.Int32) { // CHECK:STDOUT: %pattern_type.8c2: type = pattern_type %MulAssignWith.type.3a0e4d.2 [symbolic] // CHECK:STDOUT: %T.patt.db5: %pattern_type.8c2 = symbolic_binding_pattern T, 1 [symbolic] // CHECK:STDOUT: %T.64d: %MulAssignWith.type.3a0e4d.2 = symbolic_binding T, 1 [symbolic] -// CHECK:STDOUT: %MulAssignWith.assoc_type.9aa18f.2: type = assoc_entity_type @MulAssignWith.1, @MulAssignWith.1(%U.67d) [symbolic] -// CHECK:STDOUT: %assoc0.22264a.2: %MulAssignWith.assoc_type.9aa18f.2 = assoc_entity element0, imports.%Core.import_ref.ba3 [symbolic] // CHECK:STDOUT: %T.as_type.1de: type = facet_access_type %T.64d [symbolic] // CHECK:STDOUT: %pattern_type.8bf366.2: type = pattern_type %T.as_type.1de [symbolic] // CHECK:STDOUT: %x.patt.4e9: %pattern_type.8bf366.2 = ref_binding_pattern x [symbolic] // CHECK:STDOUT: %x.param_patt.6c8: %pattern_type.8bf366.2 = var_param_pattern %x.patt.4e9 [symbolic] +// CHECK:STDOUT: %MulAssignWith.assoc_type.9aa18f.2: type = assoc_entity_type @MulAssignWith.1, @MulAssignWith.1(%U.67d) [symbolic] +// CHECK:STDOUT: %assoc0.22264a.2: %MulAssignWith.assoc_type.9aa18f.2 = assoc_entity element0, imports.%Core.import_ref.ba3 [symbolic] // CHECK:STDOUT: %require_complete.6b1: = require_complete_type %MulAssignWith.type.3a0e4d.2 [symbolic] // CHECK:STDOUT: %assoc0.2ec: %MulAssignWith.assoc_type.9aa18f.1 = assoc_entity element0, imports.%Core.import_ref.408 [symbolic] // CHECK:STDOUT: %MulAssignWith.lookup_impl_witness: = lookup_impl_witness %T.64d, @MulAssignWith.1, @MulAssignWith.1(%U.67d) [symbolic] @@ -1128,12 +1128,12 @@ fn TestUnaryOperators(a: Cpp.Int16, b: Cpp.Int32) { // CHECK:STDOUT: %pattern_type.f74: type = pattern_type %DivAssignWith.type.7e58ca.2 [symbolic] // CHECK:STDOUT: %T.patt.9a5: %pattern_type.f74 = symbolic_binding_pattern T, 1 [symbolic] // CHECK:STDOUT: %T.c33: %DivAssignWith.type.7e58ca.2 = symbolic_binding T, 1 [symbolic] -// CHECK:STDOUT: %DivAssignWith.assoc_type.bb68ec.2: type = assoc_entity_type @DivAssignWith.1, @DivAssignWith.1(%U.67d) [symbolic] -// CHECK:STDOUT: %assoc0.32f100.2: %DivAssignWith.assoc_type.bb68ec.2 = assoc_entity element0, imports.%Core.import_ref.a5d [symbolic] // CHECK:STDOUT: %T.as_type.e57: type = facet_access_type %T.c33 [symbolic] // CHECK:STDOUT: %pattern_type.da303b.2: type = pattern_type %T.as_type.e57 [symbolic] // CHECK:STDOUT: %x.patt.cf6: %pattern_type.da303b.2 = ref_binding_pattern x [symbolic] // CHECK:STDOUT: %x.param_patt.660: %pattern_type.da303b.2 = var_param_pattern %x.patt.cf6 [symbolic] +// CHECK:STDOUT: %DivAssignWith.assoc_type.bb68ec.2: type = assoc_entity_type @DivAssignWith.1, @DivAssignWith.1(%U.67d) [symbolic] +// CHECK:STDOUT: %assoc0.32f100.2: %DivAssignWith.assoc_type.bb68ec.2 = assoc_entity element0, imports.%Core.import_ref.a5d [symbolic] // CHECK:STDOUT: %require_complete.c5c: = require_complete_type %DivAssignWith.type.7e58ca.2 [symbolic] // CHECK:STDOUT: %assoc0.de1: %DivAssignWith.assoc_type.bb68ec.1 = assoc_entity element0, imports.%Core.import_ref.df2 [symbolic] // CHECK:STDOUT: %DivAssignWith.lookup_impl_witness: = lookup_impl_witness %T.c33, @DivAssignWith.1, @DivAssignWith.1(%U.67d) [symbolic] @@ -1150,12 +1150,12 @@ fn TestUnaryOperators(a: Cpp.Int16, b: Cpp.Int32) { // CHECK:STDOUT: %pattern_type.fb8: type = pattern_type %ModAssignWith.type.778d68.2 [symbolic] // CHECK:STDOUT: %T.patt.c29: %pattern_type.fb8 = symbolic_binding_pattern T, 1 [symbolic] // CHECK:STDOUT: %T.bca: %ModAssignWith.type.778d68.2 = symbolic_binding T, 1 [symbolic] -// CHECK:STDOUT: %ModAssignWith.assoc_type.bc79ec.2: type = assoc_entity_type @ModAssignWith.1, @ModAssignWith.1(%U.67d) [symbolic] -// CHECK:STDOUT: %assoc0.8c0719.2: %ModAssignWith.assoc_type.bc79ec.2 = assoc_entity element0, imports.%Core.import_ref.cf6 [symbolic] // CHECK:STDOUT: %T.as_type.ce6: type = facet_access_type %T.bca [symbolic] // CHECK:STDOUT: %pattern_type.1d5f30.2: type = pattern_type %T.as_type.ce6 [symbolic] // CHECK:STDOUT: %x.patt.fa4: %pattern_type.1d5f30.2 = ref_binding_pattern x [symbolic] // CHECK:STDOUT: %x.param_patt.749: %pattern_type.1d5f30.2 = var_param_pattern %x.patt.fa4 [symbolic] +// CHECK:STDOUT: %ModAssignWith.assoc_type.bc79ec.2: type = assoc_entity_type @ModAssignWith.1, @ModAssignWith.1(%U.67d) [symbolic] +// CHECK:STDOUT: %assoc0.8c0719.2: %ModAssignWith.assoc_type.bc79ec.2 = assoc_entity element0, imports.%Core.import_ref.cf6 [symbolic] // CHECK:STDOUT: %require_complete.680: = require_complete_type %ModAssignWith.type.778d68.2 [symbolic] // CHECK:STDOUT: %assoc0.0f3: %ModAssignWith.assoc_type.bc79ec.1 = assoc_entity element0, imports.%Core.import_ref.d29 [symbolic] // CHECK:STDOUT: %ModAssignWith.lookup_impl_witness: = lookup_impl_witness %T.bca, @ModAssignWith.1, @ModAssignWith.1(%U.67d) [symbolic] diff --git a/toolchain/check/testdata/interop/cpp/operators/eq_with.carbon b/toolchain/check/testdata/interop/cpp/operators/eq_with.carbon index a190ec47a89d..86e4c0597261 100644 --- a/toolchain/check/testdata/interop/cpp/operators/eq_with.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/eq_with.carbon @@ -375,9 +375,6 @@ fn Test(only_neq: Cpp.OnlyNeq, // CHECK:STDOUT: %pattern_type.3d4: type = pattern_type %EqWith.type.98ea86.2 [symbolic] // CHECK:STDOUT: %T.patt.6b9: %pattern_type.3d4 = symbolic_binding_pattern T, 1 [symbolic] // CHECK:STDOUT: %T: %EqWith.type.98ea86.2 = symbolic_binding T, 1 [symbolic] -// CHECK:STDOUT: %EqWith.assoc_type.85b122.2: type = assoc_entity_type @EqWith.1, @EqWith.1(%U) [symbolic] -// CHECK:STDOUT: %assoc0.eee873.2: %EqWith.assoc_type.85b122.2 = assoc_entity element0, imports.%Core.import_ref.5ba [symbolic] -// CHECK:STDOUT: %assoc1.0ffc88.2: %EqWith.assoc_type.85b122.2 = assoc_entity element1, imports.%Core.import_ref.03f [symbolic] // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] // CHECK:STDOUT: %pattern_type.e6374a.2: type = pattern_type %T.as_type [symbolic] // CHECK:STDOUT: %x.param_patt.aa2: %pattern_type.e6374a.2 = value_param_pattern [symbolic] @@ -385,6 +382,9 @@ fn Test(only_neq: Cpp.OnlyNeq, // CHECK:STDOUT: %pattern_type.51d1c4.2: type = pattern_type %U [symbolic] // CHECK:STDOUT: %y.param_patt.be3: %pattern_type.51d1c4.2 = value_param_pattern [symbolic] // CHECK:STDOUT: %y.patt.b85: %pattern_type.51d1c4.2 = at_binding_pattern y, %y.param_patt.be3 [symbolic] +// CHECK:STDOUT: %EqWith.assoc_type.85b122.2: type = assoc_entity_type @EqWith.1, @EqWith.1(%U) [symbolic] +// CHECK:STDOUT: %assoc0.eee873.2: %EqWith.assoc_type.85b122.2 = assoc_entity element0, imports.%Core.import_ref.5ba [symbolic] +// CHECK:STDOUT: %assoc1.0ffc88.2: %EqWith.assoc_type.85b122.2 = assoc_entity element1, imports.%Core.import_ref.03f [symbolic] // CHECK:STDOUT: %require_complete.fb5: = require_complete_type %EqWith.type.98ea86.2 [symbolic] // CHECK:STDOUT: %assoc0.d00: %EqWith.assoc_type.85b122.1 = assoc_entity element0, imports.%Core.import_ref.2e5 [symbolic] // CHECK:STDOUT: %EqWith.lookup_impl_witness: = lookup_impl_witness %T, @EqWith.1, @EqWith.1(%U) [symbolic] @@ -545,9 +545,6 @@ fn Test(only_neq: Cpp.OnlyNeq, // CHECK:STDOUT: %pattern_type.3d4: type = pattern_type %EqWith.type.98ea86.2 [symbolic] // CHECK:STDOUT: %T.patt.6b9: %pattern_type.3d4 = symbolic_binding_pattern T, 1 [symbolic] // CHECK:STDOUT: %T: %EqWith.type.98ea86.2 = symbolic_binding T, 1 [symbolic] -// CHECK:STDOUT: %EqWith.assoc_type.85b122.2: type = assoc_entity_type @EqWith.1, @EqWith.1(%U) [symbolic] -// CHECK:STDOUT: %assoc0.eee873.2: %EqWith.assoc_type.85b122.2 = assoc_entity element0, imports.%Core.import_ref.5ba [symbolic] -// CHECK:STDOUT: %assoc1.0ffc88.2: %EqWith.assoc_type.85b122.2 = assoc_entity element1, imports.%Core.import_ref.03f [symbolic] // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] // CHECK:STDOUT: %pattern_type.e6374a.2: type = pattern_type %T.as_type [symbolic] // CHECK:STDOUT: %x.param_patt.aa2: %pattern_type.e6374a.2 = value_param_pattern [symbolic] @@ -555,6 +552,9 @@ fn Test(only_neq: Cpp.OnlyNeq, // CHECK:STDOUT: %pattern_type.51d1c4.2: type = pattern_type %U [symbolic] // CHECK:STDOUT: %y.param_patt.be3: %pattern_type.51d1c4.2 = value_param_pattern [symbolic] // CHECK:STDOUT: %y.patt.b85: %pattern_type.51d1c4.2 = at_binding_pattern y, %y.param_patt.be3 [symbolic] +// CHECK:STDOUT: %EqWith.assoc_type.85b122.2: type = assoc_entity_type @EqWith.1, @EqWith.1(%U) [symbolic] +// CHECK:STDOUT: %assoc0.eee873.2: %EqWith.assoc_type.85b122.2 = assoc_entity element0, imports.%Core.import_ref.5ba [symbolic] +// CHECK:STDOUT: %assoc1.0ffc88.2: %EqWith.assoc_type.85b122.2 = assoc_entity element1, imports.%Core.import_ref.03f [symbolic] // CHECK:STDOUT: %require_complete.fb5: = require_complete_type %EqWith.type.98ea86.2 [symbolic] // CHECK:STDOUT: %assoc0.d00: %EqWith.assoc_type.85b122.1 = assoc_entity element0, imports.%Core.import_ref.2e5 [symbolic] // CHECK:STDOUT: %EqWith.lookup_impl_witness: = lookup_impl_witness %T, @EqWith.1, @EqWith.1(%U) [symbolic] diff --git a/toolchain/check/testdata/interop/cpp/operators/ordered_with.carbon b/toolchain/check/testdata/interop/cpp/operators/ordered_with.carbon index 1d872d2c2683..e8eeffdbbe80 100644 --- a/toolchain/check/testdata/interop/cpp/operators/ordered_with.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/ordered_with.carbon @@ -411,11 +411,6 @@ fn Test(missing_less: Cpp.MissingLess, // CHECK:STDOUT: %pattern_type.ebc: type = pattern_type %OrderedWith.type.32ae87.2 [symbolic] // CHECK:STDOUT: %T.patt.aaa: %pattern_type.ebc = symbolic_binding_pattern T, 1 [symbolic] // CHECK:STDOUT: %T: %OrderedWith.type.32ae87.2 = symbolic_binding T, 1 [symbolic] -// CHECK:STDOUT: %OrderedWith.assoc_type.1d2e6f.2: type = assoc_entity_type @OrderedWith.1, @OrderedWith.1(%U) [symbolic] -// CHECK:STDOUT: %assoc0.c0023b.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element0, imports.%Core.import_ref.e7a [symbolic] -// CHECK:STDOUT: %assoc1.3efd77.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element1, imports.%Core.import_ref.3f7 [symbolic] -// CHECK:STDOUT: %assoc2.48eff0.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element2, imports.%Core.import_ref.385 [symbolic] -// CHECK:STDOUT: %assoc3.5d53f7.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element3, imports.%Core.import_ref.39b [symbolic] // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] // CHECK:STDOUT: %pattern_type.f6ec4f.2: type = pattern_type %T.as_type [symbolic] // CHECK:STDOUT: %x.param_patt.a58: %pattern_type.f6ec4f.2 = value_param_pattern [symbolic] @@ -423,6 +418,11 @@ fn Test(missing_less: Cpp.MissingLess, // CHECK:STDOUT: %pattern_type.51d1c4.2: type = pattern_type %U [symbolic] // CHECK:STDOUT: %y.param_patt.be3: %pattern_type.51d1c4.2 = value_param_pattern [symbolic] // CHECK:STDOUT: %y.patt.b85: %pattern_type.51d1c4.2 = at_binding_pattern y, %y.param_patt.be3 [symbolic] +// CHECK:STDOUT: %OrderedWith.assoc_type.1d2e6f.2: type = assoc_entity_type @OrderedWith.1, @OrderedWith.1(%U) [symbolic] +// CHECK:STDOUT: %assoc0.c0023b.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element0, imports.%Core.import_ref.e7a [symbolic] +// CHECK:STDOUT: %assoc1.3efd77.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element1, imports.%Core.import_ref.3f7 [symbolic] +// CHECK:STDOUT: %assoc2.48eff0.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element2, imports.%Core.import_ref.385 [symbolic] +// CHECK:STDOUT: %assoc3.5d53f7.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element3, imports.%Core.import_ref.39b [symbolic] // CHECK:STDOUT: %require_complete.3c0: = require_complete_type %OrderedWith.type.32ae87.2 [symbolic] // CHECK:STDOUT: %assoc0.13c: %OrderedWith.assoc_type.1d2e6f.1 = assoc_entity element0, imports.%Core.import_ref.447 [symbolic] // CHECK:STDOUT: %OrderedWith.lookup_impl_witness: = lookup_impl_witness %T, @OrderedWith.1, @OrderedWith.1(%U) [symbolic] @@ -653,11 +653,6 @@ fn Test(missing_less: Cpp.MissingLess, // CHECK:STDOUT: %pattern_type.ebc: type = pattern_type %OrderedWith.type.32ae87.2 [symbolic] // CHECK:STDOUT: %T.patt.aaa: %pattern_type.ebc = symbolic_binding_pattern T, 1 [symbolic] // CHECK:STDOUT: %T: %OrderedWith.type.32ae87.2 = symbolic_binding T, 1 [symbolic] -// CHECK:STDOUT: %OrderedWith.assoc_type.1d2e6f.2: type = assoc_entity_type @OrderedWith.1, @OrderedWith.1(%U) [symbolic] -// CHECK:STDOUT: %assoc0.c0023b.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element0, imports.%Core.import_ref.e7a [symbolic] -// CHECK:STDOUT: %assoc1.3efd77.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element1, imports.%Core.import_ref.3f7 [symbolic] -// CHECK:STDOUT: %assoc2.48eff0.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element2, imports.%Core.import_ref.385 [symbolic] -// CHECK:STDOUT: %assoc3.5d53f7.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element3, imports.%Core.import_ref.39b [symbolic] // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic] // CHECK:STDOUT: %pattern_type.f6ec4f.2: type = pattern_type %T.as_type [symbolic] // CHECK:STDOUT: %x.param_patt.a58: %pattern_type.f6ec4f.2 = value_param_pattern [symbolic] @@ -665,6 +660,11 @@ fn Test(missing_less: Cpp.MissingLess, // CHECK:STDOUT: %pattern_type.51d1c4.2: type = pattern_type %U [symbolic] // CHECK:STDOUT: %y.param_patt.be3: %pattern_type.51d1c4.2 = value_param_pattern [symbolic] // CHECK:STDOUT: %y.patt.b85: %pattern_type.51d1c4.2 = at_binding_pattern y, %y.param_patt.be3 [symbolic] +// CHECK:STDOUT: %OrderedWith.assoc_type.1d2e6f.2: type = assoc_entity_type @OrderedWith.1, @OrderedWith.1(%U) [symbolic] +// CHECK:STDOUT: %assoc0.c0023b.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element0, imports.%Core.import_ref.e7a [symbolic] +// CHECK:STDOUT: %assoc1.3efd77.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element1, imports.%Core.import_ref.3f7 [symbolic] +// CHECK:STDOUT: %assoc2.48eff0.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element2, imports.%Core.import_ref.385 [symbolic] +// CHECK:STDOUT: %assoc3.5d53f7.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element3, imports.%Core.import_ref.39b [symbolic] // CHECK:STDOUT: %require_complete.3c0: = require_complete_type %OrderedWith.type.32ae87.2 [symbolic] // CHECK:STDOUT: %assoc0.13c: %OrderedWith.assoc_type.1d2e6f.1 = assoc_entity element0, imports.%Core.import_ref.447 [symbolic] // CHECK:STDOUT: %OrderedWith.lookup_impl_witness: = lookup_impl_witness %T, @OrderedWith.1, @OrderedWith.1(%U) [symbolic] diff --git a/toolchain/check/testdata/interop/cpp/operators/spaceship.carbon b/toolchain/check/testdata/interop/cpp/operators/spaceship.carbon index 229fcd4b64f4..1f66d9b0b188 100644 --- a/toolchain/check/testdata/interop/cpp/operators/spaceship.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/spaceship.carbon @@ -244,9 +244,6 @@ fn Test(returns_strong_ordering: Cpp.ReturnsStrongOrdering) { // CHECK:STDOUT: %pattern_type.3d4: type = pattern_type %EqWith.type.98ea86.2 [symbolic] // CHECK:STDOUT: %T.patt.6b9: %pattern_type.3d4 = symbolic_binding_pattern T, 1 [symbolic] // CHECK:STDOUT: %T.d94: %EqWith.type.98ea86.2 = symbolic_binding T, 1 [symbolic] -// CHECK:STDOUT: %EqWith.assoc_type.85b122.2: type = assoc_entity_type @EqWith.1, @EqWith.1(%U) [symbolic] -// CHECK:STDOUT: %assoc0.eee873.2: %EqWith.assoc_type.85b122.2 = assoc_entity element0, imports.%Core.import_ref.5ba [symbolic] -// CHECK:STDOUT: %assoc1.0ffc88.2: %EqWith.assoc_type.85b122.2 = assoc_entity element1, imports.%Core.import_ref.03f [symbolic] // CHECK:STDOUT: %T.as_type.93d: type = facet_access_type %T.d94 [symbolic] // CHECK:STDOUT: %pattern_type.e6374a.2: type = pattern_type %T.as_type.93d [symbolic] // CHECK:STDOUT: %x.param_patt.aa2: %pattern_type.e6374a.2 = value_param_pattern [symbolic] @@ -254,6 +251,9 @@ fn Test(returns_strong_ordering: Cpp.ReturnsStrongOrdering) { // CHECK:STDOUT: %pattern_type.51d1c4.2: type = pattern_type %U [symbolic] // CHECK:STDOUT: %y.param_patt.be3: %pattern_type.51d1c4.2 = value_param_pattern [symbolic] // CHECK:STDOUT: %y.patt.b85: %pattern_type.51d1c4.2 = at_binding_pattern y, %y.param_patt.be3 [symbolic] +// CHECK:STDOUT: %EqWith.assoc_type.85b122.2: type = assoc_entity_type @EqWith.1, @EqWith.1(%U) [symbolic] +// CHECK:STDOUT: %assoc0.eee873.2: %EqWith.assoc_type.85b122.2 = assoc_entity element0, imports.%Core.import_ref.5ba [symbolic] +// CHECK:STDOUT: %assoc1.0ffc88.2: %EqWith.assoc_type.85b122.2 = assoc_entity element1, imports.%Core.import_ref.03f [symbolic] // CHECK:STDOUT: %require_complete.fb5: = require_complete_type %EqWith.type.98ea86.2 [symbolic] // CHECK:STDOUT: %assoc0.d00: %EqWith.assoc_type.85b122.1 = assoc_entity element0, imports.%Core.import_ref.2e5 [symbolic] // CHECK:STDOUT: %EqWith.lookup_impl_witness: = lookup_impl_witness %T.d94, @EqWith.1, @EqWith.1(%U) [symbolic] @@ -281,15 +281,15 @@ fn Test(returns_strong_ordering: Cpp.ReturnsStrongOrdering) { // CHECK:STDOUT: %pattern_type.ebc: type = pattern_type %OrderedWith.type.32ae87.2 [symbolic] // CHECK:STDOUT: %T.patt.aaa: %pattern_type.ebc = symbolic_binding_pattern T, 1 [symbolic] // CHECK:STDOUT: %T.7df: %OrderedWith.type.32ae87.2 = symbolic_binding T, 1 [symbolic] +// CHECK:STDOUT: %T.as_type.262: type = facet_access_type %T.7df [symbolic] +// CHECK:STDOUT: %pattern_type.f6ec4f.2: type = pattern_type %T.as_type.262 [symbolic] +// CHECK:STDOUT: %x.param_patt.a58: %pattern_type.f6ec4f.2 = value_param_pattern [symbolic] +// CHECK:STDOUT: %x.patt.140: %pattern_type.f6ec4f.2 = at_binding_pattern x, %x.param_patt.a58 [symbolic] // CHECK:STDOUT: %OrderedWith.assoc_type.1d2e6f.2: type = assoc_entity_type @OrderedWith.1, @OrderedWith.1(%U) [symbolic] // CHECK:STDOUT: %assoc0.c0023b.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element0, imports.%Core.import_ref.e7a [symbolic] // CHECK:STDOUT: %assoc1.3efd77.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element1, imports.%Core.import_ref.3f7 [symbolic] // CHECK:STDOUT: %assoc2.48eff0.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element2, imports.%Core.import_ref.385 [symbolic] // CHECK:STDOUT: %assoc3.5d53f7.2: %OrderedWith.assoc_type.1d2e6f.2 = assoc_entity element3, imports.%Core.import_ref.39b [symbolic] -// CHECK:STDOUT: %T.as_type.262: type = facet_access_type %T.7df [symbolic] -// CHECK:STDOUT: %pattern_type.f6ec4f.2: type = pattern_type %T.as_type.262 [symbolic] -// CHECK:STDOUT: %x.param_patt.a58: %pattern_type.f6ec4f.2 = value_param_pattern [symbolic] -// CHECK:STDOUT: %x.patt.140: %pattern_type.f6ec4f.2 = at_binding_pattern x, %x.param_patt.a58 [symbolic] // CHECK:STDOUT: %require_complete.3c0: = require_complete_type %OrderedWith.type.32ae87.2 [symbolic] // CHECK:STDOUT: %assoc0.13c: %OrderedWith.assoc_type.1d2e6f.1 = assoc_entity element0, imports.%Core.import_ref.447 [symbolic] // CHECK:STDOUT: %OrderedWith.lookup_impl_witness: = lookup_impl_witness %T.7df, @OrderedWith.1, @OrderedWith.1(%U) [symbolic] diff --git a/toolchain/check/testdata/named_constraint/empty_generic.carbon b/toolchain/check/testdata/named_constraint/empty_generic.carbon index 0858f50ae26c..880e708f09ff 100644 --- a/toolchain/check/testdata/named_constraint/empty_generic.carbon +++ b/toolchain/check/testdata/named_constraint/empty_generic.carbon @@ -39,7 +39,7 @@ fn G(generic T: Z, generic U: Empty(T), generic V: type) { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %empty_struct.26b: %Empty.type.f30 = struct_value () [concrete] // CHECK:STDOUT: %Empty.type.d682d6.1: type = facet_type <@Empty, @Empty(%T.67d)> [symbolic] -// CHECK:STDOUT: %Self.22bbf7.1: %Empty.type.d682d6.1 = symbolic_binding Self, 1 [symbolic] +// CHECK:STDOUT: %Self.22b: %Empty.type.d682d6.1 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: %pattern_type.9a587c.1: type = pattern_type %Empty.type.d682d6.1 [symbolic] // CHECK:STDOUT: %U.patt.cb839c.1: %pattern_type.9a587c.1 = symbolic_binding_pattern U, 1 [symbolic] // CHECK:STDOUT: %U.e1f642.1: %Empty.type.d682d6.1 = symbolic_binding U, 1 [symbolic] @@ -68,7 +68,6 @@ fn G(generic T: Z, generic U: Empty(T), generic V: type) { // CHECK:STDOUT: %F.specific_fn.d75: = specific_function %F, @F(%T.as_type, %Empty.facet.2cb) [symbolic] // CHECK:STDOUT: %Empty.facet.aa1: %Empty.type.d682d6.2 = facet_value %T.as_type, () [symbolic] // CHECK:STDOUT: %F.specific_fn.7a2: = specific_function %F, @F(%T.as_type, %Empty.facet.aa1) [symbolic] -// CHECK:STDOUT: %Self.22bbf7.2: %Empty.type.d682d6.2 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: %F.specific_fn.ff9: = specific_function %F, @F(%T.as_type, %U.e1f642.2) [symbolic] // CHECK:STDOUT: %facet_value.ed5: %type = facet_value %V, () [symbolic] // CHECK:STDOUT: %Empty.facet.ed5: %Empty.type.d682d6.2 = facet_value %V, () [symbolic] @@ -135,10 +134,10 @@ fn G(generic T: Z, generic U: Empty(T), generic V: type) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Empty.type: type = facet_type <@Empty, @Empty(%T.loc16_19.1)> [symbolic = %Empty.type (constants.%Empty.type.d682d6.1)] -// CHECK:STDOUT: %Self.loc16_27.2: @Empty.%Empty.type (%Empty.type.d682d6.1) = symbolic_binding Self, 1 [symbolic = %Self.loc16_27.2 (constants.%Self.22bbf7.1)] +// CHECK:STDOUT: %Self.loc16_27.2: @Empty.%Empty.type (%Empty.type.d682d6.1) = symbolic_binding Self, 1 [symbolic = %Self.loc16_27.2 (constants.%Self.22b)] // CHECK:STDOUT: // CHECK:STDOUT: constraint { -// CHECK:STDOUT: %Self.loc16_27.1: @Empty.%Empty.type (%Empty.type.d682d6.1) = symbolic_binding Self, 1 [symbolic = %Self.loc16_27.2 (constants.%Self.22bbf7.1)] +// CHECK:STDOUT: %Self.loc16_27.1: @Empty.%Empty.type (%Empty.type.d682d6.1) = symbolic_binding Self, 1 [symbolic = %Self.loc16_27.2 (constants.%Self.22b)] // CHECK:STDOUT: %Empty.WithSelf.decl = constraint_with_self_decl @Empty [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -243,7 +242,7 @@ fn G(generic T: Z, generic U: Empty(T), generic V: type) { // CHECK:STDOUT: %T.loc16_19.1 => constants.%T.67d // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Empty.WithSelf(constants.%T.67d, constants.%Self.22bbf7.1) {} +// CHECK:STDOUT: specific @Empty.WithSelf(constants.%T.67d, constants.%Self.22b) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%T.67d, constants.%U.e1f642.1) { // CHECK:STDOUT: %T.patt.loc18_15.2 => constants.%T.patt.d47 @@ -257,10 +256,6 @@ fn G(generic T: Z, generic U: Empty(T), generic V: type) { // CHECK:STDOUT: specific @Empty(constants.%T.as_type) { // CHECK:STDOUT: %T.patt.loc16_19.2 => constants.%T.patt.d47 // CHECK:STDOUT: %T.loc16_19.1 => constants.%T.as_type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Empty.type => constants.%Empty.type.d682d6.2 -// CHECK:STDOUT: %Self.loc16_27.2 => constants.%Self.22bbf7.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%T.013, constants.%U.e1f642.2, constants.%V) { @@ -320,10 +315,6 @@ fn G(generic T: Z, generic U: Empty(T), generic V: type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Empty.WithSelf(constants.%T.as_type, constants.%Self.22bbf7.1) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%T.as_type, constants.%U.e1f642.2) { // CHECK:STDOUT: %T.patt.loc18_15.2 => constants.%T.patt.d47 // CHECK:STDOUT: %T.loc18_15.1 => constants.%T.as_type diff --git a/toolchain/check/testdata/named_constraint/require.carbon b/toolchain/check/testdata/named_constraint/require.carbon index 7879f99238b9..522151d86084 100644 --- a/toolchain/check/testdata/named_constraint/require.carbon +++ b/toolchain/check/testdata/named_constraint/require.carbon @@ -1084,9 +1084,7 @@ constraint N { // CHECK:STDOUT: %Self.as_type.loc9_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_11.2 (constants.%Self.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.d87) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.d87) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%Self.d87) { // CHECK:STDOUT: %Self => constants.%Self.d87 @@ -1147,9 +1145,7 @@ constraint N { // CHECK:STDOUT: %Self.as_type.loc9_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_11.2 (constants.%Self.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.d87) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.d87) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%Self.d87) { // CHECK:STDOUT: %Self => constants.%Self.d87 @@ -1542,9 +1538,7 @@ constraint N { // CHECK:STDOUT: %Z_where.type.loc10_19.3: type = facet_type <@Z where .Self impls @Y, @Y(%Self.as_type.loc10_11.2)> [symbolic = %Z_where.type.loc10_19.3 (constants.%Z_where.type.0d5)] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @N.WithSelf(constants.%Self.d87) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @N.WithSelf(constants.%Self.d87) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.Z_where.type.require(constants.%Self.d87) { // CHECK:STDOUT: %Self => constants.%Self.d87 @@ -1650,9 +1644,7 @@ constraint N { // CHECK:STDOUT: %Z_where.type.loc10_19.3: type = facet_type <@Z where %C.loc10_19 impls @Y, @Y(%Self.as_type.loc10_11.2)> [symbolic = %Z_where.type.loc10_19.3 (constants.%Z_where.type.a0f3c6.2)] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @N.WithSelf(constants.%Self.d87) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: } +// CHECK:STDOUT: specific @N.WithSelf(constants.%Self.d87) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.Z_where.type.require(constants.%Self.d87) { // CHECK:STDOUT: %Self => constants.%Self.d87 diff --git a/toolchain/check/type_completion.cpp b/toolchain/check/type_completion.cpp index f066ebabd7ae..991b38c4e4a9 100644 --- a/toolchain/check/type_completion.cpp +++ b/toolchain/check/type_completion.cpp @@ -438,6 +438,9 @@ auto TypeCompleter::ProcessStep() -> bool { } auto TypeCompleter::AddNestedIncompleteTypes(SemIR::Inst type_inst) -> bool { + // NOTE: `TryToCompleteClassType()` in convert.cpp matches the same types as + // the switch here. When adding a new type here, it should also be added + // there. CARBON_KIND_SWITCH(type_inst) { case CARBON_KIND(SemIR::ArrayType inst): { Push(context_->types().GetTypeIdForTypeInstId(inst.element_type_inst_id));