mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 13:31:06 +01:00
Make FacetAccessType evaluate to SymbolicBindingType for type-of a BindSymbolicName (#6115)
The SymbolicBindingType refers to the type value that will be substituted in for the BindSymbolicName, but holds onto the EntityNameId from the BindSymbolicName instead of (or in addition to, for now) the instruction. The EntityNameId will be used to look in the ScopeStack to find the witnesses either from the BindSymbolicName instruction, or other instructions that specify `impls` constraints against the EntityName. This will allow us to have the `T` in `I(T)` resolve to a `.Self` reference in the type so that we get type equality with the binding's type: `T:! I(.Self)`.
This commit is contained in:
+31
-31
@@ -71,16 +71,16 @@ fn H() { G(3); }
|
||||
// CHECK:STDOUT: %Destroy.Op.type: type = fn_type @Destroy.Op [concrete]
|
||||
// CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
|
||||
// CHECK:STDOUT: %DestroyT: %type_where = bind_symbolic_name DestroyT, 0 [symbolic]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.type.190: type = fn_type @DestroyT.as_type.as.Destroy.impl.Op, @DestroyT.as_type.as.Destroy.impl(%DestroyT) [symbolic]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.8a0: %DestroyT.as_type.as.Destroy.impl.Op.type.190 = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.b5d: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%DestroyT) [symbolic]
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.544: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.b5d = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %facet_value.bf1: %type_where = facet_value %array_type.281, () [symbolic]
|
||||
// CHECK:STDOUT: %Destroy.impl_witness.f4a: <witness> = impl_witness imports.%Destroy.impl_witness_table, @DestroyT.as_type.as.Destroy.impl(%facet_value.bf1) [symbolic]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.type.565: type = fn_type @DestroyT.as_type.as.Destroy.impl.Op, @DestroyT.as_type.as.Destroy.impl(%facet_value.bf1) [symbolic]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.dd2: %DestroyT.as_type.as.Destroy.impl.Op.type.565 = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %Destroy.impl_witness.5dc: <witness> = impl_witness imports.%Destroy.impl_witness_table, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.bf1) [symbolic]
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.90e: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.bf1) [symbolic]
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.84c: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.90e = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %require_complete.662: <witness> = require_complete_type %ptr.e06 [symbolic]
|
||||
// CHECK:STDOUT: %Destroy.facet.f25: %Destroy.type = facet_value %array_type.281, (%Destroy.impl_witness.f4a) [symbolic]
|
||||
// CHECK:STDOUT: %.3d9: type = fn_type_with_self_type %Destroy.Op.type, %Destroy.facet.f25 [symbolic]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.specific_fn.c7c: <specific function> = specific_function %DestroyT.as_type.as.Destroy.impl.Op.dd2, @DestroyT.as_type.as.Destroy.impl.Op(%facet_value.bf1) [symbolic]
|
||||
// CHECK:STDOUT: %Destroy.facet.b30: %Destroy.type = facet_value %array_type.281, (%Destroy.impl_witness.5dc) [symbolic]
|
||||
// CHECK:STDOUT: %.dc4: type = fn_type_with_self_type %Destroy.Op.type, %Destroy.facet.b30 [symbolic]
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.9d2: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.84c, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.bf1) [symbolic]
|
||||
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
||||
// CHECK:STDOUT: %array_type.6f1: type = array_type %int_0, %C [concrete]
|
||||
// CHECK:STDOUT: %ptr.cf4: type = ptr_type %array_type.6f1 [concrete]
|
||||
@@ -88,18 +88,18 @@ fn H() { G(3); }
|
||||
// CHECK:STDOUT: %pattern_type.9c8: type = pattern_type %array_type.6f1 [concrete]
|
||||
// CHECK:STDOUT: %array.2e5: %array_type.6f1 = tuple_value () [concrete]
|
||||
// CHECK:STDOUT: %facet_value.cba: %type_where = facet_value %array_type.6f1, () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.impl_witness.20d: <witness> = impl_witness imports.%Destroy.impl_witness_table, @DestroyT.as_type.as.Destroy.impl(%facet_value.cba) [concrete]
|
||||
// CHECK:STDOUT: %Destroy.facet.ad5: %Destroy.type = facet_value %array_type.6f1, (%Destroy.impl_witness.20d) [concrete]
|
||||
// CHECK:STDOUT: %.600: type = fn_type_with_self_type %Destroy.Op.type, %Destroy.facet.ad5 [concrete]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.type.710: type = fn_type @DestroyT.as_type.as.Destroy.impl.Op, @DestroyT.as_type.as.Destroy.impl(%facet_value.cba) [concrete]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.0db: %DestroyT.as_type.as.Destroy.impl.Op.type.710 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.specific_fn.f19: <specific function> = specific_function %DestroyT.as_type.as.Destroy.impl.Op.0db, @DestroyT.as_type.as.Destroy.impl.Op(%facet_value.cba) [concrete]
|
||||
// CHECK:STDOUT: %Destroy.impl_witness.f4d: <witness> = impl_witness imports.%Destroy.impl_witness_table, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.cba) [concrete]
|
||||
// CHECK:STDOUT: %Destroy.facet.84e: %Destroy.type = facet_value %array_type.6f1, (%Destroy.impl_witness.f4d) [concrete]
|
||||
// CHECK:STDOUT: %.d5d: type = fn_type_with_self_type %Destroy.Op.type, %Destroy.facet.84e [concrete]
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.ac2: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.cba) [concrete]
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.155: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.ac2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.e21: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.155, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.cba) [concrete]
|
||||
// CHECK:STDOUT: %complete_type.3e1: <witness> = complete_type_witness %ptr.cf4 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Core.import_ref.d51: @DestroyT.as_type.as.Destroy.impl.%DestroyT.as_type.as.Destroy.impl.Op.type (%DestroyT.as_type.as.Destroy.impl.Op.type.190) = import_ref Core//prelude/parts/destroy, loc{{\d+_\d+}}, loaded [symbolic = @DestroyT.as_type.as.Destroy.impl.%DestroyT.as_type.as.Destroy.impl.Op (constants.%DestroyT.as_type.as.Destroy.impl.Op.8a0)]
|
||||
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.d51), @DestroyT.as_type.as.Destroy.impl [concrete]
|
||||
// CHECK:STDOUT: %Core.import_ref.950: @DestroyT.binding.as_type.as.Destroy.impl.%DestroyT.binding.as_type.as.Destroy.impl.Op.type (%DestroyT.binding.as_type.as.Destroy.impl.Op.type.b5d) = import_ref Core//prelude/parts/destroy, loc{{\d+_\d+}}, loaded [symbolic = @DestroyT.binding.as_type.as.Destroy.impl.%DestroyT.binding.as_type.as.Destroy.impl.Op (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.544)]
|
||||
// CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (%Core.import_ref.950), @DestroyT.binding.as_type.as.Destroy.impl [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: generic fn @G(%T.loc4_6.2: type) {
|
||||
@@ -111,12 +111,12 @@ fn H() { G(3); }
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %array_type.loc7_22.2 [symbolic = %pattern_type (constants.%pattern_type.d48)]
|
||||
// CHECK:STDOUT: %array: @G.%array_type.loc7_22.2 (%array_type.281) = tuple_value () [symbolic = %array (constants.%array.2ed)]
|
||||
// CHECK:STDOUT: %facet_value.loc7_3.2: %type_where = facet_value %array_type.loc7_22.2, () [symbolic = %facet_value.loc7_3.2 (constants.%facet_value.bf1)]
|
||||
// CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness imports.%Destroy.impl_witness_table, @DestroyT.as_type.as.Destroy.impl(%facet_value.loc7_3.2) [symbolic = %Destroy.impl_witness (constants.%Destroy.impl_witness.f4a)]
|
||||
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %array_type.loc7_22.2, (%Destroy.impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.f25)]
|
||||
// CHECK:STDOUT: %.loc7_3.3: type = fn_type_with_self_type constants.%Destroy.Op.type, %Destroy.facet [symbolic = %.loc7_3.3 (constants.%.3d9)]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.type: type = fn_type @DestroyT.as_type.as.Destroy.impl.Op, @DestroyT.as_type.as.Destroy.impl(%facet_value.loc7_3.2) [symbolic = %DestroyT.as_type.as.Destroy.impl.Op.type (constants.%DestroyT.as_type.as.Destroy.impl.Op.type.565)]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op: @G.%DestroyT.as_type.as.Destroy.impl.Op.type (%DestroyT.as_type.as.Destroy.impl.Op.type.565) = struct_value () [symbolic = %DestroyT.as_type.as.Destroy.impl.Op (constants.%DestroyT.as_type.as.Destroy.impl.Op.dd2)]
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function %DestroyT.as_type.as.Destroy.impl.Op, @DestroyT.as_type.as.Destroy.impl.Op(%facet_value.loc7_3.2) [symbolic = %DestroyT.as_type.as.Destroy.impl.Op.specific_fn (constants.%DestroyT.as_type.as.Destroy.impl.Op.specific_fn.c7c)]
|
||||
// CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness imports.%Destroy.impl_witness_table, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.loc7_3.2) [symbolic = %Destroy.impl_witness (constants.%Destroy.impl_witness.5dc)]
|
||||
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %array_type.loc7_22.2, (%Destroy.impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.b30)]
|
||||
// CHECK:STDOUT: %.loc7_3.3: type = fn_type_with_self_type constants.%Destroy.Op.type, %Destroy.facet [symbolic = %.loc7_3.3 (constants.%.dc4)]
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.loc7_3.2) [symbolic = %DestroyT.binding.as_type.as.Destroy.impl.Op.type (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.type.90e)]
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op: @G.%DestroyT.binding.as_type.as.Destroy.impl.Op.type (%DestroyT.binding.as_type.as.Destroy.impl.Op.type.90e) = struct_value () [symbolic = %DestroyT.binding.as_type.as.Destroy.impl.Op (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.84c)]
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.loc7_3.2) [symbolic = %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.9d2)]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %array_type.loc7_22.2 [symbolic = %ptr (constants.%ptr.e06)]
|
||||
// CHECK:STDOUT: %require_complete.loc7_3: <witness> = require_complete_type %ptr [symbolic = %require_complete.loc7_3 (constants.%require_complete.662)]
|
||||
// CHECK:STDOUT:
|
||||
@@ -139,12 +139,12 @@ fn H() { G(3); }
|
||||
// CHECK:STDOUT: %arr: ref @G.%array_type.loc7_22.2 (%array_type.281) = bind_name arr, %arr.var
|
||||
// CHECK:STDOUT: %facet_value.loc7_3.1: %type_where = facet_value constants.%array_type.281, () [symbolic = %facet_value.loc7_3.2 (constants.%facet_value.bf1)]
|
||||
// CHECK:STDOUT: %.loc7_3.2: %type_where = converted constants.%array_type.281, %facet_value.loc7_3.1 [symbolic = %facet_value.loc7_3.2 (constants.%facet_value.bf1)]
|
||||
// CHECK:STDOUT: %impl.elem0: @G.%.loc7_3.3 (%.3d9) = impl_witness_access constants.%Destroy.impl_witness.f4a, element0 [symbolic = %DestroyT.as_type.as.Destroy.impl.Op (constants.%DestroyT.as_type.as.Destroy.impl.Op.dd2)]
|
||||
// CHECK:STDOUT: %impl.elem0: @G.%.loc7_3.3 (%.dc4) = impl_witness_access constants.%Destroy.impl_witness.5dc, element0 [symbolic = %DestroyT.binding.as_type.as.Destroy.impl.Op (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.84c)]
|
||||
// CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %arr.var, %impl.elem0
|
||||
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @DestroyT.as_type.as.Destroy.impl.Op(constants.%facet_value.bf1) [symbolic = %DestroyT.as_type.as.Destroy.impl.Op.specific_fn (constants.%DestroyT.as_type.as.Destroy.impl.Op.specific_fn.c7c)]
|
||||
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.bf1) [symbolic = %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn (constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.9d2)]
|
||||
// CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %arr.var, %specific_fn
|
||||
// CHECK:STDOUT: %addr: @G.%ptr (%ptr.e06) = addr_of %arr.var
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc7_3.2(%addr)
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc7_3.2(%addr)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
@@ -162,12 +162,12 @@ fn H() { G(3); }
|
||||
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.9c8
|
||||
// CHECK:STDOUT: %array => constants.%array.2e5
|
||||
// CHECK:STDOUT: %facet_value.loc7_3.2 => constants.%facet_value.cba
|
||||
// CHECK:STDOUT: %Destroy.impl_witness => constants.%Destroy.impl_witness.20d
|
||||
// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.ad5
|
||||
// CHECK:STDOUT: %.loc7_3.3 => constants.%.600
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.type => constants.%DestroyT.as_type.as.Destroy.impl.Op.type.710
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op => constants.%DestroyT.as_type.as.Destroy.impl.Op.0db
|
||||
// CHECK:STDOUT: %DestroyT.as_type.as.Destroy.impl.Op.specific_fn => constants.%DestroyT.as_type.as.Destroy.impl.Op.specific_fn.f19
|
||||
// CHECK:STDOUT: %Destroy.impl_witness => constants.%Destroy.impl_witness.f4d
|
||||
// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.84e
|
||||
// CHECK:STDOUT: %.loc7_3.3 => constants.%.d5d
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type => constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.type.ac2
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op => constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.155
|
||||
// CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn => constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.e21
|
||||
// CHECK:STDOUT: %ptr => constants.%ptr.cf4
|
||||
// CHECK:STDOUT: %require_complete.loc7_3 => constants.%complete_type.3e1
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
Reference in New Issue
Block a user