]> Cypherpunks.ru repositories - gostls13.git/commit
go/types, types2: report inference instead of assignment failure when types can't...
authorRobert Griesemer <gri@golang.org>
Thu, 1 Jun 2023 22:02:54 +0000 (15:02 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 2 Jun 2023 16:28:54 +0000 (16:28 +0000)
commit0cd9064cd734501738e20a902f942523df0a5a5a
tree1ddfa7a9d60f364eb6ee50e834291e0d99e6dac3
parent0a68767864f622c5b4334a6369f611446e64d4ae
go/types, types2: report inference instead of assignment failure when types can't match

Interface inference must only be used if we don't require exact
unification, otherwise we may infer types (that are reasonable)
but then fail with an assignment error.

Only checking if exact is set for defined (named) types is not
sufficient, we must also check outside. Oversight.

Fixes #60562.

Change-Id: I208a74bf7ed80bcb976ba9cc172715c83f9e3d0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/499996
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/types2/unify.go
src/go/types/unify.go
src/internal/types/testdata/fixedbugs/issue60562.go [new file with mode: 0644]