]> Cypherpunks repositories - gostls13.git/commit
[dev.regabi] cmd/compile: fix defined-pointer method call check
authorMatthew Dempsky <mdempsky@google.com>
Sat, 26 Dec 2020 09:06:03 +0000 (01:06 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 30 Dec 2020 04:38:20 +0000 (04:38 +0000)
commit0c1a899a6c61dc59032ead0602d1cc6b918f7669
tree9a390355d335b7f248b9dadab5b9d8eb8ae58728
parentf9b67f76a59cb9adf5d04e9b559cda98afb3c6f4
[dev.regabi] cmd/compile: fix defined-pointer method call check

The compiler has logic to check whether we implicitly dereferenced a
defined pointer while trying to select a method. However, rather than
checking whether there were any implicit dereferences of a defined
pointer, it was finding the innermost dereference/selector expression
and checking whether that was dereferencing a named pointer. Moreover,
it was only checking defined pointer declared in the package block.

This CL restructures the code to match go/types and gccgo's behavior.

Fixes #43384.

Change-Id: I7bddfe2515776d9480eb2c7286023d4c15423888
Reviewed-on: https://go-review.googlesource.com/c/go/+/280392
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Griesemer <gri@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/typecheck/typecheck.go
test/fixedbugs/issue43384.go [new file with mode: 0644]