Update Dependencies (#390)
Co-authored-by: Norwin Roosen <git@nroo.de> Co-authored-by: Norwin <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/390 Reviewed-by: 6543 <6543@obermui.de> Reviewed-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
2
vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go
generated
vendored
2
vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go
generated
vendored
@@ -97,7 +97,7 @@ func Main(analyzers ...*analysis.Analyzer) {
|
||||
|
||||
Usage of %[1]s:
|
||||
%.16[1]s unit.cfg # execute analysis specified by config file
|
||||
%.16[1]s help # general help
|
||||
%.16[1]s help # general help, including listing analyzers and flags
|
||||
%.16[1]s help name # help on specific analyzer and its flags
|
||||
`, progname)
|
||||
os.Exit(1)
|
||||
|
||||
1
vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker112.go
generated
vendored
1
vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker112.go
generated
vendored
@@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.12
|
||||
// +build go1.12
|
||||
|
||||
package unitchecker
|
||||
|
||||
8
vendor/golang.org/x/tools/go/ast/astutil/rewrite.go
generated
vendored
8
vendor/golang.org/x/tools/go/ast/astutil/rewrite.go
generated
vendored
@@ -9,6 +9,8 @@ import (
|
||||
"go/ast"
|
||||
"reflect"
|
||||
"sort"
|
||||
|
||||
"golang.org/x/tools/internal/typeparams"
|
||||
)
|
||||
|
||||
// An ApplyFunc is invoked by Apply for each node n, even if n is nil,
|
||||
@@ -437,7 +439,11 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast.
|
||||
}
|
||||
|
||||
default:
|
||||
panic(fmt.Sprintf("Apply: unexpected node type %T", n))
|
||||
if typeparams.IsListExpr(n) {
|
||||
a.applyList(n, "ElemList")
|
||||
} else {
|
||||
panic(fmt.Sprintf("Apply: unexpected node type %T", n))
|
||||
}
|
||||
}
|
||||
|
||||
if a.post != nil && !a.post(&a.cursor) {
|
||||
|
||||
11
vendor/golang.org/x/tools/internal/typeparams/doc.go
generated
vendored
Normal file
11
vendor/golang.org/x/tools/internal/typeparams/doc.go
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright 2021 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 typeparams provides functions to work indirectly with type parameter
|
||||
// data stored in go/ast and go/types objects, while these API are guarded by a
|
||||
// build constraint.
|
||||
//
|
||||
// This package exists to make it easier for tools to work with generic code,
|
||||
// while also compiling against older Go versions.
|
||||
package typeparams
|
||||
90
vendor/golang.org/x/tools/internal/typeparams/notypeparams.go
generated
vendored
Normal file
90
vendor/golang.org/x/tools/internal/typeparams/notypeparams.go
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
// Copyright 2021 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.
|
||||
|
||||
//go:build !typeparams || !go1.17
|
||||
// +build !typeparams !go1.17
|
||||
|
||||
package typeparams
|
||||
|
||||
import (
|
||||
"go/ast"
|
||||
"go/types"
|
||||
)
|
||||
|
||||
// NOTE: doc comments must be kept in sync with typeparams.go.
|
||||
|
||||
// Enabled reports whether type parameters are enabled in the current build
|
||||
// environment.
|
||||
const Enabled = false
|
||||
|
||||
// UnpackIndex extracts all index expressions from e. For non-generic code this
|
||||
// is always one expression: e.Index, but may be more than one expression for
|
||||
// generic type instantiation.
|
||||
func UnpackIndex(e *ast.IndexExpr) []ast.Expr {
|
||||
return []ast.Expr{e.Index}
|
||||
}
|
||||
|
||||
// IsListExpr reports whether n is an *ast.ListExpr, which is a new node type
|
||||
// introduced to hold type arguments for generic type instantiation.
|
||||
func IsListExpr(n ast.Node) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// ForTypeDecl extracts the (possibly nil) type parameter node list from n.
|
||||
func ForTypeDecl(*ast.TypeSpec) *ast.FieldList {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ForFuncDecl extracts the (possibly nil) type parameter node list from n.
|
||||
func ForFuncDecl(*ast.FuncDecl) *ast.FieldList {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ForSignature extracts the (possibly empty) type parameter object list from
|
||||
// sig.
|
||||
func ForSignature(*types.Signature) []*types.TypeName {
|
||||
return nil
|
||||
}
|
||||
|
||||
// HasTypeSet reports if iface has a type set.
|
||||
func HasTypeSet(*types.Interface) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsComparable reports if iface is the comparable interface.
|
||||
func IsComparable(*types.Interface) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsConstraint reports whether iface may only be used as a type parameter
|
||||
// constraint (i.e. has a type set or is the comparable interface).
|
||||
func IsConstraint(*types.Interface) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// ForNamed extracts the (possibly empty) type parameter object list from
|
||||
// named.
|
||||
func ForNamed(*types.Named) []*types.TypeName {
|
||||
return nil
|
||||
}
|
||||
|
||||
// NamedTArgs extracts the (possibly empty) type argument list from named.
|
||||
func NamedTArgs(*types.Named) []types.Type {
|
||||
return nil
|
||||
}
|
||||
|
||||
// InitInferred initializes info to record inferred type information.
|
||||
func InitInferred(*types.Info) {
|
||||
}
|
||||
|
||||
// GetInferred extracts inferred type information from info for e.
|
||||
//
|
||||
// The expression e may have an inferred type if it is an *ast.IndexExpr
|
||||
// representing partial instantiation of a generic function type for which type
|
||||
// arguments have been inferred using constraint type inference, or if it is an
|
||||
// *ast.CallExpr for which type type arguments have be inferred using both
|
||||
// constraint type inference and function argument inference.
|
||||
func GetInferred(*types.Info, ast.Expr) ([]types.Type, *types.Signature) {
|
||||
return nil, nil
|
||||
}
|
||||
105
vendor/golang.org/x/tools/internal/typeparams/typeparams.go
generated
vendored
Normal file
105
vendor/golang.org/x/tools/internal/typeparams/typeparams.go
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
// Copyright 2021 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.
|
||||
|
||||
//go:build typeparams && go1.17
|
||||
// +build typeparams,go1.17
|
||||
|
||||
package typeparams
|
||||
|
||||
import (
|
||||
"go/ast"
|
||||
"go/types"
|
||||
)
|
||||
|
||||
// NOTE: doc comments must be kept in sync with notypeparams.go.
|
||||
|
||||
// Enabled reports whether type parameters are enabled in the current build
|
||||
// environment.
|
||||
const Enabled = true
|
||||
|
||||
// UnpackIndex extracts all index expressions from e. For non-generic code this
|
||||
// is always one expression: e.Index, but may be more than one expression for
|
||||
// generic type instantiation.
|
||||
func UnpackIndex(e *ast.IndexExpr) []ast.Expr {
|
||||
if x, _ := e.Index.(*ast.ListExpr); x != nil {
|
||||
return x.ElemList
|
||||
}
|
||||
if e.Index != nil {
|
||||
return []ast.Expr{e.Index}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsListExpr reports whether n is an *ast.ListExpr, which is a new node type
|
||||
// introduced to hold type arguments for generic type instantiation.
|
||||
func IsListExpr(n ast.Node) bool {
|
||||
_, ok := n.(*ast.ListExpr)
|
||||
return ok
|
||||
}
|
||||
|
||||
// ForTypeDecl extracts the (possibly nil) type parameter node list from n.
|
||||
func ForTypeDecl(n *ast.TypeSpec) *ast.FieldList {
|
||||
return n.TParams
|
||||
}
|
||||
|
||||
// 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 nil
|
||||
}
|
||||
|
||||
// ForSignature extracts the (possibly empty) type parameter object list from
|
||||
// sig.
|
||||
func ForSignature(sig *types.Signature) []*types.TypeName {
|
||||
return sig.TParams()
|
||||
}
|
||||
|
||||
// HasTypeSet reports if iface has a type set.
|
||||
func HasTypeSet(iface *types.Interface) bool {
|
||||
return iface.HasTypeList()
|
||||
}
|
||||
|
||||
// IsComparable reports if iface is the comparable interface.
|
||||
func IsComparable(iface *types.Interface) bool {
|
||||
return iface.IsComparable()
|
||||
}
|
||||
|
||||
// IsConstraint reports whether iface may only be used as a type parameter
|
||||
// constraint (i.e. has a type set or is the comparable interface).
|
||||
func IsConstraint(iface *types.Interface) bool {
|
||||
return iface.IsConstraint()
|
||||
}
|
||||
|
||||
// ForNamed extracts the (possibly empty) type parameter object list from
|
||||
// named.
|
||||
func ForNamed(named *types.Named) []*types.TypeName {
|
||||
return named.TParams()
|
||||
}
|
||||
|
||||
// NamedTArgs extracts the (possibly empty) type argument list from named.
|
||||
func NamedTArgs(named *types.Named) []types.Type {
|
||||
return named.TArgs()
|
||||
}
|
||||
|
||||
// InitInferred initializes info to record inferred type information.
|
||||
func InitInferred(info *types.Info) {
|
||||
info.Inferred = make(map[ast.Expr]types.Inferred)
|
||||
}
|
||||
|
||||
// GetInferred extracts inferred type information from info for e.
|
||||
//
|
||||
// The expression e may have an inferred type if it is an *ast.IndexExpr
|
||||
// representing partial instantiation of a generic function type for which type
|
||||
// arguments have been inferred using constraint type inference, or if it is an
|
||||
// *ast.CallExpr for which type type arguments have be inferred using both
|
||||
// constraint type inference and function argument inference.
|
||||
func GetInferred(info *types.Info, e ast.Expr) ([]types.Type, *types.Signature) {
|
||||
if info.Inferred == nil {
|
||||
return nil, nil
|
||||
}
|
||||
inf := info.Inferred[e]
|
||||
return inf.TArgs, inf.Sig
|
||||
}
|
||||
Reference in New Issue
Block a user