Don't elide Self when dumping the interface/constraint (#6297)

We give `Self` in an interface/constraint a location so it's not elided
when trying to dump the interface/constraint. We use the location of the
start of the definition, which is the scope for which the `Self` is
constructed and is available in.
This commit is contained in:
Dana Jansens
2025-10-30 20:47:16 +00:00
committed by GitHub
parent 656150593c
commit f272198ce5
54 changed files with 481 additions and 478 deletions
@@ -166,19 +166,19 @@ fn G() {
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%Scalar.loc15_19.1)> [symbolic = %Generic.type (constants.%Generic.type.68bb8d.1)]
// CHECK:STDOUT: %Self.2: @Generic.%Generic.type (%Generic.type.68bb8d.1) = symbolic_binding Self, 1 [symbolic = %Self.2 (constants.%Self.fc1c73.1)]
// CHECK:STDOUT: %Self.loc15_34.2: @Generic.%Generic.type (%Generic.type.68bb8d.1) = symbolic_binding Self, 1 [symbolic = %Self.loc15_34.2 (constants.%Self.fc1c73.1)]
// CHECK:STDOUT: %Generic.F.type: type = fn_type @Generic.F, @Generic(%Scalar.loc15_19.1) [symbolic = %Generic.F.type (constants.%Generic.F.type.fc1c8a.1)]
// CHECK:STDOUT: %Generic.F: @Generic.%Generic.F.type (%Generic.F.type.fc1c8a.1) = struct_value () [symbolic = %Generic.F (constants.%Generic.F.d952d5.1)]
// CHECK:STDOUT: %Generic.assoc_type: type = assoc_entity_type @Generic, @Generic(%Scalar.loc15_19.1) [symbolic = %Generic.assoc_type (constants.%Generic.assoc_type.414a90.1)]
// CHECK:STDOUT: %assoc0.loc16_9.2: @Generic.%Generic.assoc_type (%Generic.assoc_type.414a90.1) = assoc_entity element0, %Generic.F.decl [symbolic = %assoc0.loc16_9.2 (constants.%assoc0.3122a2.1)]
// CHECK:STDOUT:
// CHECK:STDOUT: interface {
// CHECK:STDOUT: %Self.1: @Generic.%Generic.type (%Generic.type.68bb8d.1) = symbolic_binding Self, 1 [symbolic = %Self.2 (constants.%Self.fc1c73.1)]
// CHECK:STDOUT: %Self.loc15_34.1: @Generic.%Generic.type (%Generic.type.68bb8d.1) = symbolic_binding Self, 1 [symbolic = %Self.loc15_34.2 (constants.%Self.fc1c73.1)]
// CHECK:STDOUT: %Generic.F.decl: @Generic.%Generic.F.type (%Generic.F.type.fc1c8a.1) = fn_decl @Generic.F [symbolic = @Generic.%Generic.F (constants.%Generic.F.d952d5.1)] {} {}
// CHECK:STDOUT: %assoc0.loc16_9.1: @Generic.%Generic.assoc_type (%Generic.assoc_type.414a90.1) = assoc_entity element0, %Generic.F.decl [symbolic = %assoc0.loc16_9.2 (constants.%assoc0.3122a2.1)]
// CHECK:STDOUT:
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .Self = %Self.1
// CHECK:STDOUT: .Self = %Self.loc15_34.1
// CHECK:STDOUT: .F = %assoc0.loc16_9.1
// CHECK:STDOUT: witness = (%Generic.F.decl)
// CHECK:STDOUT: }
@@ -227,7 +227,7 @@ fn G() {
// CHECK:STDOUT: .Self = constants.%ImplsGeneric
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @Generic.F(@Generic.%Scalar.loc15_19.2: type, @Generic.%Self.1: @Generic.%Generic.type (%Generic.type.68bb8d.1)) {
// CHECK:STDOUT: generic fn @Generic.F(@Generic.%Scalar.loc15_19.2: type, @Generic.%Self.loc15_34.1: @Generic.%Generic.type (%Generic.type.68bb8d.1)) {
// CHECK:STDOUT: fn();
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -296,7 +296,7 @@ fn G() {
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %Generic.type => constants.%Generic.type.621
// CHECK:STDOUT: %Self.2 => constants.%Self.ae2
// CHECK:STDOUT: %Self.loc15_34.2 => constants.%Self.ae2
// CHECK:STDOUT: %Generic.F.type => constants.%Generic.F.type.4cf
// CHECK:STDOUT: %Generic.F => constants.%Generic.F.118
// CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.713
@@ -314,7 +314,7 @@ fn G() {
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %Generic.type => constants.%Generic.type.68bb8d.2
// CHECK:STDOUT: %Self.2 => constants.%Self.fc1c73.2
// CHECK:STDOUT: %Self.loc15_34.2 => constants.%Self.fc1c73.2
// CHECK:STDOUT: %Generic.F.type => constants.%Generic.F.type.fc1c8a.2
// CHECK:STDOUT: %Generic.F => constants.%Generic.F.d952d5.2
// CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.414a90.2
@@ -148,7 +148,7 @@ fn B() {
// CHECK:STDOUT: import Lib//default
// CHECK:STDOUT: }
// CHECK:STDOUT: %Lib.Z: type = import_ref Lib//default, Z, loaded [concrete = constants.%Z.type]
// CHECK:STDOUT: %Lib.import_ref.462 = import_ref Lib//default, inst{{[0-9A-F]+}} [no loc], unloaded
// CHECK:STDOUT: %Lib.import_ref.462 = import_ref Lib//default, loc3_13, unloaded
// CHECK:STDOUT: %Lib.A: %A.type.fad = import_ref Lib//default, A, loaded [concrete = constants.%A.7a0]
// CHECK:STDOUT: %Lib.import_ref.552: %Z.type = import_ref Lib//default, loc4_6, loaded [symbolic = @A.1.%T (constants.%T)]
// CHECK:STDOUT: }