internal/typeparams: follow changes to Type in the go/ast and go/types

As discussed on both proposals to CL 348375 (#47781) and
CL 348376 (#47916), Go core changed the 'T' word to 'Type'.
Follows those changes as well.

Change-Id: I52c354cdc7494aaf3c63bfb136efa86159175314
Reviewed-on: https://go-review.googlesource.com/c/tools/+/348509
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:
Koichi Shiraishi 2021-09-09 02:30:20 +09:00 committed by Robert Findley
parent 0a6f080615
commit 2cae65cc5b
1 changed files with 6 additions and 6 deletions

View File

@ -44,13 +44,13 @@ func GetIndexExprData(n ast.Node) *IndexExprData {
// ForTypeDecl extracts the (possibly nil) type parameter node list from n.
func ForTypeDecl(n *ast.TypeSpec) *ast.FieldList {
return n.TParams
return n.TypeParams
}
// ForFuncDecl extracts the (possibly nil) type parameter node list from n.
func ForFuncDecl(n *ast.FuncDecl) *ast.FieldList {
if n.Type != nil {
return n.Type.TParams
return n.Type.TypeParams
}
return nil
}
@ -58,7 +58,7 @@ func ForFuncDecl(n *ast.FuncDecl) *ast.FieldList {
// ForSignature extracts the (possibly empty) type parameter object list from
// sig.
func ForSignature(sig *types.Signature) []*types.TypeName {
return tparamsSlice(sig.TParams())
return tparamsSlice(sig.TypeParams())
}
// IsComparable reports if iface is the comparable interface.
@ -75,10 +75,10 @@ func IsConstraint(iface *types.Interface) bool {
// ForNamed extracts the (possibly empty) type parameter object list from
// named.
func ForNamed(named *types.Named) []*types.TypeName {
return tparamsSlice(named.TParams())
return tparamsSlice(named.TypeParams())
}
func tparamsSlice(tparams *types.TParamList) []*types.TypeName {
func tparamsSlice(tparams *types.TypeParamList) []*types.TypeName {
length := tparams.Len()
if length == 0 {
return nil
@ -94,7 +94,7 @@ func tparamsSlice(tparams *types.TParamList) []*types.TypeName {
// NamedTArgs extracts the (possibly empty) type argument list from named.
func NamedTArgs(named *types.Named) []types.Type {
targs := named.TArgs()
targs := named.TypeArgs()
numArgs := targs.Len()
typs := make([]types.Type, numArgs)