]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: don't infer type argument for unused parameter in interfaces
authorRobert Griesemer <gri@golang.org>
Thu, 25 May 2023 16:54:11 +0000 (09:54 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 25 May 2023 21:37:01 +0000 (21:37 +0000)
commit1dd24d821650a7681c6ee25f0cf99becc93490bd
tree89ad7f59080e737613ed644f719c5211c9e4bb84
parentf9d114d0e85eba7a79b9656aa65f0ba939787fb6
go/types, types2: don't infer type argument for unused parameter in interfaces

Two interface types that are assignable don't have to be identical;
specifically, if they are defined types, they can be different
defined types. If those defined types specify type parameters which
are never used, do not infer a type argument based on the instantiation
of a matching defined type.

Adjusted three existing tests where we inferred type arguments incorrectly.

Fixes #60377.

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