vendor: golang.org/x/tools v0.46.0

full diff: https://github.com/golang/tools/compare/v0.45.0...v0.46.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2026-06-19 17:12:50 +02:00
parent 04c24b93df
commit 962c4d1780
8 changed files with 69 additions and 16 deletions
+1 -1
View File
@@ -230,7 +230,7 @@ require (
golang.org/x/net v0.56.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/time v0.15.0 // indirect
golang.org/x/tools v0.45.0 // indirect
golang.org/x/tools v0.46.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
+2 -2
View File
@@ -670,8 +670,8 @@ golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE=
golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4=
golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U=
golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8=
golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0=
golang.org/x/tools v0.46.0 h1:7jTurBkPZu4moS/Uy4OQT1M+QBlsj3wejyZwsT8Z7rk=
golang.org/x/tools v0.46.0/go.mod h1:FrD85F8l+NWL+9XWBSyVSHO6Ne4jutsfIFba7AWQ5Ys=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/api v0.280.0 h1:F4OfEHZhZh6a7uTufJAXXVd/2TQ8EjM4vZH+jX/vFYk=
+14
View File
@@ -815,6 +815,12 @@ func (ld *loader) refine(response *DriverResponse) ([]*Package, error) {
needsrc: needsrc,
goVersion: response.GoVersion,
}
// Don't trust the driver to respond with duplicate-free
// package names (go.dev/issue/63822).
if _, ok := ld.pkgs[lpkg.ID]; ok {
return nil, fmt.Errorf("%s response contained duplicate packages for ID %q",
cond(ld.externalDriver, "go/packages driver", "go list"), lpkg.ID)
}
ld.pkgs[lpkg.ID] = lpkg
if rootIndex >= 0 {
initial[rootIndex] = lpkg
@@ -1589,3 +1595,11 @@ func usesExportData(cfg *Config) bool {
}
type unit struct{}
func cond[T any](cond bool, t, f T) T {
if cond {
return t
} else {
return f
}
}
+3
View File
@@ -823,6 +823,9 @@ func (p *iexporter) doDecl(obj types.Object) {
w.pos(m.Pos())
w.string(m.Name())
sig, _ := m.Type().(*types.Signature)
if w.p.version >= iexportVersionGenericMethods && w.bool(sig.TypeParams().Len() > 0) {
w.tparamList(obj.Name()+"."+m.Name(), sig.TypeParams(), obj.Pkg())
}
// Receiver type parameters are type arguments of the receiver type, so
// their name must be qualified before exporting recv.
+14 -10
View File
@@ -48,13 +48,14 @@ func (r *intReader) uint64() uint64 {
// Keep this in sync with constants in iexport.go.
const (
iexportVersionGo1_11 = 0
iexportVersionPosCol = 1
iexportVersionGo1_18 = 2
iexportVersionGenerics = 2
iexportVersion = iexportVersionGenerics
iexportVersionGo1_11 = 0
iexportVersionPosCol = 1
iexportVersionGo1_18 = 2
iexportVersionGenerics = 2
iexportVersionGenericMethods = 3
iexportVersion = iexportVersionGenericMethods
iexportVersionCurrent = 2
iexportVersionCurrent = 3
)
type ident struct {
@@ -179,9 +180,9 @@ func iimportCommon(fset *token.FileSet, getPackages GetPackagesFunc, data []byte
version = int64(r.uint64())
switch version {
case iexportVersionGo1_18, iexportVersionPosCol, iexportVersionGo1_11:
case iexportVersionGenericMethods, iexportVersionGo1_18, iexportVersionPosCol, iexportVersionGo1_11:
default:
if version > iexportVersionGo1_18 {
if version > iexportVersionGenericMethods {
errorf("unstable iexport format version %d, just rebuild compiler and std library", version)
} else {
errorf("unknown iexport format version %d", version)
@@ -614,6 +615,10 @@ func (r *importReader) obj(pkg *types.Package, name string) {
for n := r.uint64(); n > 0; n-- {
mpos := r.pos()
mname := r.ident()
var tpars []*types.TypeParam
if r.p.version >= iexportVersionGenericMethods && r.bool() {
tpars = r.tparamList()
}
recv := r.param(pkg)
// If the receiver has any targs, set those as the
@@ -628,8 +633,7 @@ func (r *importReader) obj(pkg *types.Package, name string) {
rparams[i] = types.Unalias(targs.At(i)).(*types.TypeParam)
}
}
msig := r.signature(pkg, recv, rparams, nil)
msig := r.signature(pkg, recv, rparams, tpars)
named.AddMethod(types.NewFunc(mpos, pkg, mname, msig))
}
}
+6 -2
View File
@@ -37,6 +37,10 @@ func ForEachElement(rtypes *typeutil.Map, msets *typeutil.MethodSetCache, T type
tmset := msets.MethodSet(T)
for method := range tmset.Methods() {
sig := method.Type().(*types.Signature)
if sig.TypeParams() != nil {
continue // skip type-parameterized methods
}
// It is tempting to call visit(sig, false)
// but, as noted in golang.org/cl/65450043,
// the Signature.Recv field is ignored by
@@ -123,10 +127,10 @@ func ForEachElement(rtypes *typeutil.Map, msets *typeutil.MethodSetCache, T type
case *types.TypeParam, *types.Union:
// forEachReachable must not be called on parameterized types.
panic(T)
panic(fmt.Sprintf("ForEachElement called on type containing %T", T))
default:
panic(T)
panic(fmt.Sprintf("ForEachElement called on unexpected type %T", T))
}
}
visit(T, false)
+28
View File
@@ -22,6 +22,7 @@ import (
"go/ast"
"go/token"
"go/types"
"iter"
"reflect"
"golang.org/x/tools/go/ast/inspector"
@@ -242,3 +243,30 @@ func ObjectKind(obj types.Object) string {
}
return "unknown symbol"
}
// ImplicitFieldSelections returns the sequence of implicit embedded fields
// traversed by the given selection. It skips the final leaf field or method.
// The boolean component indicates whether the traversal traversed a pointer.
func ImplicitFieldSelections(seln types.Selection) iter.Seq2[*types.Var, bool] {
return func(yield func(*types.Var, bool) bool) {
var (
t = seln.Recv()
indices = seln.Index()
)
for _, idx := range indices[:len(indices)-1] {
ptr, isPtr := t.Underlying().(*types.Pointer)
if isPtr {
t = ptr.Elem()
}
structType, ok := t.Underlying().(*types.Struct)
if !ok {
break
}
field := structType.Field(idx)
if !yield(field, isPtr) {
break
}
t = field.Type()
}
}
}
+1 -1
View File
@@ -1397,7 +1397,7 @@ golang.org/x/text/width
# golang.org/x/time v0.15.0
## explicit; go 1.25.0
golang.org/x/time/rate
# golang.org/x/tools v0.45.0
# golang.org/x/tools v0.46.0
## explicit; go 1.25.0
golang.org/x/tools/cmd/stringer
golang.org/x/tools/go/ast/edge