]> Cypherpunks repositories - gostls13.git/commit
go/parser: fix incorrect resolution of receiver type parameters
authorRobert Findley <rfindley@google.com>
Tue, 1 Feb 2022 22:13:53 +0000 (17:13 -0500)
committerRobert Findley <rfindley@google.com>
Mon, 7 Feb 2022 21:57:29 +0000 (21:57 +0000)
commit911c78fe54fe9fc0655c013d2aa303e147d63529
treebdc9c01d9e94157f66503194d797bab68b77ae34
parent7db75b368d4599e02b065f48b6ca8675b658b928
go/parser: fix incorrect resolution of receiver type parameters

Declare receiver type parameters in the function scope, but don't
resolve them (for now), as ast.Object.Decl is not documented to hold
*ast.Idents. This avoids incorrect resolution of identifiers to names
outside the function scope.

Also make tracing and error reporting more consistent.

For golang/go#50956

Change-Id: I8cd61dd25f4c0f6b974221599b00e23d8da206a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/382247
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/go/parser/resolver.go
src/go/parser/short_test.go
src/go/parser/testdata/resolution/typeparams.go2