update to golang.org/x/{crypto,net,text,sync,tools}@latest

This commit is contained in:
Mechiel Lukkien
2024-08-22 20:45:35 +02:00
parent 09b13ed4d5
commit c16162eebc
39 changed files with 724 additions and 434 deletions

View File

@ -21,7 +21,6 @@ import (
"sort"
"strconv"
"strings"
"unsafe"
"golang.org/x/tools/go/types/objectpath"
"golang.org/x/tools/internal/aliases"
@ -529,7 +528,7 @@ func (p *iexporter) doDecl(obj types.Object) {
if alias, ok := t.(*aliases.Alias); ok {
// Preserve materialized aliases,
// even of non-exported types.
t = aliasRHS(alias)
t = aliases.Rhs(alias)
}
w.typ(t, obj.Pkg())
break
@ -1331,19 +1330,3 @@ func (e internalError) Error() string { return "gcimporter: " + string(e) }
func internalErrorf(format string, args ...interface{}) error {
return internalError(fmt.Sprintf(format, args...))
}
// aliasRHS removes exactly one Alias constructor.
func aliasRHS(alias *aliases.Alias) types.Type {
// TODO(adonovan): if proposal #66559 is accepted, this will
// become Alias.RHS(alias). In the meantime, we must punch
// through the drywall.
type go123Alias struct {
_ *types.TypeName
_ *types.TypeParamList
RHS types.Type
_ types.Type
}
var raw *go123Alias
*(**aliases.Alias)(unsafe.Pointer(&raw)) = alias
return raw.RHS
}

View File

@ -210,6 +210,7 @@ func iimportCommon(fset *token.FileSet, getPackages GetPackagesFunc, data []byte
p := iimporter{
version: int(version),
ipath: path,
aliases: aliases.Enabled(),
shallow: shallow,
reportf: reportf,
@ -369,6 +370,7 @@ type iimporter struct {
version int
ipath string
aliases bool
shallow bool
reportf ReportFunc // if non-nil, used to report bugs
@ -567,7 +569,7 @@ func (r *importReader) obj(name string) {
// tparams := r.tparamList()
// alias.SetTypeParams(tparams)
// }
r.declare(aliases.NewAlias(pos, r.currPkg, name, typ))
r.declare(aliases.NewAlias(r.p.aliases, pos, r.currPkg, name, typ))
case constTag:
typ, val := r.value()

View File

@ -26,6 +26,7 @@ type pkgReader struct {
ctxt *types.Context
imports map[string]*types.Package // previously imported packages, indexed by path
aliases bool // create types.Alias nodes
// lazily initialized arrays corresponding to the unified IR
// PosBase, Pkg, and Type sections, respectively.
@ -99,6 +100,7 @@ func readUnifiedPackage(fset *token.FileSet, ctxt *types.Context, imports map[st
ctxt: ctxt,
imports: imports,
aliases: aliases.Enabled(),
posBases: make([]string, input.NumElems(pkgbits.RelocPosBase)),
pkgs: make([]*types.Package, input.NumElems(pkgbits.RelocPkg)),
@ -524,7 +526,7 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) {
case pkgbits.ObjAlias:
pos := r.pos()
typ := r.typ()
declare(aliases.NewAlias(pos, objPkg, objName, typ))
declare(aliases.NewAlias(r.p.aliases, pos, objPkg, objName, typ))
case pkgbits.ObjConst:
pos := r.pos()