]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: package-annotate structs when error would be ambiguous
authorDavid Chase <drchase@google.com>
Thu, 11 Aug 2022 13:58:23 +0000 (09:58 -0400)
committerDavid Chase <drchase@google.com>
Fri, 18 Nov 2022 21:48:06 +0000 (21:48 +0000)
commitea2c27fe8204225b4d76ed4a541c6b92afec8dde
tree396b44f6a01016856efdda069a84853350e4d719
parentdccc58e1b9d3fbc88c6a86c02f77ed0f26d07a4a
cmd/compile: package-annotate structs when error would be ambiguous

Before emitting a "wanted Foo but got Bar" message for an interface
type match failure, check that Foo and Bar are different.  If they
are not, add package paths to first unexported struct field seen,
because that is the cause (a cause, there could be more than one).

Replicated in go/types.

Added tests to go/types and cmd/compile/internal/types2

Fixes #54258.

Change-Id: Ifc2b2067d62fe2138996972cdf3b6cb7ca0ed456
Reviewed-on: https://go-review.googlesource.com/c/go/+/422914
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/typecheck/expr.go
src/cmd/compile/internal/typecheck/stmt.go
src/cmd/compile/internal/typecheck/subr.go
src/cmd/compile/internal/types2/issues_test.go
src/cmd/compile/internal/types2/lookup.go
src/cmd/compile/internal/types2/typestring.go
src/go/types/issues_test.go
src/go/types/lookup.go
src/go/types/object.go
src/go/types/typestring.go