Initial scaffolding for building a witness table for an impl. (#3743)

Add an instruction to hold the witness table, along with a corresponding
type to keep things simpler. Add `check/impl.{h,cpp}` to house the new
logic. No checking of impls against interfaces is performed yet.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Richard Smith
2024-03-07 23:10:14 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent 2424ea16ea
commit abf23ae7fe
27 changed files with 216 additions and 29 deletions
+3
View File
@@ -18,6 +18,7 @@ impl i32 as Simple {
// CHECK:STDOUT: %.1: type = interface_type @Simple [template]
// CHECK:STDOUT: %.2: type = assoc_entity_type @Simple, <function> [template]
// CHECK:STDOUT: %.3: <associated <function> in Simple> = assoc_entity element0, @Simple.%F [template]
// CHECK:STDOUT: %.4: <witness> = interface_witness @Simple, () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -43,9 +44,11 @@ impl i32 as Simple {
// CHECK:STDOUT:
// CHECK:STDOUT: impl @impl: i32 as Simple {
// CHECK:STDOUT: %F: <function> = fn_decl @F.2 [template] {}
// CHECK:STDOUT: %.1: <witness> = interface_witness @Simple, () [template = constants.%.4]
// CHECK:STDOUT:
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .F = %F
// CHECK:STDOUT: witness = %.1
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F.1();