]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix panic when refer to method of imported instantiated type
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Sun, 31 Oct 2021 19:04:13 +0000 (02:04 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 2 Nov 2021 03:09:01 +0000 (03:09 +0000)
commita45457df82263c292e2c66c152a12b5df0f27f15
tree5c1902de05b529edaa2be4eaee78839718b9f2ad
parenta59e33224e42d60a97fa720a45e1b74eb6aaa3d0
cmd/compile: fix panic when refer to method of imported instantiated type

In case of reference to method call of an imported fully-instantiated
type, nameNode.Func will be nil causes checkFetchBody panic. To fix
this, make sure checkFetchBody is only called when Func is not nil.

Fixes #49246

Change-Id: I32e9208385a86d4600d8ebf6f5efd8fca571ea16
Reviewed-on: https://go-review.googlesource.com/c/go/+/360056
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
src/cmd/compile/internal/noder/stencil.go
test/typeparam/issue49246.dir/a.go [new file with mode: 0644]
test/typeparam/issue49246.dir/b.go [new file with mode: 0644]
test/typeparam/issue49246.go [new file with mode: 0644]