Bump golang.org/x/tools from 0.12.0 to 0.13.0 (#2815)

* Bump golang.org/x/tools from 0.12.0 to 0.13.0

Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.12.0 to 0.13.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.12.0...v0.13.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Run ./hack/update-codegen.sh

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2023-09-12 03:48:06 +00:00 committed by GitHub
parent 8053378d14
commit 2ae83b9983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 293 additions and 53 deletions

2
go.mod
View File

@ -34,7 +34,7 @@ require (
golang.org/x/net v0.15.0
golang.org/x/oauth2 v0.12.0
golang.org/x/sync v0.3.0
golang.org/x/tools v0.12.0
golang.org/x/tools v0.13.0
gomodules.xyz/jsonpatch/v2 v2.4.0
google.golang.org/api v0.138.0
google.golang.org/grpc v1.58.0

4
go.sum
View File

@ -621,8 +621,8 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss=
golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@ -8,7 +8,6 @@ package packagesdriver
import (
"context"
"fmt"
"go/types"
"strings"
"golang.org/x/tools/internal/gocommand"
@ -16,7 +15,7 @@ import (
var debug = false
func GetSizesGolist(ctx context.Context, inv gocommand.Invocation, gocmdRunner *gocommand.Runner) (types.Sizes, error) {
func GetSizesForArgsGolist(ctx context.Context, inv gocommand.Invocation, gocmdRunner *gocommand.Runner) (string, string, error) {
inv.Verb = "list"
inv.Args = []string{"-f", "{{context.GOARCH}} {{context.Compiler}}", "--", "unsafe"}
stdout, stderr, friendlyErr, rawErr := gocmdRunner.RunRaw(ctx, inv)
@ -29,21 +28,21 @@ func GetSizesGolist(ctx context.Context, inv gocommand.Invocation, gocmdRunner *
inv.Args = []string{"GOARCH"}
envout, enverr := gocmdRunner.Run(ctx, inv)
if enverr != nil {
return nil, enverr
return "", "", enverr
}
goarch = strings.TrimSpace(envout.String())
compiler = "gc"
} else {
return nil, friendlyErr
return "", "", friendlyErr
}
} else {
fields := strings.Fields(stdout.String())
if len(fields) < 2 {
return nil, fmt.Errorf("could not parse GOARCH and Go compiler in format \"<GOARCH> <compiler>\":\nstdout: <<%s>>\nstderr: <<%s>>",
return "", "", fmt.Errorf("could not parse GOARCH and Go compiler in format \"<GOARCH> <compiler>\":\nstdout: <<%s>>\nstderr: <<%s>>",
stdout.String(), stderr.String())
}
goarch = fields[0]
compiler = fields[1]
}
return types.SizesFor(compiler, goarch), nil
return compiler, goarch, nil
}

View File

@ -9,7 +9,6 @@ import (
"context"
"encoding/json"
"fmt"
"go/types"
"io/ioutil"
"log"
"os"
@ -153,10 +152,10 @@ func goListDriver(cfg *Config, patterns ...string) (*driverResponse, error) {
if cfg.Mode&NeedTypesSizes != 0 || cfg.Mode&NeedTypes != 0 {
sizeswg.Add(1)
go func() {
var sizes types.Sizes
sizes, sizeserr = packagesdriver.GetSizesGolist(ctx, state.cfgInvocation(), cfg.gocmdRunner)
// types.SizesFor always returns nil or a *types.StdSizes.
response.dr.Sizes, _ = sizes.(*types.StdSizes)
compiler, arch, err := packagesdriver.GetSizesForArgsGolist(ctx, state.cfgInvocation(), cfg.gocmdRunner)
sizeserr = err
response.dr.Compiler = compiler
response.dr.Arch = arch
sizeswg.Done()
}()
}

View File

@ -220,8 +220,10 @@ type driverResponse struct {
// lists of multiple drivers, go/packages will fall back to the next driver.
NotHandled bool
// Sizes, if not nil, is the types.Sizes to use when type checking.
Sizes *types.StdSizes
// Compiler and Arch are the arguments pass of types.SizesFor
// to get a types.Sizes to use when type checking.
Compiler string
Arch string
// Roots is the set of package IDs that make up the root packages.
// We have to encode this separately because when we encode a single package
@ -262,7 +264,7 @@ func Load(cfg *Config, patterns ...string) ([]*Package, error) {
if err != nil {
return nil, err
}
l.sizes = response.Sizes
l.sizes = types.SizesFor(response.Compiler, response.Arch)
return l.refine(response)
}

View File

@ -32,6 +32,7 @@ import (
_ "unsafe"
"golang.org/x/tools/internal/typeparams"
"golang.org/x/tools/internal/typesinternal"
)
// A Path is an opaque name that identifies a types.Object
@ -127,12 +128,15 @@ type Encoder struct {
skipMethodSorting bool
}
// Exposed to gopls via golang.org/x/tools/internal/typesinternal
// TODO(golang/go#61443): eliminate this parameter one way or the other.
// Expose back doors so that gopls can avoid method sorting, which can dominate
// analysis on certain repositories.
//
//go:linkname skipMethodSorting
func skipMethodSorting(enc *Encoder) {
enc.skipMethodSorting = true
// TODO(golang/go#61443): remove this.
func init() {
typesinternal.SkipEncoderMethodSorting = func(enc interface{}) {
enc.(*Encoder).skipMethodSorting = true
}
typesinternal.ObjectpathObject = object
}
// For returns the path to an object relative to its package,
@ -572,17 +576,16 @@ func findTypeParam(obj types.Object, list *typeparams.TypeParamList, path []byte
// Object returns the object denoted by path p within the package pkg.
func Object(pkg *types.Package, p Path) (types.Object, error) {
return object(pkg, p, false)
return object(pkg, string(p), false)
}
// Note: the skipMethodSorting parameter must match the value of
// Encoder.skipMethodSorting used during encoding.
func object(pkg *types.Package, p Path, skipMethodSorting bool) (types.Object, error) {
if p == "" {
func object(pkg *types.Package, pathstr string, skipMethodSorting bool) (types.Object, error) {
if pathstr == "" {
return nil, fmt.Errorf("empty path")
}
pathstr := string(p)
var pkgobj, suffix string
if dot := strings.IndexByte(pathstr, opType); dot < 0 {
pkgobj = pathstr

View File

@ -93,6 +93,7 @@ var stdlib = map[string][]string{
"Compare",
"Contains",
"ContainsAny",
"ContainsFunc",
"ContainsRune",
"Count",
"Cut",
@ -147,6 +148,11 @@ var stdlib = map[string][]string{
"TrimSpace",
"TrimSuffix",
},
"cmp": {
"Compare",
"Less",
"Ordered",
},
"compress/bzip2": {
"NewReader",
"StructuralError",
@ -228,6 +234,7 @@ var stdlib = map[string][]string{
"Ring",
},
"context": {
"AfterFunc",
"Background",
"CancelCauseFunc",
"CancelFunc",
@ -239,8 +246,11 @@ var stdlib = map[string][]string{
"WithCancel",
"WithCancelCause",
"WithDeadline",
"WithDeadlineCause",
"WithTimeout",
"WithTimeoutCause",
"WithValue",
"WithoutCancel",
},
"crypto": {
"BLAKE2b_256",
@ -445,6 +455,7 @@ var stdlib = map[string][]string{
"XORBytes",
},
"crypto/tls": {
"AlertError",
"Certificate",
"CertificateRequestInfo",
"CertificateVerificationError",
@ -476,6 +487,7 @@ var stdlib = map[string][]string{
"LoadX509KeyPair",
"NewLRUClientSessionCache",
"NewListener",
"NewResumptionState",
"NoClientCert",
"PKCS1WithSHA1",
"PKCS1WithSHA256",
@ -484,6 +496,27 @@ var stdlib = map[string][]string{
"PSSWithSHA256",
"PSSWithSHA384",
"PSSWithSHA512",
"ParseSessionState",
"QUICClient",
"QUICConfig",
"QUICConn",
"QUICEncryptionLevel",
"QUICEncryptionLevelApplication",
"QUICEncryptionLevelEarly",
"QUICEncryptionLevelHandshake",
"QUICEncryptionLevelInitial",
"QUICEvent",
"QUICEventKind",
"QUICHandshakeDone",
"QUICNoEvent",
"QUICRejectedEarlyData",
"QUICServer",
"QUICSessionTicketOptions",
"QUICSetReadSecret",
"QUICSetWriteSecret",
"QUICTransportParameters",
"QUICTransportParametersRequired",
"QUICWriteData",
"RecordHeaderError",
"RenegotiateFreelyAsClient",
"RenegotiateNever",
@ -493,6 +526,7 @@ var stdlib = map[string][]string{
"RequireAndVerifyClientCert",
"RequireAnyClientCert",
"Server",
"SessionState",
"SignatureScheme",
"TLS_AES_128_GCM_SHA256",
"TLS_AES_256_GCM_SHA384",
@ -523,6 +557,7 @@ var stdlib = map[string][]string{
"TLS_RSA_WITH_AES_256_GCM_SHA384",
"TLS_RSA_WITH_RC4_128_SHA",
"VerifyClientCertIfGiven",
"VersionName",
"VersionSSL30",
"VersionTLS10",
"VersionTLS11",
@ -618,6 +653,7 @@ var stdlib = map[string][]string{
"PureEd25519",
"RSA",
"RevocationList",
"RevocationListEntry",
"SHA1WithRSA",
"SHA256WithRSA",
"SHA256WithRSAPSS",
@ -1002,10 +1038,42 @@ var stdlib = map[string][]string{
"COMPRESS_LOOS",
"COMPRESS_LOPROC",
"COMPRESS_ZLIB",
"COMPRESS_ZSTD",
"Chdr32",
"Chdr64",
"Class",
"CompressionType",
"DF_1_CONFALT",
"DF_1_DIRECT",
"DF_1_DISPRELDNE",
"DF_1_DISPRELPND",
"DF_1_EDITED",
"DF_1_ENDFILTEE",
"DF_1_GLOBAL",
"DF_1_GLOBAUDIT",
"DF_1_GROUP",
"DF_1_IGNMULDEF",
"DF_1_INITFIRST",
"DF_1_INTERPOSE",
"DF_1_KMOD",
"DF_1_LOADFLTR",
"DF_1_NOCOMMON",
"DF_1_NODEFLIB",
"DF_1_NODELETE",
"DF_1_NODIRECT",
"DF_1_NODUMP",
"DF_1_NOHDR",
"DF_1_NOKSYMS",
"DF_1_NOOPEN",
"DF_1_NORELOC",
"DF_1_NOW",
"DF_1_ORIGIN",
"DF_1_PIE",
"DF_1_SINGLETON",
"DF_1_STUB",
"DF_1_SYMINTPOSE",
"DF_1_TRANS",
"DF_1_WEAKFILTER",
"DF_BIND_NOW",
"DF_ORIGIN",
"DF_STATIC_TLS",
@ -1144,6 +1212,7 @@ var stdlib = map[string][]string{
"Dyn32",
"Dyn64",
"DynFlag",
"DynFlag1",
"DynTag",
"EI_ABIVERSION",
"EI_CLASS",
@ -2111,6 +2180,7 @@ var stdlib = map[string][]string{
"R_PPC64_REL16_LO",
"R_PPC64_REL24",
"R_PPC64_REL24_NOTOC",
"R_PPC64_REL24_P9NOTOC",
"R_PPC64_REL30",
"R_PPC64_REL32",
"R_PPC64_REL64",
@ -2848,6 +2918,7 @@ var stdlib = map[string][]string{
"MaxVarintLen16",
"MaxVarintLen32",
"MaxVarintLen64",
"NativeEndian",
"PutUvarint",
"PutVarint",
"Read",
@ -2963,6 +3034,7 @@ var stdlib = map[string][]string{
},
"errors": {
"As",
"ErrUnsupported",
"Is",
"Join",
"New",
@ -2989,6 +3061,7 @@ var stdlib = map[string][]string{
"Arg",
"Args",
"Bool",
"BoolFunc",
"BoolVar",
"CommandLine",
"ContinueOnError",
@ -3119,6 +3192,7 @@ var stdlib = map[string][]string{
"Inspect",
"InterfaceType",
"IsExported",
"IsGenerated",
"KeyValueExpr",
"LabeledStmt",
"Lbl",
@ -3169,6 +3243,7 @@ var stdlib = map[string][]string{
"ArchChar",
"Context",
"Default",
"Directive",
"FindOnly",
"IgnoreVendor",
"Import",
@ -3184,6 +3259,7 @@ var stdlib = map[string][]string{
"go/build/constraint": {
"AndExpr",
"Expr",
"GoVersion",
"IsGoBuild",
"IsPlusBuild",
"NotExpr",
@ -3626,6 +3702,7 @@ var stdlib = map[string][]string{
"ErrBadHTML",
"ErrBranchEnd",
"ErrEndContext",
"ErrJSTemplate",
"ErrNoSuchTemplate",
"ErrOutputContext",
"ErrPartialCharset",
@ -3870,6 +3947,8 @@ var stdlib = map[string][]string{
"FileInfo",
"FileInfoToDirEntry",
"FileMode",
"FormatDirEntry",
"FormatFileInfo",
"Glob",
"GlobFS",
"ModeAppend",
@ -3942,6 +4021,78 @@ var stdlib = map[string][]string{
"SetPrefix",
"Writer",
},
"log/slog": {
"Any",
"AnyValue",
"Attr",
"Bool",
"BoolValue",
"Debug",
"DebugContext",
"Default",
"Duration",
"DurationValue",
"Error",
"ErrorContext",
"Float64",
"Float64Value",
"Group",
"GroupValue",
"Handler",
"HandlerOptions",
"Info",
"InfoContext",
"Int",
"Int64",
"Int64Value",
"IntValue",
"JSONHandler",
"Kind",
"KindAny",
"KindBool",
"KindDuration",
"KindFloat64",
"KindGroup",
"KindInt64",
"KindLogValuer",
"KindString",
"KindTime",
"KindUint64",
"Level",
"LevelDebug",
"LevelError",
"LevelInfo",
"LevelKey",
"LevelVar",
"LevelWarn",
"Leveler",
"Log",
"LogAttrs",
"LogValuer",
"Logger",
"MessageKey",
"New",
"NewJSONHandler",
"NewLogLogger",
"NewRecord",
"NewTextHandler",
"Record",
"SetDefault",
"Source",
"SourceKey",
"String",
"StringValue",
"TextHandler",
"Time",
"TimeKey",
"TimeValue",
"Uint64",
"Uint64Value",
"Value",
"Warn",
"WarnContext",
"With",
},
"log/syslog": {
"Dial",
"LOG_ALERT",
@ -3977,6 +4128,13 @@ var stdlib = map[string][]string{
"Priority",
"Writer",
},
"maps": {
"Clone",
"Copy",
"DeleteFunc",
"Equal",
"EqualFunc",
},
"math": {
"Abs",
"Acos",
@ -4371,6 +4529,7 @@ var stdlib = map[string][]string{
"ErrNoLocation",
"ErrNotMultipart",
"ErrNotSupported",
"ErrSchemeMismatch",
"ErrServerClosed",
"ErrShortBody",
"ErrSkipAltProtocol",
@ -5084,6 +5243,8 @@ var stdlib = map[string][]string{
"NumCPU",
"NumCgoCall",
"NumGoroutine",
"PanicNilError",
"Pinner",
"ReadMemStats",
"ReadTrace",
"SetBlockProfileRate",
@ -5172,6 +5333,37 @@ var stdlib = map[string][]string{
"Task",
"WithRegion",
},
"slices": {
"BinarySearch",
"BinarySearchFunc",
"Clip",
"Clone",
"Compact",
"CompactFunc",
"Compare",
"CompareFunc",
"Contains",
"ContainsFunc",
"Delete",
"DeleteFunc",
"Equal",
"EqualFunc",
"Grow",
"Index",
"IndexFunc",
"Insert",
"IsSorted",
"IsSortedFunc",
"Max",
"MaxFunc",
"Min",
"MinFunc",
"Replace",
"Reverse",
"Sort",
"SortFunc",
"SortStableFunc",
},
"sort": {
"Find",
"Float64Slice",
@ -5242,6 +5434,7 @@ var stdlib = map[string][]string{
"Compare",
"Contains",
"ContainsAny",
"ContainsFunc",
"ContainsRune",
"Count",
"Cut",
@ -5299,6 +5492,9 @@ var stdlib = map[string][]string{
"Mutex",
"NewCond",
"Once",
"OnceFunc",
"OnceValue",
"OnceValues",
"Pool",
"RWMutex",
"WaitGroup",
@ -9135,10 +9331,12 @@ var stdlib = map[string][]string{
"SYS_AIO_CANCEL",
"SYS_AIO_ERROR",
"SYS_AIO_FSYNC",
"SYS_AIO_MLOCK",
"SYS_AIO_READ",
"SYS_AIO_RETURN",
"SYS_AIO_SUSPEND",
"SYS_AIO_SUSPEND_NOCANCEL",
"SYS_AIO_WAITCOMPLETE",
"SYS_AIO_WRITE",
"SYS_ALARM",
"SYS_ARCH_PRCTL",
@ -9368,6 +9566,7 @@ var stdlib = map[string][]string{
"SYS_GET_MEMPOLICY",
"SYS_GET_ROBUST_LIST",
"SYS_GET_THREAD_AREA",
"SYS_GSSD_SYSCALL",
"SYS_GTTY",
"SYS_IDENTITYSVC",
"SYS_IDLE",
@ -9411,8 +9610,24 @@ var stdlib = map[string][]string{
"SYS_KLDSYM",
"SYS_KLDUNLOAD",
"SYS_KLDUNLOADF",
"SYS_KMQ_NOTIFY",
"SYS_KMQ_OPEN",
"SYS_KMQ_SETATTR",
"SYS_KMQ_TIMEDRECEIVE",
"SYS_KMQ_TIMEDSEND",
"SYS_KMQ_UNLINK",
"SYS_KQUEUE",
"SYS_KQUEUE1",
"SYS_KSEM_CLOSE",
"SYS_KSEM_DESTROY",
"SYS_KSEM_GETVALUE",
"SYS_KSEM_INIT",
"SYS_KSEM_OPEN",
"SYS_KSEM_POST",
"SYS_KSEM_TIMEDWAIT",
"SYS_KSEM_TRYWAIT",
"SYS_KSEM_UNLINK",
"SYS_KSEM_WAIT",
"SYS_KTIMER_CREATE",
"SYS_KTIMER_DELETE",
"SYS_KTIMER_GETOVERRUN",
@ -9504,11 +9719,14 @@ var stdlib = map[string][]string{
"SYS_NFSSVC",
"SYS_NFSTAT",
"SYS_NICE",
"SYS_NLM_SYSCALL",
"SYS_NLSTAT",
"SYS_NMOUNT",
"SYS_NSTAT",
"SYS_NTP_ADJTIME",
"SYS_NTP_GETTIME",
"SYS_NUMA_GETAFFINITY",
"SYS_NUMA_SETAFFINITY",
"SYS_OABI_SYSCALL_BASE",
"SYS_OBREAK",
"SYS_OLDFSTAT",
@ -9891,6 +10109,7 @@ var stdlib = map[string][]string{
"SYS___ACL_SET_FD",
"SYS___ACL_SET_FILE",
"SYS___ACL_SET_LINK",
"SYS___CAP_RIGHTS_GET",
"SYS___CLONE",
"SYS___DISABLE_THREADSIGNAL",
"SYS___GETCWD",
@ -10574,6 +10793,7 @@ var stdlib = map[string][]string{
"Short",
"T",
"TB",
"Testing",
"Verbose",
},
"testing/fstest": {
@ -10603,6 +10823,9 @@ var stdlib = map[string][]string{
"SetupError",
"Value",
},
"testing/slogtest": {
"TestHandler",
},
"text/scanner": {
"Char",
"Comment",
@ -10826,6 +11049,7 @@ var stdlib = map[string][]string{
"Cs",
"Cuneiform",
"Cypriot",
"Cypro_Minoan",
"Cyrillic",
"Dash",
"Deprecated",
@ -10889,6 +11113,7 @@ var stdlib = map[string][]string{
"Kaithi",
"Kannada",
"Katakana",
"Kawi",
"Kayah_Li",
"Kharoshthi",
"Khitan_Small_Script",
@ -10943,6 +11168,7 @@ var stdlib = map[string][]string{
"Myanmar",
"N",
"Nabataean",
"Nag_Mundari",
"Nandinagari",
"Nd",
"New_Tai_Lue",
@ -10964,6 +11190,7 @@ var stdlib = map[string][]string{
"Old_Sogdian",
"Old_South_Arabian",
"Old_Turkic",
"Old_Uyghur",
"Oriya",
"Osage",
"Osmanya",
@ -11038,6 +11265,7 @@ var stdlib = map[string][]string{
"Tai_Viet",
"Takri",
"Tamil",
"Tangsa",
"Tangut",
"Telugu",
"Terminal_Punctuation",
@ -11052,6 +11280,7 @@ var stdlib = map[string][]string{
"ToLower",
"ToTitle",
"ToUpper",
"Toto",
"TurkishCase",
"Ugaritic",
"Unified_Ideograph",
@ -11061,6 +11290,7 @@ var stdlib = map[string][]string{
"Vai",
"Variation_Selector",
"Version",
"Vithkuqi",
"Wancho",
"Warang_Citi",
"White_Space",

View File

@ -81,13 +81,13 @@ func CoreType(T types.Type) types.Type {
// restrictions may be arbitrarily complex. For example, consider the
// following:
//
// type A interface{ ~string|~[]byte }
// type A interface{ ~string|~[]byte }
//
// type B interface{ int|string }
// type B interface{ int|string }
//
// type C interface { ~string|~int }
// type C interface { ~string|~int }
//
// type T[P interface{ A|B; C }] int
// type T[P interface{ A|B; C }] int
//
// In this example, the structural type restriction of P is ~string|int: A|B
// expands to ~string|~[]byte|int|string, which reduces to ~string|~[]byte|int,

View File

@ -30,7 +30,7 @@ func (xl termlist) String() string {
var buf bytes.Buffer
for i, x := range xl {
if i > 0 {
buf.WriteString(" ")
buf.WriteString(" | ")
}
buf.WriteString(x.String())
}

View File

@ -10,11 +10,10 @@ import "go/types"
// A term describes elementary type sets:
//
// ∅: (*term)(nil) == ∅ // set of no types (empty set)
// 𝓤: &term{} == 𝓤 // set of all types (𝓤niverse)
// T: &term{false, T} == {T} // set of type T
// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t
//
// ∅: (*term)(nil) == ∅ // set of no types (empty set)
// 𝓤: &term{} == 𝓤 // set of all types (𝓤niverse)
// T: &term{false, T} == {T} // set of type T
// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t
type term struct {
tilde bool // valid if typ != nil
typ types.Type

View File

@ -0,0 +1,24 @@
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package typesinternal
import "go/types"
// This file contains back doors that allow gopls to avoid method sorting when
// using the objectpath package.
//
// This is performance-critical in certain repositories, but changing the
// behavior of the objectpath package is still being discussed in
// golang/go#61443. If we decide to remove the sorting in objectpath we can
// simply delete these back doors. Otherwise, we should add a new API to
// objectpath that allows controlling the sorting.
// SkipEncoderMethodSorting marks enc (which must be an *objectpath.Encoder) as
// not requiring sorted methods.
var SkipEncoderMethodSorting func(enc interface{})
// ObjectpathObject is like objectpath.Object, but allows suppressing method
// sorting.
var ObjectpathObject func(pkg *types.Package, p string, skipMethodSorting bool) (types.Object, error)

View File

@ -11,8 +11,6 @@ import (
"go/types"
"reflect"
"unsafe"
"golang.org/x/tools/go/types/objectpath"
)
func SetUsesCgo(conf *types.Config) bool {
@ -52,17 +50,3 @@ func ReadGo116ErrorData(err types.Error) (code ErrorCode, start, end token.Pos,
}
var SetGoVersion = func(conf *types.Config, version string) bool { return false }
// SkipEncoderMethodSorting marks the encoder as not requiring sorted methods,
// as an optimization for gopls (which guarantees the order of parsed source files).
//
// TODO(golang/go#61443): eliminate this parameter one way or the other.
//
//go:linkname SkipEncoderMethodSorting golang.org/x/tools/go/types/objectpath.skipMethodSorting
func SkipEncoderMethodSorting(enc *objectpath.Encoder)
// ObjectpathObject is like objectpath.Object, but allows suppressing method
// sorting (which is not necessary for gopls).
//
//go:linkname ObjectpathObject golang.org/x/tools/go/types/objectpath.object
func ObjectpathObject(pkg *types.Package, p objectpath.Path, skipMethodSorting bool) (types.Object, error)

2
vendor/modules.txt vendored
View File

@ -377,7 +377,7 @@ golang.org/x/text/unicode/norm
# golang.org/x/time v0.3.0
## explicit
golang.org/x/time/rate
# golang.org/x/tools v0.12.0
# golang.org/x/tools v0.13.0
## explicit; go 1.18
golang.org/x/tools/go/ast/astutil
golang.org/x/tools/go/gcexportdata