]> Cypherpunks repositories - gostls13.git/commit
go/types: set correct Pos for T in struct{p.T}
authorAlan Donovan <adonovan@google.com>
Wed, 24 May 2023 18:16:38 +0000 (14:16 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 24 May 2023 23:16:04 +0000 (23:16 +0000)
commita965318ac051b112b61fcbbbfe4e0be00088abd7
tree7222900428b43f6c1b8a452d15a0ec68b15a03bd
parent326df693d700fa42c2740dcc89a14c821d019f52
go/types: set correct Pos for T in struct{p.T}

Previously, the field Var for T created for struct{p.T}
would use the Pos of the ast.Field, which coincides with p.
This change makes it use the Pos of T.

Errors about the field type are still reported at the
position of the ast.Field (e.g. *p.T) not the field T.

Fixes #60372

Change-Id: I06000874f2018d47159493626da3d16e6716f4c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/497882
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
src/cmd/compile/internal/types2/struct.go
src/go/types/struct.go
src/internal/types/testdata/check/decls3.go
src/internal/types/testdata/examples/types.go