aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2026-03-23 14:18:47 -0400
committerGopher Robot <gobot@golang.org>2026-03-25 06:01:35 -0700
commit26548d49816da1c21a71c480eb4aea46dba0c0c2 (patch)
tree24d12908535f208e7db3e5f1f3204626c9de4b14
parent12bf7d8cd2572d7f6aef4a18e490461f1aa2f53e (diff)
downloadgo-26548d49816da1c21a71c480eb4aea46dba0c0c2.tar.xz
[release-branch.go1.26] cmd/fix: pull in CL 755980
Fixes #78191. [git-generate] cd src/cmd go get golang.org/x/tools@internal-branch.go1.26-vendor # v0.39.1-0.20260323181443-4f499ecaa91d go mod tidy go mod vendor Change-Id: I1162398e037c774f71421ede8c6ae8656a54eea6 Reviewed-on: https://go-review.googlesource.com/c/go/+/758300 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
-rw-r--r--src/cmd/go.mod2
-rw-r--r--src/cmd/go.sum4
-rw-r--r--src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inline/inline.go65
-rw-r--r--src/cmd/vendor/modules.txt2
4 files changed, 38 insertions, 35 deletions
diff --git a/src/cmd/go.mod b/src/cmd/go.mod
index 023a63059c..14107c2d8e 100644
--- a/src/cmd/go.mod
+++ b/src/cmd/go.mod
@@ -11,7 +11,7 @@ require (
golang.org/x/sys v0.39.0
golang.org/x/telemetry v0.0.0-20251128220624-abf20d0e57ec
golang.org/x/term v0.38.0
- golang.org/x/tools v0.39.1-0.20260302211140-642dd50cb7cc
+ golang.org/x/tools v0.39.1-0.20260323181443-4f499ecaa91d
)
require (
diff --git a/src/cmd/go.sum b/src/cmd/go.sum
index 269fbb17b0..c4920417b2 100644
--- a/src/cmd/go.sum
+++ b/src/cmd/go.sum
@@ -22,7 +22,7 @@ golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q=
golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg=
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
-golang.org/x/tools v0.39.1-0.20260302211140-642dd50cb7cc h1:RzEk8N4Q57niCI1HA49wovYfk90ufvZo8j3JA87GZH8=
-golang.org/x/tools v0.39.1-0.20260302211140-642dd50cb7cc/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ=
+golang.org/x/tools v0.39.1-0.20260323181443-4f499ecaa91d h1:d9RYG/Z8xQk+tFy5IyhSwUrt4HhSsqHw/uhwmn1KaJg=
+golang.org/x/tools v0.39.1-0.20260323181443-4f499ecaa91d/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ=
rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef h1:mqLYrXCXYEZOop9/Dbo6RPX11539nwiCNBb1icVPmw8=
rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef/go.mod h1:8xcPgWmwlZONN1D9bjxtHEjrUtSEa3fakVF8iaewYKQ=
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inline/inline.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inline/inline.go
index 9049145e22..c7ba56ad83 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inline/inline.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/inline/inline.go
@@ -315,12 +315,43 @@ func (a *analyzer) inlineAlias(tn *types.TypeName, curId inspector.Cursor) {
curPath := a.pass.Pkg.Path()
curFile := astutil.EnclosingFile(curId)
id := curId.Node().(*ast.Ident)
+
+ // Find the complete identifier, which may take any of these forms:
+ // Id
+ // Id[T]
+ // Id[K, V]
+ // pkg.Id
+ // pkg.Id[T]
+ // pkg.Id[K, V]
+ var expr ast.Expr = id
+ if astutil.IsChildOf(curId, edge.SelectorExpr_Sel) {
+ curId = curId.Parent()
+ expr = curId.Node().(ast.Expr)
+ }
+ // If expr is part of an IndexExpr or IndexListExpr, we'll need that node.
+ // Given C[int], TypeOf(C) is generic but TypeOf(C[int]) is instantiated.
+ switch ek, _ := curId.ParentEdge(); ek {
+ case edge.IndexExpr_X:
+ expr = curId.Parent().Node().(*ast.IndexExpr)
+ case edge.IndexListExpr_X:
+ expr = curId.Parent().Node().(*ast.IndexListExpr)
+ }
+ t := a.pass.TypesInfo.TypeOf(expr).(*types.Alias) // type of entire identifier
+ if targs := t.TypeArgs(); targs.Len() > 0 {
+ // Instantiate the alias with the type args from this use.
+ // For example, given type A = M[K, V], compute the type of the use
+ // A[int, Foo] as M[int, Foo].
+ // Don't validate instantiation: it can't panic unless we have a bug,
+ // in which case seeing the stack trace via telemetry would be helpful.
+ instAlias, _ := types.Instantiate(nil, alias, slices.Collect(targs.Types()), false)
+ rhs = instAlias.(*types.Alias).Rhs()
+ }
+
// We have an identifier A here (n), possibly qualified by a package
// identifier (sel.n), and an inlinable "type A = rhs" elsewhere.
//
// We can replace A with rhs if no name in rhs is shadowed at n's position,
// and every package in rhs is importable by the current package.
-
var (
importPrefixes = map[string]string{curPath: ""} // from pkg path to prefix
edits []analysis.TextEdit
@@ -349,6 +380,7 @@ func (a *analyzer) inlineAlias(tn *types.TypeName, curId inspector.Cursor) {
return
} else if _, ok := importPrefixes[pkgPath]; !ok {
// Use AddImport to add pkgPath if it's not there already. Associate the prefix it assigns
+ // with the prefix it assigns
// with the package path for use by the TypeString qualifier below.
prefix, eds := refactor.AddImport(
a.pass.TypesInfo, curFile, pkgName, pkgPath, tn.Name(), id.Pos())
@@ -356,36 +388,7 @@ func (a *analyzer) inlineAlias(tn *types.TypeName, curId inspector.Cursor) {
edits = append(edits, eds...)
}
}
- // Find the complete identifier, which may take any of these forms:
- // Id
- // Id[T]
- // Id[K, V]
- // pkg.Id
- // pkg.Id[T]
- // pkg.Id[K, V]
- var expr ast.Expr = id
- if astutil.IsChildOf(curId, edge.SelectorExpr_Sel) {
- curId = curId.Parent()
- expr = curId.Node().(ast.Expr)
- }
- // If expr is part of an IndexExpr or IndexListExpr, we'll need that node.
- // Given C[int], TypeOf(C) is generic but TypeOf(C[int]) is instantiated.
- switch ek, _ := curId.ParentEdge(); ek {
- case edge.IndexExpr_X:
- expr = curId.Parent().Node().(*ast.IndexExpr)
- case edge.IndexListExpr_X:
- expr = curId.Parent().Node().(*ast.IndexListExpr)
- }
- t := a.pass.TypesInfo.TypeOf(expr).(*types.Alias) // type of entire identifier
- if targs := t.TypeArgs(); targs.Len() > 0 {
- // Instantiate the alias with the type args from this use.
- // For example, given type A = M[K, V], compute the type of the use
- // A[int, Foo] as M[int, Foo].
- // Don't validate instantiation: it can't panic unless we have a bug,
- // in which case seeing the stack trace via telemetry would be helpful.
- instAlias, _ := types.Instantiate(nil, alias, slices.Collect(targs.Types()), false)
- rhs = instAlias.(*types.Alias).Rhs()
- }
+
// To get the replacement text, render the alias RHS using the package prefixes
// we assigned above.
newText := types.TypeString(rhs, func(p *types.Package) string {
diff --git a/src/cmd/vendor/modules.txt b/src/cmd/vendor/modules.txt
index cb5b826075..4e2260af52 100644
--- a/src/cmd/vendor/modules.txt
+++ b/src/cmd/vendor/modules.txt
@@ -73,7 +73,7 @@ golang.org/x/text/internal/tag
golang.org/x/text/language
golang.org/x/text/transform
golang.org/x/text/unicode/norm
-# golang.org/x/tools v0.39.1-0.20260302211140-642dd50cb7cc
+# golang.org/x/tools v0.39.1-0.20260323181443-4f499ecaa91d
## explicit; go 1.24.0
golang.org/x/tools/cmd/bisect
golang.org/x/tools/cover