]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: always try inference over methods when possible
authorRobert Griesemer <gri@golang.org>
Thu, 3 Oct 2024 20:51:25 +0000 (13:51 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 3 Oct 2024 22:32:33 +0000 (22:32 +0000)
commit726d898c92ed0159f283f324478d00f15419f476
treee76f8859d4734811154adc756dc45a9da99d37c2
parent7703db647c0f36566d3ef28ea15d196db5ad3ff2
go/types, types2: always try inference over methods when possible

During type inference, when comparing type parameters against their
constraints, if a type argument is completely known it must implement
its constraint. In this case, always unify the type argument's methods
against the constraint methods, if any.

Before this CL, this step was only attempted if the constraint had no
core type. That left information unused which led to type inference
failures where it should have succeeded.

Fixes #66751.

Change-Id: I71e96b71258624212186cf17ec47e67a589817b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/617896
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/compile/internal/types2/infer.go
src/go/types/infer.go
src/internal/types/testdata/fixedbugs/issue66751.go [new file with mode: 0644]