Skip to content

Commit

Permalink
Assign a name to interface_type instructions. (#4369)
Browse files Browse the repository at this point in the history
This matches what we do for `class_type` and `function_type`.
  • Loading branch information
zygoloid authored Oct 4, 2024
1 parent 82937e1 commit 17411c5
Show file tree
Hide file tree
Showing 140 changed files with 5,042 additions and 5,036 deletions.
56 changes: 28 additions & 28 deletions toolchain/check/testdata/array/fail_bound_overflow.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ var b: [1; 39999999999999999993];
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %ImplicitAs.type: type = generic_interface_type @ImplicitAs [template]
// CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type = struct_value () [template]
// CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
// CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
// CHECK:STDOUT: %.3: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
// CHECK:STDOUT: %Self.1: @ImplicitAs.%.1 (%.3) = bind_symbolic_name Self, 1 [symbolic]
// CHECK:STDOUT: %Self.2: %.3 = bind_symbolic_name Self, 1 [symbolic]
// CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
// CHECK:STDOUT: %.4: type = assoc_entity_type %.3, %Convert.type.1 [symbolic]
// CHECK:STDOUT: %.5: %.4 = assoc_entity element0, imports.%import_ref.6 [symbolic]
// CHECK:STDOUT: %.6: type = interface_type @ImplicitAs, @ImplicitAs(type) [template]
// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.6 [symbolic]
// CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(type) [template]
// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(type) [template]
// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
// CHECK:STDOUT: %.7: type = assoc_entity_type %.6, %Convert.type.2 [template]
// CHECK:STDOUT: %.8: %.7 = assoc_entity element0, imports.%import_ref.6 [template]
// CHECK:STDOUT: %.9: %.4 = assoc_entity element0, imports.%import_ref.7 [symbolic]
// CHECK:STDOUT: %.5: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
// CHECK:STDOUT: %.6: %.5 = assoc_entity element0, imports.%import_ref.6 [template]
// CHECK:STDOUT: %.7: %.3 = assoc_entity element0, imports.%import_ref.7 [symbolic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
Expand All @@ -68,9 +68,9 @@ var b: [1; 39999999999999999993];
// CHECK:STDOUT: import Core//prelude/types/bool
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
// CHECK:STDOUT: %import_ref.2: %ImplicitAs.type = import_ref Core//prelude/operators/as, inst+40, loaded [template = constants.%ImplicitAs]
// CHECK:STDOUT: %import_ref.2: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+40, loaded [template = constants.%ImplicitAs]
// CHECK:STDOUT: %import_ref.3 = import_ref Core//prelude/operators/as, inst+45, unloaded
// CHECK:STDOUT: %import_ref.4: @ImplicitAs.%.2 (%.4) = import_ref Core//prelude/operators/as, inst+63, loaded [symbolic = @ImplicitAs.%.3 (constants.%.9)]
// CHECK:STDOUT: %import_ref.4: @ImplicitAs.%.1 (%.3) = import_ref Core//prelude/operators/as, inst+63, loaded [symbolic = @ImplicitAs.%.2 (constants.%.7)]
// CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/as, inst+56, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+56, unloaded
// CHECK:STDOUT: %import_ref.7 = import_ref Core//prelude/operators/as, inst+56, unloaded
Expand All @@ -90,10 +90,10 @@ var b: [1; 39999999999999999993];
// CHECK:STDOUT: %a.var: ref <error> = var a
// CHECK:STDOUT: %a: ref <error> = bind_name a, %a.var
// CHECK:STDOUT: %.loc30_9.1: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc30_9.2: type = interface_type @ImplicitAs, @ImplicitAs(type) [template = constants.%.6]
// CHECK:STDOUT: %.loc30_9.3: %.7 = specific_constant imports.%import_ref.4, @ImplicitAs(type) [template = constants.%.8]
// CHECK:STDOUT: %Convert.ref: %.7 = name_ref Convert, %.loc30_9.3 [template = constants.%.8]
// CHECK:STDOUT: %.loc30_9.4: type = converted %.loc30_9.1, <error> [template = <error>]
// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(type) [template = constants.%ImplicitAs.type.3]
// CHECK:STDOUT: %.loc30_9.2: %.5 = specific_constant imports.%import_ref.4, @ImplicitAs(type) [template = constants.%.6]
// CHECK:STDOUT: %Convert.ref: %.5 = name_ref Convert, %.loc30_9.2 [template = constants.%.6]
// CHECK:STDOUT: %.loc30_9.3: type = converted %.loc30_9.1, <error> [template = <error>]
// CHECK:STDOUT: %.loc30_32: type = array_type <error>, <error> [template = <error>]
// CHECK:STDOUT: %b.var: ref <error> = var b
// CHECK:STDOUT: %b: ref <error> = bind_name b, %b.var
Expand All @@ -103,12 +103,12 @@ var b: [1; 39999999999999999993];
// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %.1: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %.1 (constants.%.3)]
// CHECK:STDOUT: %Self: %.3 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
// CHECK:STDOUT: %.2: type = assoc_entity_type @ImplicitAs.%.1 (%.3), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.2 (constants.%.4)]
// CHECK:STDOUT: %.3: @ImplicitAs.%.2 (%.4) = assoc_entity element0, imports.%import_ref.6 [symbolic = %.3 (constants.%.5)]
// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.3)]
// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.3) = assoc_entity element0, imports.%import_ref.6 [symbolic = %.2 (constants.%.4)]
// CHECK:STDOUT:
// CHECK:STDOUT: interface {
// CHECK:STDOUT: !members:
Expand All @@ -120,10 +120,10 @@ var b: [1; 39999999999999999993];
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%.1 (%.3)) {
// CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
// CHECK:STDOUT: %.1: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %.1 (constants.%.3)]
// CHECK:STDOUT: %Self: %.3 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn[%self: @Convert.%Self (%Self.2)]() -> @Convert.%Dest (%Dest);
// CHECK:STDOUT: }
Expand All @@ -142,19 +142,19 @@ var b: [1; 39999999999999999993];
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.1) {
// CHECK:STDOUT: %Dest => constants.%Dest
// CHECK:STDOUT: %.1 => constants.%.3
// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
// CHECK:STDOUT: %Self => constants.%Self.1
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @ImplicitAs(type) {
// CHECK:STDOUT: %Dest => type
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %.1 => constants.%.6
// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
// CHECK:STDOUT: %Self => constants.%Self.2
// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
// CHECK:STDOUT: %Convert => constants.%Convert.2
// CHECK:STDOUT: %.2 => constants.%.7
// CHECK:STDOUT: %.3 => constants.%.8
// CHECK:STDOUT: %.1 => constants.%.5
// CHECK:STDOUT: %.2 => constants.%.6
// CHECK:STDOUT: }
// CHECK:STDOUT:
56 changes: 28 additions & 28 deletions toolchain/check/testdata/array/fail_invalid_type.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ var a: [1; 1];
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: i32 = int_literal 1 [template]
// CHECK:STDOUT: %ImplicitAs.type: type = generic_interface_type @ImplicitAs [template]
// CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
// CHECK:STDOUT: %.2: type = tuple_type () [template]
// CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type = struct_value () [template]
// CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
// CHECK:STDOUT: %.3: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
// CHECK:STDOUT: %Self.1: @ImplicitAs.%.1 (%.3) = bind_symbolic_name Self, 1 [symbolic]
// CHECK:STDOUT: %Self.2: %.3 = bind_symbolic_name Self, 1 [symbolic]
// CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
// CHECK:STDOUT: %.4: type = assoc_entity_type %.3, %Convert.type.1 [symbolic]
// CHECK:STDOUT: %.5: %.4 = assoc_entity element0, imports.%import_ref.5 [symbolic]
// CHECK:STDOUT: %.6: type = interface_type @ImplicitAs, @ImplicitAs(type) [template]
// CHECK:STDOUT: %.3: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
// CHECK:STDOUT: %.4: %.3 = assoc_entity element0, imports.%import_ref.5 [symbolic]
// CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(type) [template]
// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(type) [template]
// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
// CHECK:STDOUT: %.7: type = assoc_entity_type %.6, %Convert.type.2 [template]
// CHECK:STDOUT: %.8: %.7 = assoc_entity element0, imports.%import_ref.5 [template]
// CHECK:STDOUT: %.9: %.4 = assoc_entity element0, imports.%import_ref.6 [symbolic]
// CHECK:STDOUT: %.5: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
// CHECK:STDOUT: %.6: %.5 = assoc_entity element0, imports.%import_ref.5 [template]
// CHECK:STDOUT: %.7: %.3 = assoc_entity element0, imports.%import_ref.6 [symbolic]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
Expand All @@ -51,9 +51,9 @@ var a: [1; 1];
// CHECK:STDOUT: import Core//prelude/operators/comparison
// CHECK:STDOUT: import Core//prelude/types/bool
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: %ImplicitAs.type = import_ref Core//prelude/operators/as, inst+40, loaded [template = constants.%ImplicitAs]
// CHECK:STDOUT: %import_ref.1: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+40, loaded [template = constants.%ImplicitAs]
// CHECK:STDOUT: %import_ref.2 = import_ref Core//prelude/operators/as, inst+45, unloaded
// CHECK:STDOUT: %import_ref.3: @ImplicitAs.%.2 (%.4) = import_ref Core//prelude/operators/as, inst+63, loaded [symbolic = @ImplicitAs.%.3 (constants.%.9)]
// CHECK:STDOUT: %import_ref.3: @ImplicitAs.%.1 (%.3) = import_ref Core//prelude/operators/as, inst+63, loaded [symbolic = @ImplicitAs.%.2 (constants.%.7)]
// CHECK:STDOUT: %import_ref.4 = import_ref Core//prelude/operators/as, inst+56, unloaded
// CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/as, inst+56, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+56, unloaded
Expand All @@ -67,10 +67,10 @@ var a: [1; 1];
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %.loc17_9.1: i32 = int_literal 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc17_12: i32 = int_literal 1 [template = constants.%.1]
// CHECK:STDOUT: %.loc17_9.2: type = interface_type @ImplicitAs, @ImplicitAs(type) [template = constants.%.6]
// CHECK:STDOUT: %.loc17_9.3: %.7 = specific_constant imports.%import_ref.3, @ImplicitAs(type) [template = constants.%.8]
// CHECK:STDOUT: %Convert.ref: %.7 = name_ref Convert, %.loc17_9.3 [template = constants.%.8]
// CHECK:STDOUT: %.loc17_9.4: type = converted %.loc17_9.1, <error> [template = <error>]
// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(type) [template = constants.%ImplicitAs.type.3]
// CHECK:STDOUT: %.loc17_9.2: %.5 = specific_constant imports.%import_ref.3, @ImplicitAs(type) [template = constants.%.6]
// CHECK:STDOUT: %Convert.ref: %.5 = name_ref Convert, %.loc17_9.2 [template = constants.%.6]
// CHECK:STDOUT: %.loc17_9.3: type = converted %.loc17_9.1, <error> [template = <error>]
// CHECK:STDOUT: %.loc17_13: type = array_type %.loc17_12, <error> [template = <error>]
// CHECK:STDOUT: %a.var: ref <error> = var a
// CHECK:STDOUT: %a: ref <error> = bind_name a, %a.var
Expand All @@ -80,12 +80,12 @@ var a: [1; 1];
// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %.1: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %.1 (constants.%.3)]
// CHECK:STDOUT: %Self: %.3 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
// CHECK:STDOUT: %.2: type = assoc_entity_type @ImplicitAs.%.1 (%.3), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.2 (constants.%.4)]
// CHECK:STDOUT: %.3: @ImplicitAs.%.2 (%.4) = assoc_entity element0, imports.%import_ref.5 [symbolic = %.3 (constants.%.5)]
// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.3)]
// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.3) = assoc_entity element0, imports.%import_ref.5 [symbolic = %.2 (constants.%.4)]
// CHECK:STDOUT:
// CHECK:STDOUT: interface {
// CHECK:STDOUT: !members:
Expand All @@ -95,10 +95,10 @@ var a: [1; 1];
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%.1 (%.3)) {
// CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
// CHECK:STDOUT: %.1: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %.1 (constants.%.3)]
// CHECK:STDOUT: %Self: %.3 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn[%self: @Convert.%Self (%Self.2)]() -> @Convert.%Dest (%Dest);
// CHECK:STDOUT: }
Expand All @@ -117,19 +117,19 @@ var a: [1; 1];
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.1) {
// CHECK:STDOUT: %Dest => constants.%Dest
// CHECK:STDOUT: %.1 => constants.%.3
// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
// CHECK:STDOUT: %Self => constants.%Self.1
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @ImplicitAs(type) {
// CHECK:STDOUT: %Dest => type
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %.1 => constants.%.6
// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
// CHECK:STDOUT: %Self => constants.%Self.2
// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
// CHECK:STDOUT: %Convert => constants.%Convert.2
// CHECK:STDOUT: %.2 => constants.%.7
// CHECK:STDOUT: %.3 => constants.%.8
// CHECK:STDOUT: %.1 => constants.%.5
// CHECK:STDOUT: %.2 => constants.%.6
// CHECK:STDOUT: }
// CHECK:STDOUT:
Loading

0 comments on commit 17411c5

Please sign in to comment.