]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: add cause parameter to missingMethod, (new)assertableTo
authorRobert Griesemer <gri@golang.org>
Wed, 1 Mar 2023 04:35:23 +0000 (20:35 -0800)
committerGopher Robot <gobot@golang.org>
Wed, 1 Mar 2023 21:23:54 +0000 (21:23 +0000)
commitc10ba768feab868bdd0a984a34931093541dce33
treeae8eb5d566031effb1a8c66003142de382f49518
parentb44f2222b5e3d9de0d214101bf458251ac30ffe3
go/types, types2: add cause parameter to missingMethod, (new)assertableTo

This CL allows missingMethod (and with it the assertableTo methods)
to provide an error cause without an extra external (and messy) call
of missingMethodCause. This latter function is now only called by
missingMethod and can be eliminated eventually in favor of more
precise error causes generated directly by missingMethod.

The change requires that missingMethod (and the assertableTo methods)
accept general types for both relevant argument types (rather than a
Type and a *Interface) so that error causes can report the appropriate
(possibly defined) type rather than the underlying interface type.

Change-Id: Ic31508073fa138dd5fa27285b06cf232ee638685
Reviewed-on: https://go-review.googlesource.com/c/go/+/472395
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/api.go
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/infer.go
src/cmd/compile/internal/types2/instantiate.go
src/cmd/compile/internal/types2/lookup.go
src/go/types/api.go
src/go/types/expr.go
src/go/types/infer.go
src/go/types/instantiate.go
src/go/types/lookup.go