mirror of
https://github.com/golang/go
synced 2024-11-22 20:24:47 -07:00
e99f285d52
CL 414836 limited the check for implicit dot for method call enabled by a type bound. However, the checking condition for ODOTMETH only is not right. For example, for promoted method, we have a OXDOT node instead, and we still have to check for implicit dot in this case. However, if the base type and embedded types have the same method name, e.g in issue #53419, typecheck.AddImplicitDots will be confused and result in an ambigus selector. To fix this, we ensure methods for the base type are computed, then only do the implicit dot check if we can find a matched method. Fixes #54348 Change-Id: Iefe84ff330830afe35c5daffd499824db108da23 Reviewed-on: https://go-review.googlesource.com/c/go/+/422274 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
23 lines
324 B
Go
23 lines
324 B
Go
// run
|
|
|
|
// Copyright 2022 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 main
|
|
|
|
func main() {
|
|
F[T[int]]()
|
|
}
|
|
|
|
func F[X interface{ M() }]() {
|
|
var x X
|
|
x.M()
|
|
}
|
|
|
|
type T[X any] struct{ E }
|
|
|
|
type E struct{}
|
|
|
|
func (h E) M() {}
|