Assign a constant to ClassDecl/InterfaceDecl for name references. (#3722)

By adding a constant to ClassDecl/InterfaceDecl, we're able to remove
name reference special-casing. Use TryEvalInst on the Decl to generate
the Type. For ClassDecl, then use the generated constant for
self_type_id.
This commit is contained in:
Jon Ross-Perkins
2024-02-24 00:00:18 +00:00
committed by GitHub
parent 8e8eeb3243
commit 364ea5d3f2
109 changed files with 420 additions and 429 deletions
+8 -3
View File
@@ -15,11 +15,16 @@ interface ForwardDeclared {
// CHECK:STDOUT: --- basic.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = interface_type @Empty [template]
// CHECK:STDOUT: %.2: type = interface_type @ForwardDeclared [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace {.Empty = %Empty.decl, .ForwardDeclared = %ForwardDeclared.decl.loc10} [template]
// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, ()
// CHECK:STDOUT: %ForwardDeclared.decl.loc10 = interface_decl @ForwardDeclared, ()
// CHECK:STDOUT: %ForwardDeclared.decl.loc12 = interface_decl @ForwardDeclared, ()
// CHECK:STDOUT: %Empty.decl = interface_decl @Empty, () [template = constants.%.1]
// CHECK:STDOUT: %ForwardDeclared.decl.loc10 = interface_decl @ForwardDeclared, () [template = constants.%.2]
// CHECK:STDOUT: %ForwardDeclared.decl.loc12 = interface_decl @ForwardDeclared, () [template = constants.%.2]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: interface @Empty {