]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: implement field access for struct structural constraints
authorRobert Griesemer <gri@golang.org>
Wed, 5 Jan 2022 23:46:31 +0000 (15:46 -0800)
committerRobert Griesemer <gri@golang.org>
Thu, 6 Jan 2022 21:38:59 +0000 (21:38 +0000)
commit61014f00f24df8b144d9d235fe3e25ff64b96521
tree9eaa26bbf277f58527faa5999c94c10e6d25da1e
parent2bfa6ef63d3cfa89f46cc5f6708c1078f15fb875
go/types, types2: implement field access for struct structural constraints

This change implements field the access p.f where the type of p
is a type parameter with a structural constraint that is a struct
with a field f. This is only the fix for the type checker. The
compiler will need a separate CL.

This makes the behavior consistent with the fact that we can
write struct composite literals for type parameters with a
struct structural type.

For #50417.
For #50233.

Change-Id: I87d07e016f97cbf19c45cde19165eae3ec0bad2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/375795
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/lookup.go
src/cmd/compile/internal/types2/testdata/fixedbugs/issue50417.go2 [new file with mode: 0644]
src/go/types/lookup.go
src/go/types/testdata/fixedbugs/issue50417.go2 [new file with mode: 0644]
test/typeparam/issue50417.go [new file with mode: 0644]