diff --git a/src/go/types/fixedbugs/issue40038.go2 b/src/go/types/fixedbugs/issue40038.go2 new file mode 100644 index 00000000000000..731018712d322a --- /dev/null +++ b/src/go/types/fixedbugs/issue40038.go2 @@ -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] +} \ No newline at end of file diff --git a/src/go/types/lookup.go b/src/go/types/lookup.go index 3b91da025cbe8c..d6740945d4b36c 100644 --- a/src/go/types/lookup.go +++ b/src/go/types/lookup.go @@ -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