mirror of https://github.com/golang/go.git
internal/typeparams: fix undefined *types.Named.TArgs method
Current tip Go runtime (7eaabae84d) haven't (actually removed)
implements *types.Named.TArgs() method.
Calculate and make targs using named.NumTArgs().
Change-Id: Ib6a61cf2f8da644f533891f9bbb30179f8a7df5c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/342229
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Findley <rfindley@google.com>
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
a55d5155d9
commit
758a1a1db7
|
|
@ -91,7 +91,17 @@ func tparamsSlice(tparams *types.TypeParams) []*types.TypeName {
|
|||
|
||||
// NamedTArgs extracts the (possibly empty) type argument list from named.
|
||||
func NamedTArgs(named *types.Named) []types.Type {
|
||||
return named.TArgs()
|
||||
ntargs := named.NumTArgs()
|
||||
if ntargs == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
targs := make([]types.Type, ntargs)
|
||||
for i := 0; i < ntargs; i++ {
|
||||
targs[i] = named.TArg(i)
|
||||
}
|
||||
|
||||
return targs
|
||||
}
|
||||
|
||||
// InitInferred initializes info to record inferred type information.
|
||||
|
|
|
|||
Loading…
Reference in New Issue