]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: eliminate need to sort arguments for type inference
authorRobert Griesemer <gri@golang.org>
Thu, 2 Feb 2023 04:03:17 +0000 (20:03 -0800)
committerGopher Robot <gobot@golang.org>
Mon, 6 Feb 2023 19:34:10 +0000 (19:34 +0000)
commit8fd6cc8bb51ff09990ab13422ef66e18e9295911
tree1a398831969dd51723727e7a443dcee31e958898
parente0603bc6760ee48d32a4a96a0e9cc032698d8584
go/types, types2: eliminate need to sort arguments for type inference

When unifying types, we always consider underlying types if inference
would fail otherwise. If a type parameter has a (non-defined) type
inferred and later matches against a defined type, make sure to keep
that defined type instead.

For #43056.

Change-Id: I24e4cd2939df7c8069e505be10914017c1c1c288
Reviewed-on: https://go-review.googlesource.com/c/go/+/464348
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/types2/infer.go
src/cmd/compile/internal/types2/infer2.go
src/cmd/compile/internal/types2/unify.go
src/go/types/infer.go
src/go/types/infer2.go
src/go/types/unify.go
src/internal/types/testdata/examples/functions.go