mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
![Cuong Manh Le](/assets/img/avatar_default.png)
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>
21 lines
429 B
Go
21 lines
429 B
Go
// Copyright 2021 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package a
|
|
|
|
type R[T any] struct{ v T }
|
|
|
|
func (r R[T]) Self() R[T] { return R[T]{} }
|
|
|
|
type Fn[T any] func() R[T]
|
|
|
|
func X() (r R[int]) { return r.Self() }
|
|
|
|
func Y[T any](a Fn[T]) Fn[int] {
|
|
return func() (r R[int]) {
|
|
// No crash: return R[int]{}
|
|
return r.Self()
|
|
}
|
|
}
|