]> Cypherpunks repositories - gostls13.git/commit
go/types, cmd/compile: fix composite literal structural typing
authorMatthew Dempsky <mdempsky@google.com>
Wed, 26 Jan 2022 21:46:45 +0000 (13:46 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 27 Jan 2022 19:55:38 +0000 (19:55 +0000)
commit1a2435c95f8c68c7d21d172c8a80c6cc96aa9cf5
tree7468d51b438512549d4e88438026eb6091e0c7c1
parentb7b44b3173f151a2313da7072afd25de80511605
go/types, cmd/compile: fix composite literal structural typing

For a composite literal expression like []T{{f: 1}}, we allow T to be
a pointer to struct type, so it's consistent to allow T to also be a
type parameter whose structural type is a pointer to struct type.

Fixes #50833.

Change-Id: Ib0781ec4a4f327c875ea25b97740ff2c0c86b916
Reviewed-on: https://go-review.googlesource.com/c/go/+/381075
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/noder/expr.go
src/cmd/compile/internal/noder/writer.go
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/testdata/fixedbugs/issue50833.go2 [new file with mode: 0644]
src/go/types/expr.go
src/go/types/testdata/fixedbugs/issue50833.go2 [new file with mode: 0644]
test/typeparam/issue50833.go [new file with mode: 0644]