Form the contents of the witness table. (#3756)

Check that functions in an `impl` are declared properly. For now, simply
reuse the redeclaration checking logic. Longer-term, we need to check
that the signatures match in a more approximate way, after substituting
the `Self` type into the signature in the `interface`.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Richard Smith
2024-03-08 23:53:48 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent 551a6d385e
commit a1317e61e0
14 changed files with 910 additions and 16 deletions
+2 -2
View File
@@ -18,7 +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: %.4: <witness> = interface_witness @Simple, (@impl.%F) [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -44,7 +44,7 @@ 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: %.1: <witness> = interface_witness @Simple, (%F) [template = constants.%.4]
// CHECK:STDOUT:
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .F = %F