Ver código fonte

Add unit tagging to InterfaceId (#6243)

Based on #6241
David Blaikie 6 meses atrás
pai
commit
3d6810beb6

+ 2 - 2
toolchain/check/testdata/basics/raw_sem_ir/one_file.carbon

@@ -436,13 +436,13 @@ fn Foo[T:! type](p: T*) -> (T*, ()) {
 // CHECK:STDOUT:     inst60000043:    {kind: TupleAccess, arg0: inst60000034, arg1: element0, type: type(symbolic_constant00000004)}
 // CHECK:STDOUT:     inst60000044:    {kind: RequireCompleteType, arg0: inst6000001B, type: type(inst(WitnessType))}
 // CHECK:STDOUT:     inst60000045:    {kind: ImportRefLoaded, arg0: import_ir_inst00000000, arg1: entity_name00000003, type: type(TypeType)}
-// CHECK:STDOUT:     inst60000046:    {kind: InterfaceDecl, arg0: interface00000000, arg1: inst_block_empty, type: type(TypeType)}
+// CHECK:STDOUT:     inst60000046:    {kind: InterfaceDecl, arg0: interface60000000, arg1: inst_block_empty, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000047:    {kind: FacetType, arg0: facet_type00000001, type: type(TypeType)}
 // CHECK:STDOUT:     inst60000048:    {kind: BindSymbolicName, arg0: entity_name00000004, arg1: inst<none>, type: type(inst60000047)}
 // CHECK:STDOUT:     inst60000049:    {kind: ImportRefUnloaded, arg0: import_ir_inst00000002, arg1: entity_name<none>}
 // CHECK:STDOUT:     inst6000004A:    {kind: ImportRefLoaded, arg0: import_ir_inst00000003, arg1: entity_name<none>, type: type(inst6000004C)}
 // CHECK:STDOUT:     inst6000004B:    {kind: ImportRefUnloaded, arg0: import_ir_inst00000004, arg1: entity_name00000005}
-// CHECK:STDOUT:     inst6000004C:    {kind: AssociatedEntityType, arg0: interface00000000, arg1: specific<none>, type: type(TypeType)}
+// CHECK:STDOUT:     inst6000004C:    {kind: AssociatedEntityType, arg0: interface60000000, arg1: specific<none>, type: type(TypeType)}
 // CHECK:STDOUT:     inst6000004D:    {kind: ImportRefLoaded, arg0: import_ir_inst00000005, arg1: entity_name<none>, type: type(inst60000050)}
 // CHECK:STDOUT:     inst6000004E:    {kind: AssociatedEntity, arg0: element0, arg1: inst6000004D, type: type(inst6000004C)}
 // CHECK:STDOUT:     inst6000004F:    {kind: FunctionDecl, arg0: function60000001, arg1: inst_block_empty, type: type(inst60000050)}

+ 1 - 0
toolchain/sem_ir/file.cpp

@@ -38,6 +38,7 @@ File::File(const Parse::Tree* parse_tree, CheckIRId check_ir_id,
       functions_(check_ir_id),
       cpp_overload_sets_(check_ir_id),
       classes_(check_ir_id),
+      interfaces_(check_ir_id),
       associated_constants_(check_ir_id),
       impls_(*this),
       specific_interfaces_(check_ir_id),

+ 2 - 0
toolchain/sem_ir/inst_namer.h

@@ -61,6 +61,8 @@ class InstNamer {
       index = sem_ir_->functions().GetRawIndex(id);
     } else if constexpr (std::is_same_v<IdT, ImplId>) {
       index = sem_ir_->impls().GetRawIndex(id);
+    } else if constexpr (std::is_same_v<IdT, InterfaceId>) {
+      index = sem_ir_->interfaces().GetRawIndex(id);
     } else if constexpr (std::is_same_v<IdT, SpecificInterfaceId>) {
       index = sem_ir_->specific_interfaces().GetRawIndex(id);
     } else if constexpr (std::is_same_v<IdT, VtableId>) {