mirror of https://github.com/golang/go.git
[dev.go2go] go/types: fix instantiation crash for generic type parame…
…ters
Fixes #40038.
Change-Id: I5b095d01fd1e3703561c179c34ddc3b43d7510f6
GitHub-Last-Rev: 3e5067a780
GitHub-Pull-Request: golang/go#40644
Reviewed-on: https://go-review.googlesource.com/c/go/+/247498
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
6d33075156
commit
cb2cbbcda2
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 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 p
|
||||
|
||||
type A[type T] int
|
||||
|
||||
func (A[T]) m(A[T])
|
||||
|
||||
func f[type P interface{m(P)}]()
|
||||
|
||||
func _() {
|
||||
_ = f[A]
|
||||
}
|
||||
|
|
@ -396,7 +396,7 @@ func (check *Checker) missingMethod(V Type, T *Interface, static bool) (method,
|
|||
// In order to compare the signatures, substitute the receiver
|
||||
// type parameters of ftyp with V's instantiation type arguments.
|
||||
// This lazily instantiates the signature of method f.
|
||||
if Vn != nil && len(Vn.targs) > 0 {
|
||||
if Vn != nil && len(Vn.tparams) > 0 {
|
||||
// Be careful: The number of type arguments may not match
|
||||
// the number of receiver parameters. If so, an error was
|
||||
// reported earlier but the length discrepancy is still
|
||||
|
|
|
|||
Loading…
Reference in New Issue