From 2cae65cc5b9f238fdf4ef0e25cbe785be566c87d Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Thu, 9 Sep 2021 02:30:20 +0900 Subject: [PATCH] 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 Trust: Robert Findley Trust: Rebecca Stambler Run-TryBot: Robert Findley gopls-CI: kokoro TryBot-Result: Go Bot --- internal/typeparams/typeparams.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/typeparams/typeparams.go b/internal/typeparams/typeparams.go index d459b32cb3..e263537c86 100644 --- a/internal/typeparams/typeparams.go +++ b/internal/typeparams/typeparams.go @@ -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)