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:
Dana Jansens
2025-10-06 18:56:43 +00:00
committed by GitHub
parent bd4d5805dd
commit fe020ee08b
237 changed files with 7827 additions and 7586 deletions
+28 -28
View File
@@ -27,8 +27,8 @@ var arr: array(i32, (1 as i32).(I.F)(2));
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
// CHECK:STDOUT: %Self.7ee: %I.type = bind_symbolic_name Self, 0 [symbolic]
// CHECK:STDOUT: %Self.as_type.a67: type = facet_access_type %Self.7ee [symbolic]
// CHECK:STDOUT: %pattern_type.d22: type = pattern_type %Self.as_type.a67 [symbolic]
// CHECK:STDOUT: %Self.binding.as_type.1b7: type = symbolic_binding_type Self, 0, %Self.7ee [symbolic]
// CHECK:STDOUT: %pattern_type.3f7: type = pattern_type %Self.binding.as_type.1b7 [symbolic]
// CHECK:STDOUT: %I.F.type: type = fn_type @I.F [concrete]
// CHECK:STDOUT: %I.F: %I.F.type = struct_value () [concrete]
// CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
@@ -178,32 +178,32 @@ var arr: array(i32, (1 as i32).(I.F)(2));
// CHECK:STDOUT: interface @I {
// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.7ee]
// CHECK:STDOUT: %I.F.decl: %I.F.type = fn_decl @I.F [concrete = constants.%I.F] {
// CHECK:STDOUT: %self.patt: @I.F.%pattern_type (%pattern_type.d22) = binding_pattern self [concrete]
// CHECK:STDOUT: %self.param_patt: @I.F.%pattern_type (%pattern_type.d22) = value_param_pattern %self.patt, call_param0 [concrete]
// CHECK:STDOUT: %other.patt: @I.F.%pattern_type (%pattern_type.d22) = binding_pattern other [concrete]
// CHECK:STDOUT: %other.param_patt: @I.F.%pattern_type (%pattern_type.d22) = value_param_pattern %other.patt, call_param1 [concrete]
// CHECK:STDOUT: %return.patt: @I.F.%pattern_type (%pattern_type.d22) = return_slot_pattern [concrete]
// CHECK:STDOUT: %return.param_patt: @I.F.%pattern_type (%pattern_type.d22) = out_param_pattern %return.patt, call_param2 [concrete]
// CHECK:STDOUT: %self.patt: @I.F.%pattern_type (%pattern_type.3f7) = binding_pattern self [concrete]
// CHECK:STDOUT: %self.param_patt: @I.F.%pattern_type (%pattern_type.3f7) = value_param_pattern %self.patt, call_param0 [concrete]
// CHECK:STDOUT: %other.patt: @I.F.%pattern_type (%pattern_type.3f7) = binding_pattern other [concrete]
// CHECK:STDOUT: %other.param_patt: @I.F.%pattern_type (%pattern_type.3f7) = value_param_pattern %other.patt, call_param1 [concrete]
// CHECK:STDOUT: %return.patt: @I.F.%pattern_type (%pattern_type.3f7) = return_slot_pattern [concrete]
// CHECK:STDOUT: %return.param_patt: @I.F.%pattern_type (%pattern_type.3f7) = out_param_pattern %return.patt, call_param2 [concrete]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %Self.ref.loc16_36: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self.7ee)]
// CHECK:STDOUT: %Self.as_type.loc16_36: type = facet_access_type %Self.ref.loc16_36 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.a67)]
// CHECK:STDOUT: %.loc16_36: type = converted %Self.ref.loc16_36, %Self.as_type.loc16_36 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.a67)]
// CHECK:STDOUT: %self.param: @I.F.%Self.as_type.loc16_14.1 (%Self.as_type.a67) = value_param call_param0
// CHECK:STDOUT: %.loc16_14.1: type = splice_block %.loc16_14.2 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.a67)] {
// CHECK:STDOUT: %Self.as_type.loc16_36: type = facet_access_type %Self.ref.loc16_36 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
// CHECK:STDOUT: %.loc16_36: type = converted %Self.ref.loc16_36, %Self.as_type.loc16_36 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
// CHECK:STDOUT: %self.param: @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7) = value_param call_param0
// CHECK:STDOUT: %.loc16_14.1: type = splice_block %.loc16_14.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)] {
// CHECK:STDOUT: %Self.ref.loc16_14: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self.7ee)]
// CHECK:STDOUT: %Self.as_type.loc16_14.2: type = facet_access_type %Self.ref.loc16_14 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.a67)]
// CHECK:STDOUT: %.loc16_14.2: type = converted %Self.ref.loc16_14, %Self.as_type.loc16_14.2 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.a67)]
// CHECK:STDOUT: %Self.as_type.loc16_14: type = facet_access_type %Self.ref.loc16_14 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
// CHECK:STDOUT: %.loc16_14.2: type = converted %Self.ref.loc16_14, %Self.as_type.loc16_14 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %self: @I.F.%Self.as_type.loc16_14.1 (%Self.as_type.a67) = bind_name self, %self.param
// CHECK:STDOUT: %other.param: @I.F.%Self.as_type.loc16_14.1 (%Self.as_type.a67) = value_param call_param1
// CHECK:STDOUT: %.loc16_27.1: type = splice_block %.loc16_27.2 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.a67)] {
// CHECK:STDOUT: %self: @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7) = bind_name self, %self.param
// CHECK:STDOUT: %other.param: @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7) = value_param call_param1
// CHECK:STDOUT: %.loc16_27.1: type = splice_block %.loc16_27.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)] {
// CHECK:STDOUT: %Self.ref.loc16_27: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self.7ee)]
// CHECK:STDOUT: %Self.as_type.loc16_27: type = facet_access_type %Self.ref.loc16_27 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.a67)]
// CHECK:STDOUT: %.loc16_27.2: type = converted %Self.ref.loc16_27, %Self.as_type.loc16_27 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.a67)]
// CHECK:STDOUT: %Self.as_type.loc16_27: type = facet_access_type %Self.ref.loc16_27 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
// CHECK:STDOUT: %.loc16_27.2: type = converted %Self.ref.loc16_27, %Self.as_type.loc16_27 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
// CHECK:STDOUT: }
// CHECK:STDOUT: %other: @I.F.%Self.as_type.loc16_14.1 (%Self.as_type.a67) = bind_name other, %other.param
// CHECK:STDOUT: %return.param: ref @I.F.%Self.as_type.loc16_14.1 (%Self.as_type.a67) = out_param call_param2
// CHECK:STDOUT: %return: ref @I.F.%Self.as_type.loc16_14.1 (%Self.as_type.a67) = return_slot %return.param
// CHECK:STDOUT: %other: @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7) = bind_name other, %other.param
// CHECK:STDOUT: %return.param: ref @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7) = out_param call_param2
// CHECK:STDOUT: %return: ref @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7) = return_slot %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %I.F.decl [concrete = constants.%assoc0.82e]
// CHECK:STDOUT:
@@ -247,23 +247,23 @@ var arr: array(i32, (1 as i32).(I.F)(2));
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @I.F(@I.%Self: %I.type) {
// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.7ee)]
// CHECK:STDOUT: %Self.as_type.loc16_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.a67)]
// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc16_14.1 [symbolic = %pattern_type (constants.%pattern_type.d22)]
// CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.1b7)]
// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.3f7)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn(%self.param: @I.F.%Self.as_type.loc16_14.1 (%Self.as_type.a67), %other.param: @I.F.%Self.as_type.loc16_14.1 (%Self.as_type.a67)) -> @I.F.%Self.as_type.loc16_14.1 (%Self.as_type.a67);
// CHECK:STDOUT: fn(%self.param: @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7), %other.param: @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7)) -> @I.F.%Self.binding.as_type (%Self.binding.as_type.1b7);
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @i32.as.I.impl.F(%self.param: %i32, %other.param: %i32) -> %i32 = "int.sadd";
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I.F(constants.%Self.7ee) {
// CHECK:STDOUT: %Self => constants.%Self.7ee
// CHECK:STDOUT: %Self.as_type.loc16_14.1 => constants.%Self.as_type.a67
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.d22
// CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.1b7
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.3f7
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I.F(constants.%I.facet) {
// CHECK:STDOUT: %Self => constants.%I.facet
// CHECK:STDOUT: %Self.as_type.loc16_14.1 => constants.%i32
// CHECK:STDOUT: %Self.binding.as_type => constants.%i32
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.7ce
// CHECK:STDOUT: }
// CHECK:STDOUT: