New specifics formed during identify need to be marked identified (#8003)

We were explicitly marking the specifics of `require` decls as
`identified` when creating them during identify. But the require may
contain calls to other generics internally. And forming the specific for
the `require` can also form new specifics for those calls, if they
depend on `Self`. The resulting specific can have `IdentifiedWitness`
instructions in its arguments, in accesses or FacetValues, etc. Or they
may appear in the decl block as it's resolved. So it's very important
that the specifics be marked `identified`, as those witnesses may only
appear in `identified` specifics. This allows the new
`access_through_nested_specific_in_named_constraint.carbon` test to
succeed without any poisoning errors.

SemIR formatting is changed so that `identified` specifics are more
clearly differentiated where they are used, so that we can see if
`identified` specifics are misused outside of identifying.

Now that we construct more `identified` specifics, we also need to
ensure we remove the `identified` state from specifics that come out of
`EvaluateIdentifiedWitnesses` and `SubstIdentifiedWitnesses`. To do that
we add a new callback method on `SubstInstCallbacks` that we use to
build specifics during subst. Then during those operations, we drop the
`identified` flag from any specific that we form, because we know that
we have also removed any `IdentifiedWitness` instructions because:
- We replace them all from arguments during subst.
- We CHECK that we're not in the middle of identifying before starting
the subst.

However now an `IdentifiedFacetType` is not fully deduped, because it
may contain a non-identified specific that comes from a
`DeclaredFacetType` along with an identified specific that comes from a
named constraint, where they have the same arguments. That results in
the `IdentifiedFacetType` having two specific interfaces when it really
only refers to one. The
`fail_todo_impl_as_constraint_duplicates_interface.carbon` test
demonstrates this, and that we then diagnose an `impl` as invalid since
we find more than one specific interface being extended. To fix this we
need to dedupe and count specific interfaces _after_
substituting/evaluating away the IdentifiedWitnesses. This is left to
future work.
This commit is contained in:
Dana Jansens authored and GitHub committed 2026-10-20 21:18:50 +00:00
1 parent 2e21255855
commit eb66bebc35
15 files changed
+323 -155

No files matched your search

+9 -2
View File
@@ -685,8 +685,15 @@ static auto GetConstantValue(EvalContext& eval_context,
if (args_id == specific.args_id) {
return specific_id;
}
return eval_context.context().specifics().GetOrAdd(
specific.generic_id, args_id, specific.identified);
// When modifying a non-`identified` specific during identify, mark the new
// specific as `identified` too. If modifying an `identified` specific outside
// of identify, it may contain `IdentifiedWitness` insts so the new specific
// must keep the `identified` marker.
bool identified =
eval_context.context().eval_impl_lookup_to_identified_witness() ||
specific.identified;
return eval_context.context().specifics().GetOrAdd(specific.generic_id,
args_id, identified);
}
static auto GetConstantValue(EvalContext& eval_context,
+10
View File
@@ -584,6 +584,16 @@ class EvaluateSubstCallbacks : public SubstInstCallbacks {
return RebuildNewInst(loc_id_, new_inst);
}
auto RebuildSpecific(SemIR::SpecificId orig_specific_id,
SemIR::InstBlockId args_id)
-> SemIR::SpecificId override {
auto generic_id = context().specifics().Get(orig_specific_id).generic_id;
// Drop the `identified` flag from any specifics we create here, as we have
// substituted the IdentifiedWitness instructions away.
return context().specifics().GetOrAdd(generic_id, args_id,
/*identified=*/false);
}
private:
auto SubstIdentifiedWitness(SemIR::IdentifiedWitness witness)
-> SemIR::InstId {
+11 -16
View File
@@ -716,21 +716,19 @@ auto ResolveSpecificDecl(Context& context, SemIR::LocId loc_id,
}
auto MakeSpecific(Context& context, SemIR::LocId loc_id,
SemIR::GenericId generic_id, SemIR::InstBlockId args_id,
bool make_identified_specific) -> SemIR::SpecificId {
auto specific_id = context.specifics().GetOrAdd(generic_id, args_id,
make_identified_specific);
SemIR::GenericId generic_id, SemIR::InstBlockId args_id)
-> SemIR::SpecificId {
auto specific_id = context.specifics().GetOrAdd(
generic_id, args_id, context.eval_impl_lookup_to_identified_witness());
ResolveSpecificDecl(context, loc_id, specific_id);
return specific_id;
}
auto MakeSpecific(Context& context, SemIR::LocId loc_id,
SemIR::GenericId generic_id,
llvm::ArrayRef<SemIR::InstId> args,
bool make_identified_specific) -> SemIR::SpecificId {
llvm::ArrayRef<SemIR::InstId> args) -> SemIR::SpecificId {
auto args_id = context.inst_blocks().AddCanonical(args);
return MakeSpecific(context, loc_id, generic_id, args_id,
make_identified_specific);
return MakeSpecific(context, loc_id, generic_id, args_id);
}
static auto MakeSelfSpecificId(Context& context, SemIR::GenericId generic_id)
@@ -878,8 +876,7 @@ auto MakeSpecificWithInnerSelf(Context& context, SemIR::LocId loc_id,
SemIR::GenericId generic_without_self_id,
SemIR::GenericId generic_with_self_id,
SemIR::SpecificId specific_without_self_id,
SemIR::ConstantId self_facet,
bool make_identified_specific)
SemIR::ConstantId self_facet)
-> SemIR::SpecificId {
ValidateGenericWithoutAndWithSelfMatch(context, generic_without_self_id,
generic_with_self_id,
@@ -904,16 +901,15 @@ auto MakeSpecificWithInnerSelf(Context& context, SemIR::LocId loc_id,
args.push_back(self_facet_inst_id);
}
auto specific_id = MakeSpecific(context, loc_id, generic_with_self_id, args,
make_identified_specific);
auto specific_id = MakeSpecific(context, loc_id, generic_with_self_id, args);
ResolveSpecificDefinition(context, loc_id, specific_id);
return specific_id;
}
auto CopySpecificToGeneric(Context& context, SemIR::LocId loc_id,
SemIR::SpecificId specific_id,
SemIR::GenericId target_generic_id,
bool make_identified_specific) -> SemIR::SpecificId {
SemIR::GenericId target_generic_id)
-> SemIR::SpecificId {
if (!specific_id.has_value()) {
const auto& target_generic = context.generics().Get(target_generic_id);
auto target_bindings =
@@ -936,8 +932,7 @@ auto CopySpecificToGeneric(Context& context, SemIR::LocId loc_id,
}
auto args_id = context.specifics().GetArgsOrEmpty(specific_id);
return MakeSpecific(context, loc_id, target_generic_id, args_id,
make_identified_specific);
return MakeSpecific(context, loc_id, target_generic_id, args_id);
}
auto DiagnoseImplsOnNonFacetType(Context& context, SemIR::LocId loc_id)
+5 -8
View File
@@ -102,15 +102,14 @@ auto RebuildGenericEvalBlock(Context& context, SemIR::GenericId generic_id,
// substitution into the declaration, but not the definition, of the generic.
auto MakeSpecific(Context& context, SemIR::LocId loc_id,
SemIR::GenericId generic_id,
llvm::ArrayRef<SemIR::InstId> args,
bool make_identified_specific = false) -> SemIR::SpecificId;
llvm::ArrayRef<SemIR::InstId> args) -> SemIR::SpecificId;
// Builds a new specific or finds an existing one in the case where the argument
// list has already been converted into an instruction block. `args_id` should
// be a canonical instruction block referring to constants.
auto MakeSpecific(Context& context, SemIR::LocId loc_id,
SemIR::GenericId generic_id, SemIR::InstBlockId args_id,
bool make_identified_specific = false) -> SemIR::SpecificId;
SemIR::GenericId generic_id, SemIR::InstBlockId args_id)
-> SemIR::SpecificId;
// Builds the specific that describes how the generic should refer to itself.
// For example, for a generic `G(T: type)`, this is the specific `G(T)`. If
@@ -163,8 +162,7 @@ auto MakeSpecificWithInnerSelf(Context& context, SemIR::LocId loc_id,
SemIR::GenericId generic_without_self_id,
SemIR::GenericId generic_with_self_id,
SemIR::SpecificId specific_without_self_id,
SemIR::ConstantId self_facet,
bool make_identified_specific = false)
SemIR::ConstantId self_facet)
-> SemIR::SpecificId;
// Copy the arguments of a specific into the context of another generic. The
@@ -176,8 +174,7 @@ auto MakeSpecificWithInnerSelf(Context& context, SemIR::LocId loc_id,
// instantiation.
auto CopySpecificToGeneric(Context& context, SemIR::LocId loc_id,
SemIR::SpecificId specific_id,
SemIR::GenericId target_generic_id,
bool make_identified_specific = false)
SemIR::GenericId target_generic_id)
-> SemIR::SpecificId;
auto DiagnoseImplsOnNonFacetType(Context& context, SemIR::LocId loc_id) -> void;
+26 -5
View File
@@ -21,6 +21,27 @@ auto SubstInstCallbacks::RebuildType(SemIR::TypeInstId type_inst_id) const
return context().types().GetTypeIdForTypeInstId(type_inst_id);
}
auto SubstInstCallbacks::RebuildSpecific(SemIR::SpecificId orig_specific_id,
SemIR::InstBlockId args_id)
-> SemIR::SpecificId {
// TODO: We do not resolve specifics formed from Subst, so we can't call
// MakeSpecific here.
const auto& orig_specific = context().specifics().Get(orig_specific_id);
if (args_id == orig_specific.args_id) {
// If the args didn't change, avoid constructing an `identified` specific
// even during identify.
return orig_specific_id;
}
// When modifying a non-`identified` specific during identify, mark the new
// specific as `identified` too. If modifying an `identified` specific outside
// of identify, it may contain `IdentifiedWitness` insts so the new specific
// must keep the `identified` marker.
bool identified = context().eval_impl_lookup_to_identified_witness() ||
orig_specific.identified;
return context().specifics().GetOrAdd(orig_specific.generic_id, args_id,
identified);
}
auto SubstInstCallbacks::RebuildNewInst(SemIR::LocId loc_id,
SemIR::Inst new_inst) const
-> SemIR::InstId {
@@ -187,7 +208,8 @@ static auto ExpandOperands(Context& context, Worklist& worklist,
// Pops the specified operand from the worklist and returns it.
static auto PopOperand(Context& context, Worklist& worklist,
SemIR::IdAndKind arg) -> int32_t {
SemIR::IdAndKind arg, SubstInstCallbacks& callbacks)
-> int32_t {
auto pop_block_id = [&](SemIR::InstBlockId old_inst_block_id) {
auto size = context.inst_blocks().Get(old_inst_block_id).size();
SemIR::CopyOnWriteInstBlock new_inst_block(&context.sem_ir(),
@@ -204,8 +226,7 @@ static auto PopOperand(Context& context, Worklist& worklist,
}
auto& specific = context.specifics().Get(specific_id);
auto args_id = pop_block_id(specific.args_id);
return context.specifics().GetOrAdd(specific.generic_id, args_id,
specific.identified);
return callbacks.RebuildSpecific(specific_id, args_id);
};
CARBON_KIND_SWITCH(arg) {
@@ -353,8 +374,8 @@ static auto Rebuild(Context& context, Worklist& worklist, SemIR::InstId inst_id,
auto inst = context.insts().Get(inst_id);
// Note that we pop in reverse order because we pushed them in forwards order.
int32_t arg1 = PopOperand(context, worklist, inst.arg1_and_kind());
int32_t arg0 = PopOperand(context, worklist, inst.arg0_and_kind());
int32_t arg1 = PopOperand(context, worklist, inst.arg1_and_kind(), callbacks);
int32_t arg0 = PopOperand(context, worklist, inst.arg0_and_kind(), callbacks);
auto type_id = inst.type_id().has_value()
? callbacks.RebuildType(
context.types().GetAsTypeInstId(worklist.Pop()))
+6
View File
@@ -79,6 +79,12 @@ class SubstInstCallbacks {
return orig_inst_id;
}
// Rebuilds a specific given the original specific's ID and the new
// arguments. By default this just calls GetOrAdd to make the specific, but
// does not resolve the specific's decl block.
virtual auto RebuildSpecific(SemIR::SpecificId orig_specific_id,
SemIR::InstBlockId args_id) -> SemIR::SpecificId;
// Builds a new constant by evaluating `new_inst`, and returns its `InstId`.
//
// This can be used to implement `Rebuild` in straightforward cases.
+5
View File
@@ -1088,6 +1088,11 @@ impl forall [T: type] T as Y(Z where .Z1 = ()) where .Y1 = .YF() {}
// CHECK:STDOUT: %assoc0 => constants.%assoc0.1a5
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I(constants.%T.as_type):identified {
// CHECK:STDOUT: %T.patt.loc4_14.2 => constants.%T.patt.3a0
// CHECK:STDOUT: %T.loc4_14.1 => constants.%T.as_type
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I(constants.%T.as_type) {
// CHECK:STDOUT: %T.patt.loc4_14.2 => constants.%T.patt.3a0
// CHECK:STDOUT: %T.loc4_14.1 => constants.%T.as_type
+12 -5
View File
@@ -89,6 +89,8 @@ fn F(generic B: Y) {
// CHECK:STDOUT: %Z.assoc_type.4e0: type = assoc_entity_type @Z, @Z(%A.as_type) [symbolic]
// CHECK:STDOUT: %assoc0.de7: %Z.assoc_type.4e0 = assoc_entity element0, imports.%Main.import_ref.7eb [symbolic]
// CHECK:STDOUT: %assoc0.a64: %Z.assoc_type.795 = assoc_entity element0, imports.%Main.import_ref.f35 [symbolic]
// CHECK:STDOUT: %Z.type.67e: type = facet_type <@Z, @Z(%A.as_type):identified> [symbolic]
// CHECK:STDOUT: %require_complete.d81: <witness> = require_complete_type %Z.type.67e [symbolic]
// CHECK:STDOUT: %Z.lookup_impl_witness: <witness> = lookup_impl_witness %A, @Z, @Z(%A.as_type) [symbolic]
// CHECK:STDOUT: %Z.facet: %Z.type.56f318.2 = facet_value %A.as_type, (%Z.lookup_impl_witness) [symbolic]
// CHECK:STDOUT: %Z.WithSelf.F.type.20b: type = fn_type @Z.WithSelf.F, @Z.WithSelf(%A.as_type, %Z.facet) [symbolic]
@@ -318,18 +320,23 @@ fn F(generic B: Y) {
// CHECK:STDOUT: %assoc0 => constants.%assoc0.de7
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @X.WithSelf(constants.%A) [identified] {
// CHECK:STDOUT: specific @X.WithSelf(constants.%A):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %Self => constants.%A
// CHECK:STDOUT: %Self.as_type => constants.%A.as_type
// CHECK:STDOUT: %Z.type => constants.%Z.type.56f318.2
// CHECK:STDOUT: %require_complete => constants.%require_complete.327231.2
// CHECK:STDOUT: %Z.type => constants.%Z.type.67e
// CHECK:STDOUT: %require_complete => constants.%require_complete.d81
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @X.WithSelf.Self.as_type.impls.Z.type.require(constants.%A) [identified] {
// CHECK:STDOUT: specific @Z(constants.%A.as_type):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%A.as_type
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @X.WithSelf.Self.as_type.impls.Z.type.require(constants.%A):identified {
// CHECK:STDOUT: %Self => constants.%A
// CHECK:STDOUT: %Self.as_type => constants.%A.as_type
// CHECK:STDOUT: %Z.type => constants.%Z.type.56f318.2
// CHECK:STDOUT: %Z.type => constants.%Z.type.67e
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf(constants.%A.as_type, constants.%Z.facet) {
@@ -151,6 +151,20 @@ constraint B(X: Undefined) {
impl () as B(1) {}
// --- fail_todo_impl_as_constraint_duplicates_interface.carbon
library "[[@TEST_NAME]]";
interface I(T: type) {}
constraint J {
extend require impls I(Self);
}
// This impls `I(())` twice, which should be deduplicated to a single specific
// interface.
// CHECK:STDERR: fail_todo_impl_as_constraint_duplicates_interface.carbon:[[@LINE+2]]:1-22: error: impl as 2 interfaces, expected 1 [ImplOfNotOneInterface]
// CHECK:STDERR:
impl () as I(()) & J {}
// --- impl_as_constraint_where_rewrite.carbon
library "[[@TEST_NAME]]";
@@ -345,6 +359,31 @@ fn G() {
F(());
}
// --- access_through_nested_specific_in_named_constraint.carbon
library "[[@TEST_NAME]]";
interface Z { let Z1: type; }
impl forall [T: type] T as Z where .Z1 = {} {}
class C(T: type) {
alias U = T.(Z.Z1);
}
interface K {}
constraint J {
extend require impls Z;
// When identifying `() as J` for the impl below, this forms a specific `C(())`
// which contains an access of `().(Z.Z1)`. The `() as Z` lookup _should_ find
// the impl below, not the blanket impl above. If we find the above impl, then
// the access of `U` here resolves to `{}` incorrectly.
require C(Self).U impls K;
}
impl () as K {}
impl () as J where .Z1 = () {}
// --- witness_access_in_named_constraint.carbon
library "[[@TEST_NAME]]";
+150 -65
View File
@@ -684,12 +684,16 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.e1f642.1 [symbolic]
// CHECK:STDOUT: %empty_struct.a40: %empty_struct_type = struct_value () [concrete]
// CHECK:STDOUT: %J.type.d682d6.2: type = facet_type <@J, @J(%empty_struct_type)> [concrete]
// CHECK:STDOUT: %I.type.aaf: type = facet_type <@I, @I(%empty_struct_type)> [concrete]
// CHECK:STDOUT: %Self.968: %I.type.aaf = symbolic_binding Self, 1 [symbolic]
// CHECK:STDOUT: %complete_type.a15: <witness> = complete_type_witness %I.type.aaf [concrete]
// CHECK:STDOUT: %I.type.aab: type = facet_type <@I, @I(%empty_struct_type):identified> [concrete]
// CHECK:STDOUT: %Self.551: %I.type.aab = symbolic_binding Self, 1 [symbolic]
// CHECK:STDOUT: %complete_type.8b4: <witness> = complete_type_witness %I.type.aab [concrete]
// CHECK:STDOUT: %J.type.d682d6.3: type = facet_type <@J, @J(%empty_struct_type):identified> [concrete]
// CHECK:STDOUT: %.ea2: <witness> = impl_self_witness %C, @I, @I(%empty_struct_type) [concrete]
// CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @C.as.I.impl.%I.impl_witness_table [concrete]
// CHECK:STDOUT: %Self.e1f642.2: %J.type.d682d6.2 = symbolic_binding Self, 1 [symbolic]
// CHECK:STDOUT: %I.type.aaf: type = facet_type <@I, @I(%empty_struct_type)> [concrete]
// CHECK:STDOUT: %Self.968: %I.type.aaf = symbolic_binding Self, 1 [symbolic]
// CHECK:STDOUT: %complete_type.a15: <witness> = complete_type_witness %I.type.aaf [concrete]
// CHECK:STDOUT: %I.facet: %I.type.aaf = facet_value %C, (%I.impl_witness) [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -825,11 +829,37 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %Self => constants.%Self.e1f642.2
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @J.WithSelf(constants.%empty_struct_type, constants.%C) [identified] {
// CHECK:STDOUT: specific @J.WithSelf(constants.%empty_struct_type, constants.%C):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %T => constants.%empty_struct_type
// CHECK:STDOUT: %I.type => constants.%I.type.aaf
// CHECK:STDOUT: %require_complete => constants.%complete_type.a15
// CHECK:STDOUT: %I.type => constants.%I.type.aab
// CHECK:STDOUT: %require_complete => constants.%complete_type.8b4
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I(constants.%empty_struct_type):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%empty_struct_type
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %I.type => constants.%I.type.aab
// CHECK:STDOUT: %Self => constants.%Self.551
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I.WithSelf(constants.%empty_struct_type, constants.%Self.a4f):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @J.WithSelf.Self.as_type.impls.I.type.require(constants.%empty_struct_type, constants.%C):identified {
// CHECK:STDOUT: %T => constants.%empty_struct_type
// CHECK:STDOUT: %J.type => constants.%J.type.d682d6.3
// CHECK:STDOUT: %Self => constants.%C
// CHECK:STDOUT: %Self.as_type => constants.%C
// CHECK:STDOUT: %I.type => constants.%I.type.aab
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @J(constants.%empty_struct_type):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%empty_struct_type
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I(constants.%empty_struct_type) {
@@ -841,18 +871,6 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %Self => constants.%Self.968
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I.WithSelf(constants.%empty_struct_type, constants.%Self.a4f) {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @J.WithSelf.Self.as_type.impls.I.type.require(constants.%empty_struct_type, constants.%C) [identified] {
// CHECK:STDOUT: %T => constants.%empty_struct_type
// CHECK:STDOUT: %J.type => constants.%J.type.d682d6.2
// CHECK:STDOUT: %Self => constants.%C
// CHECK:STDOUT: %Self.as_type => constants.%C
// CHECK:STDOUT: %I.type => constants.%I.type.aaf
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @J.WithSelf(constants.%empty_struct_type, constants.%Self.e1f642.1) {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %T => constants.%empty_struct_type
@@ -860,6 +878,10 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %require_complete => constants.%complete_type.a15
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I.WithSelf(constants.%empty_struct_type, constants.%Self.a4f) {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I.WithSelf(constants.%empty_struct_type, constants.%I.facet) {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
@@ -1178,7 +1200,13 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %N.type.d682d6.1: type = facet_type <@N, @N(%T)> [symbolic]
// CHECK:STDOUT: %Self.e1f: %N.type.d682d6.1 = symbolic_binding Self, 1 [symbolic]
// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.e1f [symbolic]
// CHECK:STDOUT: %N.type.d682d6.2: type = facet_type <@N, @N(%ptr)> [symbolic]
// CHECK:STDOUT: %I.type.d5d: type = facet_type <@I, @I(%T):identified> [symbolic]
// CHECK:STDOUT: %require_complete.bb5: <witness> = require_complete_type %I.type.d5d [symbolic]
// CHECK:STDOUT: %N.type.d682d6.2: type = facet_type <@N, @N(%T):identified> [symbolic]
// CHECK:STDOUT: %N.type.d682d6.3: type = facet_type <@N, @N(%ptr)> [symbolic]
// CHECK:STDOUT: %I.type.97e: type = facet_type <@I, @I(%ptr):identified> [symbolic]
// CHECK:STDOUT: %require_complete.bfd: <witness> = require_complete_type %I.type.97e [symbolic]
// CHECK:STDOUT: %N.type.d682d6.4: type = facet_type <@N, @N(%ptr):identified> [symbolic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -1297,7 +1325,7 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct]
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc25_15.1 [symbolic = %T.loc25_15.2 (constants.%T)]
// CHECK:STDOUT: %ptr.loc25_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc25_31.2 (constants.%ptr)]
// CHECK:STDOUT: %N.type.loc25_32.1: type = facet_type <@N, @N(constants.%ptr)> [symbolic = %N.type.loc25_32.2 (constants.%N.type.d682d6.2)]
// CHECK:STDOUT: %N.type.loc25_32.1: type = facet_type <@N, @N(constants.%ptr)> [symbolic = %N.type.loc25_32.2 (constants.%N.type.d682d6.3)]
// CHECK:STDOUT: %.loc25_17.1: type = splice_block %.loc25_17.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc25_17.2: type = type_literal type [concrete = type]
@@ -1450,7 +1478,7 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %T.patt.loc25_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_15.2 (constants.%T.patt)]
// CHECK:STDOUT: %T.loc25_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc25_15.2 (constants.%T)]
// CHECK:STDOUT: %ptr.loc25_31.2: type = ptr_type %T.loc25_15.2 [symbolic = %ptr.loc25_31.2 (constants.%ptr)]
// CHECK:STDOUT: %N.type.loc25_32.2: type = facet_type <@N, @N(%ptr.loc25_31.2)> [symbolic = %N.type.loc25_32.2 (constants.%N.type.d682d6.2)]
// CHECK:STDOUT: %N.type.loc25_32.2: type = facet_type <@N, @N(%ptr.loc25_31.2)> [symbolic = %N.type.loc25_32.2 (constants.%N.type.d682d6.3)]
// CHECK:STDOUT: %.loc25_33: <witness> = impl_self_witness constants.%C, @I, @I(%ptr.loc25_31.2) [symbolic = %.loc25_33 (constants.%.f39)]
// CHECK:STDOUT:
// CHECK:STDOUT: impl: %C.ref as %N.type.loc25_32.1;
@@ -1547,19 +1575,29 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %I.type => constants.%I.type.184
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf(constants.%T, constants.%C) [identified] {
// CHECK:STDOUT: specific @N.WithSelf(constants.%T, constants.%C):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %T => constants.%T
// CHECK:STDOUT: %I.type => constants.%I.type.184
// CHECK:STDOUT: %require_complete => constants.%require_complete.abf
// CHECK:STDOUT: %I.type => constants.%I.type.d5d
// CHECK:STDOUT: %require_complete => constants.%require_complete.bb5
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.I.type.require(constants.%T, constants.%C) [identified] {
// CHECK:STDOUT: specific @I(constants.%T):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%T
// CHECK:STDOUT: %N.type => constants.%N.type.d682d6.1
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.I.type.require(constants.%T, constants.%C):identified {
// CHECK:STDOUT: %T => constants.%T
// CHECK:STDOUT: %N.type => constants.%N.type.d682d6.2
// CHECK:STDOUT: %Self => constants.%C
// CHECK:STDOUT: %Self.as_type => constants.%C
// CHECK:STDOUT: %I.type => constants.%I.type.184
// CHECK:STDOUT: %I.type => constants.%I.type.d5d
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N(constants.%T):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%T
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @C.as.I.impl.042f52.1(constants.%T) {
@@ -1574,26 +1612,36 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %T => constants.%ptr
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf(constants.%ptr, constants.%C) [identified] {
// CHECK:STDOUT: specific @N.WithSelf(constants.%ptr, constants.%C):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %T => constants.%ptr
// CHECK:STDOUT: %I.type => constants.%I.type.751
// CHECK:STDOUT: %require_complete => constants.%require_complete.d61
// CHECK:STDOUT: %I.type => constants.%I.type.97e
// CHECK:STDOUT: %require_complete => constants.%require_complete.bfd
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.I.type.require(constants.%ptr, constants.%C) [identified] {
// CHECK:STDOUT: specific @I(constants.%ptr):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%ptr
// CHECK:STDOUT: %N.type => constants.%N.type.d682d6.2
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.I.type.require(constants.%ptr, constants.%C):identified {
// CHECK:STDOUT: %T => constants.%ptr
// CHECK:STDOUT: %N.type => constants.%N.type.d682d6.4
// CHECK:STDOUT: %Self => constants.%C
// CHECK:STDOUT: %Self.as_type => constants.%C
// CHECK:STDOUT: %I.type => constants.%I.type.751
// CHECK:STDOUT: %I.type => constants.%I.type.97e
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N(constants.%ptr):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%ptr
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @C.as.I.impl.042f52.2(constants.%T) {
// CHECK:STDOUT: %T.patt.loc25_15.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc25_15.2 => constants.%T
// CHECK:STDOUT: %ptr.loc25_31.2 => constants.%ptr
// CHECK:STDOUT: %N.type.loc25_32.2 => constants.%N.type.d682d6.2
// CHECK:STDOUT: %N.type.loc25_32.2 => constants.%N.type.d682d6.3
// CHECK:STDOUT: %.loc25_33 => constants.%.f39
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1831,11 +1879,14 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.e1f642.1 [symbolic]
// CHECK:STDOUT: %ptr.125: type = ptr_type %ptr.e8f [symbolic]
// CHECK:STDOUT: %N.type.d682d6.2: type = facet_type <@N, @N(%ptr.125)> [symbolic]
// CHECK:STDOUT: %I.type.539: type = facet_type <@I, @I(%ptr.125)> [symbolic]
// CHECK:STDOUT: %require_complete.776: <witness> = require_complete_type %I.type.539 [symbolic]
// CHECK:STDOUT: %I.type.1c0: type = facet_type <@I, @I(%ptr.125):identified> [symbolic]
// CHECK:STDOUT: %require_complete.d22: <witness> = require_complete_type %I.type.1c0 [symbolic]
// CHECK:STDOUT: %N.type.d682d6.3: type = facet_type <@N, @N(%ptr.125):identified> [symbolic]
// CHECK:STDOUT: %.27c: <witness> = impl_self_witness %C, @I, @I(%ptr.125) [symbolic]
// CHECK:STDOUT: %I.impl_witness.3cb: <witness> = impl_witness @C.as.I.impl.042.%I.impl_witness_table, @C.as.I.impl.042(%T) [symbolic]
// CHECK:STDOUT: %Self.e1f642.2: %N.type.d682d6.2 = symbolic_binding Self, 1 [symbolic]
// CHECK:STDOUT: %I.type.539: type = facet_type <@I, @I(%ptr.125)> [symbolic]
// CHECK:STDOUT: %require_complete.776: <witness> = require_complete_type %I.type.539 [symbolic]
// CHECK:STDOUT: %require_complete.533: <witness> = require_complete_type %N.type.d682d6.2 [symbolic]
// CHECK:STDOUT: %I.facet.869: %I.type.539 = facet_value %C, (%I.impl_witness.3cb) [symbolic]
// CHECK:STDOUT: }
@@ -2087,11 +2138,29 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %Self => constants.%Self.e1f642.2
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf(constants.%ptr.125, constants.%C) [identified] {
// CHECK:STDOUT: specific @N.WithSelf(constants.%ptr.125, constants.%C):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %T => constants.%ptr.125
// CHECK:STDOUT: %I.type => constants.%I.type.539
// CHECK:STDOUT: %require_complete => constants.%require_complete.776
// CHECK:STDOUT: %I.type => constants.%I.type.1c0
// CHECK:STDOUT: %require_complete => constants.%require_complete.d22
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I(constants.%ptr.125):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%ptr.125
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.I.type.require(constants.%ptr.125, constants.%C):identified {
// CHECK:STDOUT: %T => constants.%ptr.125
// CHECK:STDOUT: %N.type => constants.%N.type.d682d6.3
// CHECK:STDOUT: %Self => constants.%C
// CHECK:STDOUT: %Self.as_type => constants.%C
// CHECK:STDOUT: %I.type => constants.%I.type.1c0
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N(constants.%ptr.125):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%ptr.125
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I(constants.%ptr.125) {
@@ -2099,14 +2168,6 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %T => constants.%ptr.125
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.I.type.require(constants.%ptr.125, constants.%C) [identified] {
// CHECK:STDOUT: %T => constants.%ptr.125
// CHECK:STDOUT: %N.type => constants.%N.type.d682d6.2
// CHECK:STDOUT: %Self => constants.%C
// CHECK:STDOUT: %Self.as_type => constants.%C
// CHECK:STDOUT: %I.type => constants.%I.type.539
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @C.as.I.impl.042(constants.%T) {
// CHECK:STDOUT: %T.patt.loc6_15.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc6_15.2 => constants.%T
@@ -2383,10 +2444,14 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %empty_struct: %N.type.b76 = struct_value () [concrete]
// CHECK:STDOUT: %N.type.d682d6.1: type = facet_type <@N, @N(%T)> [symbolic]
// CHECK:STDOUT: %Self.e1f: %N.type.d682d6.1 = symbolic_binding Self, 1 [symbolic]
// CHECK:STDOUT: %require_complete.bd0: <witness> = require_complete_type %J.type.ed5 [symbolic]
// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.e1f [symbolic]
// CHECK:STDOUT: %N.type.d682d6.2: type = facet_type <@N, @N(%ptr)> [symbolic]
// CHECK:STDOUT: %require_complete.3d2: <witness> = require_complete_type %J.type.a41 [symbolic]
// CHECK:STDOUT: %J.type.17a: type = facet_type <@J, @J(%T):identified> [symbolic]
// CHECK:STDOUT: %require_complete.b01: <witness> = require_complete_type %J.type.17a [symbolic]
// CHECK:STDOUT: %N.type.d682d6.2: type = facet_type <@N, @N(%T):identified> [symbolic]
// CHECK:STDOUT: %N.type.d682d6.3: type = facet_type <@N, @N(%ptr)> [symbolic]
// CHECK:STDOUT: %J.type.31c: type = facet_type <@J, @J(%ptr):identified> [symbolic]
// CHECK:STDOUT: %require_complete.9f3: <witness> = require_complete_type %J.type.31c [symbolic]
// CHECK:STDOUT: %N.type.d682d6.4: type = facet_type <@N, @N(%ptr):identified> [symbolic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -2501,7 +2566,7 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct]
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc26_15.1 [symbolic = %T.loc26_15.2 (constants.%T)]
// CHECK:STDOUT: %ptr.loc26_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc26_31.2 (constants.%ptr)]
// CHECK:STDOUT: %N.type.loc26_32.1: type = facet_type <@N, @N(constants.%ptr)> [symbolic = %N.type.loc26_32.2 (constants.%N.type.d682d6.2)]
// CHECK:STDOUT: %N.type.loc26_32.1: type = facet_type <@N, @N(constants.%ptr)> [symbolic = %N.type.loc26_32.2 (constants.%N.type.d682d6.3)]
// CHECK:STDOUT: %.loc26_17.1: type = splice_block %.loc26_17.2 [concrete = type] {
// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen]
// CHECK:STDOUT: %.loc26_17.2: type = type_literal type [concrete = type]
@@ -2646,7 +2711,7 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %T.patt.loc26_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_15.2 (constants.%T.patt)]
// CHECK:STDOUT: %T.loc26_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc26_15.2 (constants.%T)]
// CHECK:STDOUT: %ptr.loc26_31.2: type = ptr_type %T.loc26_15.2 [symbolic = %ptr.loc26_31.2 (constants.%ptr)]
// CHECK:STDOUT: %N.type.loc26_32.2: type = facet_type <@N, @N(%ptr.loc26_31.2)> [symbolic = %N.type.loc26_32.2 (constants.%N.type.d682d6.2)]
// CHECK:STDOUT: %N.type.loc26_32.2: type = facet_type <@N, @N(%ptr.loc26_31.2)> [symbolic = %N.type.loc26_32.2 (constants.%N.type.d682d6.3)]
// CHECK:STDOUT: %.loc26_34: <witness> = impl_self_witness constants.%D, @J, @J(%ptr.loc26_31.2) [symbolic = %.loc26_34 (constants.%.d76)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
@@ -2745,19 +2810,29 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %J.type => constants.%J.type.ed5
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf(constants.%T, constants.%D) [identified] {
// CHECK:STDOUT: specific @N.WithSelf(constants.%T, constants.%D):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %T => constants.%T
// CHECK:STDOUT: %J.type => constants.%J.type.ed5
// CHECK:STDOUT: %require_complete => constants.%require_complete.bd0
// CHECK:STDOUT: %J.type => constants.%J.type.17a
// CHECK:STDOUT: %require_complete => constants.%require_complete.b01
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.J.type.require(constants.%T, constants.%D) [identified] {
// CHECK:STDOUT: specific @J(constants.%T):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%T
// CHECK:STDOUT: %N.type => constants.%N.type.d682d6.1
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.J.type.require(constants.%T, constants.%D):identified {
// CHECK:STDOUT: %T => constants.%T
// CHECK:STDOUT: %N.type => constants.%N.type.d682d6.2
// CHECK:STDOUT: %Self => constants.%D
// CHECK:STDOUT: %Self.as_type => constants.%D
// CHECK:STDOUT: %J.type => constants.%J.type.ed5
// CHECK:STDOUT: %J.type => constants.%J.type.17a
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N(constants.%T):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%T
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @D.as.J.impl.d69d6f.1(constants.%T) {
@@ -2772,26 +2847,36 @@ impl forall [T: type] D as N(T*) {}
// CHECK:STDOUT: %T => constants.%ptr
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf(constants.%ptr, constants.%D) [identified] {
// CHECK:STDOUT: specific @N.WithSelf(constants.%ptr, constants.%D):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %T => constants.%ptr
// CHECK:STDOUT: %J.type => constants.%J.type.a41
// CHECK:STDOUT: %require_complete => constants.%require_complete.3d2
// CHECK:STDOUT: %J.type => constants.%J.type.31c
// CHECK:STDOUT: %require_complete => constants.%require_complete.9f3
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.J.type.require(constants.%ptr, constants.%D) [identified] {
// CHECK:STDOUT: specific @J(constants.%ptr):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%ptr
// CHECK:STDOUT: %N.type => constants.%N.type.d682d6.2
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.J.type.require(constants.%ptr, constants.%D):identified {
// CHECK:STDOUT: %T => constants.%ptr
// CHECK:STDOUT: %N.type => constants.%N.type.d682d6.4
// CHECK:STDOUT: %Self => constants.%D
// CHECK:STDOUT: %Self.as_type => constants.%D
// CHECK:STDOUT: %J.type => constants.%J.type.a41
// CHECK:STDOUT: %J.type => constants.%J.type.31c
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N(constants.%ptr):identified {
// CHECK:STDOUT: %T.patt => constants.%T.patt
// CHECK:STDOUT: %T => constants.%ptr
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @D.as.J.impl.d69d6f.2(constants.%T) {
// CHECK:STDOUT: %T.patt.loc26_15.2 => constants.%T.patt
// CHECK:STDOUT: %T.loc26_15.2 => constants.%T
// CHECK:STDOUT: %ptr.loc26_31.2 => constants.%ptr
// CHECK:STDOUT: %N.type.loc26_32.2 => constants.%N.type.d682d6.2
// CHECK:STDOUT: %N.type.loc26_32.2 => constants.%N.type.d682d6.3
// CHECK:STDOUT: %.loc26_34 => constants.%.d76
// CHECK:STDOUT: }
// CHECK:STDOUT:
+2 -2
View File
@@ -1087,11 +1087,11 @@ interface B {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Y.WithSelf(constants.%Self.b43) [identified] {
// CHECK:STDOUT: specific @Y.WithSelf(constants.%Self.b43):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Y.WithSelf.Self.as_type.impls.Z.type.require(constants.%Self.b43) [identified] {
// CHECK:STDOUT: specific @Y.WithSelf.Self.as_type.impls.Z.type.require(constants.%Self.b43):identified {
// CHECK:STDOUT: %Self => constants.%Self.b43
// CHECK:STDOUT: %Self.as_type.loc6_11.2 => constants.%Self.as_type.ace
// CHECK:STDOUT: }
@@ -267,7 +267,7 @@ fn G(generic T: Z, generic U: Empty(T), generic V: type) {
// CHECK:STDOUT: %V.loc20_50.1 => constants.%V
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Empty.WithSelf(constants.%T.as_type, constants.%empty_struct_type) [identified] {
// CHECK:STDOUT: specific @Empty.WithSelf(constants.%T.as_type, constants.%empty_struct_type):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -282,7 +282,7 @@ 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, type) [identified] {
// CHECK:STDOUT: specific @Empty.WithSelf(constants.%T.as_type, type):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -297,7 +297,7 @@ 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.%T.013) [identified] {
// CHECK:STDOUT: specific @Empty.WithSelf(constants.%T.as_type, constants.%T.013):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -323,7 +323,7 @@ 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.%V) [identified] {
// CHECK:STDOUT: specific @Empty.WithSelf(constants.%T.as_type, constants.%V):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
+35 -33
View File
@@ -815,11 +815,11 @@ constraint N {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf(constants.%T) [identified] {
// CHECK:STDOUT: specific @Z.WithSelf(constants.%T):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%T) [identified] {
// CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%T):identified {
// CHECK:STDOUT: %Self => constants.%T
// CHECK:STDOUT: %Self.as_type.loc9_18.2 => constants.%T.as_type
// CHECK:STDOUT: }
@@ -850,6 +850,8 @@ constraint N {
// CHECK:STDOUT: %require_complete.331: <witness> = require_complete_type %Y.type.a55 [symbolic]
// CHECK:STDOUT: %Y.assoc_type.18b: type = assoc_entity_type @Y, @Y(%T.as_type) [symbolic]
// CHECK:STDOUT: %assoc0.eff: %Y.assoc_type.18b = assoc_entity element0, @Y.WithSelf.%Y.WithSelf.YY.decl [symbolic]
// CHECK:STDOUT: %Y.type.7e4: type = facet_type <@Y, @Y(%T.as_type):identified> [symbolic]
// CHECK:STDOUT: %require_complete.aa7: <witness> = require_complete_type %Y.type.7e4 [symbolic]
// CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %T.f45, @Y, @Y(%T.as_type) [symbolic]
// CHECK:STDOUT: %Y.facet: %Y.type.a55 = facet_value %T.as_type, (%Y.lookup_impl_witness) [symbolic]
// CHECK:STDOUT: %Y.WithSelf.YY.type.e81: type = fn_type @Y.WithSelf.YY, @Y.WithSelf(%T.as_type, %Y.facet) [symbolic]
@@ -979,18 +981,18 @@ constraint N {
// CHECK:STDOUT: %require_complete => constants.%require_complete.331
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf(constants.%T.f45) [identified] {
// CHECK:STDOUT: specific @Z.WithSelf(constants.%T.f45):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %Self => constants.%T.f45
// CHECK:STDOUT: %Self.as_type => constants.%T.as_type
// CHECK:STDOUT: %Y.type => constants.%Y.type.a55
// CHECK:STDOUT: %require_complete => constants.%require_complete.331
// CHECK:STDOUT: %Y.type => constants.%Y.type.7e4
// CHECK:STDOUT: %require_complete => constants.%require_complete.aa7
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%T.f45) [identified] {
// CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%T.f45):identified {
// CHECK:STDOUT: %Self => constants.%T.f45
// CHECK:STDOUT: %Self.as_type.loc9_18.2 => constants.%T.as_type
// CHECK:STDOUT: %Y.type.loc9_30.2 => constants.%Y.type.a55
// CHECK:STDOUT: %Y.type.loc9_30.2 => constants.%Y.type.7e4
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- implicit_self_impls.carbon
@@ -1044,11 +1046,11 @@ constraint N {
// CHECK:STDOUT: %Self.as_type.loc9_11.2 => constants.%Self.as_type
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf(constants.%T) [identified] {
// CHECK:STDOUT: specific @Z.WithSelf(constants.%T):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%T) [identified] {
// CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%T):identified {
// CHECK:STDOUT: %Self => constants.%T
// CHECK:STDOUT: %Self.as_type.loc9_11.2 => constants.%T.as_type
// CHECK:STDOUT: }
@@ -1106,11 +1108,11 @@ constraint N {
// CHECK:STDOUT: %Self.as_type.loc9_11.2 => constants.%Self.as_type
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf(constants.%T) [identified] {
// CHECK:STDOUT: specific @Z.WithSelf(constants.%T):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%T) [identified] {
// CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%T):identified {
// CHECK:STDOUT: %Self => constants.%T
// CHECK:STDOUT: %Self.as_type.loc9_11.2 => constants.%T.as_type
// CHECK:STDOUT: }
@@ -1254,7 +1256,7 @@ constraint N {
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.d87) {}
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.d87) [identified] {}
// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.d87):identified {}
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y_where.type.require(constants.%Self.d87) {
// CHECK:STDOUT: %Self => constants.%Self.d87
@@ -1425,7 +1427,7 @@ constraint N {
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.d87) {}
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.d87) [identified] {}
// CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.d87):identified {}
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y_where.type.require(constants.%Self.d87) {
// CHECK:STDOUT: %Self => constants.%Self.d87
@@ -1458,7 +1460,7 @@ constraint N {
// CHECK:STDOUT: %facet_type.e5c: type = facet_type <@Z & @Y, @Y(%.Self.c86)> [symbolic_self]
// CHECK:STDOUT: %T.d09: %facet_type.e5c = symbolic_binding T, 0 [symbolic]
// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.d09 [symbolic]
// CHECK:STDOUT: %Z_where.type.bfc: type = facet_type <@Z where .Self impls @Y, @Y(%T.as_type)> [symbolic]
// CHECK:STDOUT: %Z_where.type.8a6: type = facet_type <@Z where .Self impls @Y, @Y(%T.as_type):identified> [symbolic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -1526,14 +1528,14 @@ constraint N {
// CHECK:STDOUT: %Z_where.type.loc10_19.2 => constants.%Z_where.type.e7d
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf(constants.%T.d09) [identified] {
// CHECK:STDOUT: specific @N.WithSelf(constants.%T.d09):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.Z_where.type.require(constants.%T.d09) [identified] {
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.Z_where.type.require(constants.%T.d09):identified {
// CHECK:STDOUT: %Self => constants.%T.d09
// CHECK:STDOUT: %Self.as_type.loc10_11.2 => constants.%T.as_type
// CHECK:STDOUT: %Z_where.type.loc10_19.2 => constants.%Z_where.type.bfc
// CHECK:STDOUT: %Z_where.type.loc10_19.2 => constants.%Z_where.type.8a6
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- require_with_specific_period_self.carbon
@@ -1558,11 +1560,11 @@ constraint N {
// CHECK:STDOUT: %Y.type.23e: type = facet_type <@Y, @Y(%.Self.as_type)> [symbolic_self]
// CHECK:STDOUT: %Z_where.type.a0f3c6.1: type = facet_type <@Z where %C.cf2 impls @Y, @Y(%.Self.as_type)> [concrete]
// CHECK:STDOUT: %C.f15: type = class_type @C, @C(%Self.as_type) [symbolic]
// CHECK:STDOUT: %Z_where.type.a0f3c6.2: type = facet_type <@Z where %C.f15 impls @Y, @Y(%Self.as_type)> [symbolic]
// CHECK:STDOUT: %Z_where.type.a0f3c6.3: type = facet_type <@Z where %C.f15 impls @Y, @Y(%Self.as_type)> [symbolic]
// CHECK:STDOUT: %T.013: %Z.type = symbolic_binding T, 0 [symbolic]
// CHECK:STDOUT: %T.as_type: type = facet_access_type %T.013 [symbolic]
// CHECK:STDOUT: %C.7b3: type = class_type @C, @C(%T.as_type) [symbolic]
// CHECK:STDOUT: %Z_where.type.a0f3c6.3: type = facet_type <@Z where %C.7b3 impls @Y, @Y(%T.as_type)> [symbolic]
// CHECK:STDOUT: %C.f24: type = class_type @C, @C(%T.as_type):identified [symbolic]
// CHECK:STDOUT: %Z_where.type.a0f3c6.4: type = facet_type <@Z where %C.f24 impls @Y, @Y(%T.as_type):identified> [symbolic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -1599,7 +1601,7 @@ constraint N {
// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %Z.ref [concrete]
// CHECK:STDOUT: %impls.loc10_34.2 = requirement_impls %C.loc10_32.2, %Y.type.loc10_47.2 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Z_where.type.loc10_19.1: type = facet_type <@Z where constants.%C.f15 impls @Y, @Y(constants.%Self.as_type)> [symbolic = %Z_where.type.loc10_19.2 (constants.%Z_where.type.a0f3c6.2)]
// CHECK:STDOUT: %Z_where.type.loc10_19.1: type = facet_type <@Z where constants.%C.f15 impls @Y, @Y(constants.%Self.as_type)> [symbolic = %Z_where.type.loc10_19.2 (constants.%Z_where.type.a0f3c6.3)]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: !members:
@@ -1621,7 +1623,7 @@ constraint N {
// CHECK:STDOUT: %Self: %N.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.d87)]
// CHECK:STDOUT: %Self.as_type.loc10_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc10_11.2 (constants.%Self.as_type)]
// CHECK:STDOUT: %C.loc10_19: type = class_type @C, @C(%Self.as_type.loc10_11.2) [symbolic = %C.loc10_19 (constants.%C.f15)]
// CHECK:STDOUT: %Z_where.type.loc10_19.2: type = facet_type <@Z where %C.loc10_19 impls @Y, @Y(%Self.as_type.loc10_11.2)> [symbolic = %Z_where.type.loc10_19.2 (constants.%Z_where.type.a0f3c6.2)]
// CHECK:STDOUT: %Z_where.type.loc10_19.2: type = facet_type <@Z where %C.loc10_19 impls @Y, @Y(%Self.as_type.loc10_11.2)> [symbolic = %Z_where.type.loc10_19.2 (constants.%Z_where.type.a0f3c6.3)]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf(constants.%Self.d87) {}
@@ -1630,17 +1632,17 @@ constraint N {
// CHECK:STDOUT: %Self => constants.%Self.d87
// CHECK:STDOUT: %Self.as_type.loc10_11.2 => constants.%Self.as_type
// CHECK:STDOUT: %C.loc10_19 => constants.%C.f15
// CHECK:STDOUT: %Z_where.type.loc10_19.2 => constants.%Z_where.type.a0f3c6.2
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf(constants.%T.013) [identified] {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.Z_where.type.require(constants.%T.013) [identified] {
// CHECK:STDOUT: %Self => constants.%T.013
// CHECK:STDOUT: %Self.as_type.loc10_11.2 => constants.%T.as_type
// CHECK:STDOUT: %C.loc10_19 => constants.%C.7b3
// CHECK:STDOUT: %Z_where.type.loc10_19.2 => constants.%Z_where.type.a0f3c6.3
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf(constants.%T.013):identified {
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.Z_where.type.require(constants.%T.013):identified {
// CHECK:STDOUT: %Self => constants.%T.013
// CHECK:STDOUT: %Self.as_type.loc10_11.2 => constants.%T.as_type
// CHECK:STDOUT: %C.loc10_19 => constants.%C.f24
// CHECK:STDOUT: %Z_where.type.loc10_19.2 => constants.%Z_where.type.a0f3c6.4
// CHECK:STDOUT: }
// CHECK:STDOUT:
+6 -12
View File
@@ -1116,8 +1116,7 @@ static auto IdentifyFacetType(Context& context, SemIR::LocId loc_id,
auto constraint_with_self_specific_id = MakeSpecificWithInnerSelf(
context, loc_id, constraint.generic_id,
constraint.generic_with_self_id, extends.specific_id, self_const_id,
/*make_identified_specific=*/true);
constraint.generic_with_self_id, extends.specific_id, self_const_id);
if (context.specifics().HasError(constraint_with_self_specific_id)) {
return SemIR::IdentifiedFacetTypeId::None;
}
@@ -1130,8 +1129,7 @@ static auto IdentifyFacetType(Context& context, SemIR::LocId loc_id,
// instantiated.
auto require_specific_id = CopySpecificToGeneric(
context, SemIR::LocId(require.decl_id),
constraint_with_self_specific_id, require.generic_id,
/*make_identified_specific=*/true);
constraint_with_self_specific_id, require.generic_id);
auto require_self = GetConstantValueInSpecific(
context.sem_ir(), require_specific_id, require.self_id);
auto require_facet_type = GetConstantValueInSpecific(
@@ -1175,8 +1173,7 @@ static auto IdentifyFacetType(Context& context, SemIR::LocId loc_id,
auto constraint_with_self_specific_id = MakeSpecificWithInnerSelf(
context, loc_id, constraint.generic_id,
constraint.generic_with_self_id, impls.specific_id, self_const_id,
/*make_identified_specific=*/true);
constraint.generic_with_self_id, impls.specific_id, self_const_id);
if (context.specifics().HasError(constraint_with_self_specific_id)) {
return SemIR::IdentifiedFacetTypeId::None;
}
@@ -1189,8 +1186,7 @@ static auto IdentifyFacetType(Context& context, SemIR::LocId loc_id,
// instantiated.
auto require_specific_id = CopySpecificToGeneric(
context, SemIR::LocId(require.decl_id),
constraint_with_self_specific_id, require.generic_id,
/*make_identified_specific=*/true);
constraint_with_self_specific_id, require.generic_id);
auto require_self = GetConstantValueInSpecific(
context.sem_ir(), require_specific_id, require.self_id);
auto require_facet_type = GetConstantValueInSpecific(
@@ -1236,8 +1232,7 @@ static auto IdentifyFacetType(Context& context, SemIR::LocId loc_id,
auto constraint_with_self_specific_id = MakeSpecificWithInnerSelf(
context, loc_id, constraint.generic_id,
constraint.generic_with_self_id, impls.specific_id,
context.constant_values().Get(self_type_inst_id),
/*make_identified_specific=*/true);
context.constant_values().Get(self_type_inst_id));
if (context.specifics().HasError(constraint_with_self_specific_id)) {
return SemIR::IdentifiedFacetTypeId::None;
}
@@ -1250,8 +1245,7 @@ static auto IdentifyFacetType(Context& context, SemIR::LocId loc_id,
// instantiated.
auto require_specific_id = CopySpecificToGeneric(
context, SemIR::LocId(require.decl_id),
constraint_with_self_specific_id, require.generic_id,
/*make_identified_specific=*/true);
constraint_with_self_specific_id, require.generic_id);
auto require_self = GetConstantValueInSpecific(
context.sem_ir(), require_specific_id, require.self_id);
auto require_facet_type = GetConstantValueInSpecific(
+3 -3
View File
@@ -691,9 +691,6 @@ auto Formatter::FormatSpecific(SpecificId id, const Specific& specific)
out() << "specific ";
FormatName(id);
out() << " ";
if (specific.identified) {
out() << "[identified] ";
}
OpenBrace();
FormatSpecificRegion(generic, specific, GenericInstIndex::Region::Declaration,
@@ -1765,6 +1762,9 @@ auto Formatter::FormatName(SpecificId id) -> void {
const auto& specific = sem_ir_->specifics().Get(id);
FormatName(specific.generic_id);
FormatArg(specific.args_id);
if (specific.identified) {
out() << ":identified";
}
}
auto Formatter::FormatName(SpecificInterfaceId id) -> void {