diff options
| author | Matthew Dempsky <mdempsky@google.com> | 2021-05-04 15:07:37 -0700 |
|---|---|---|
| committer | Matthew Dempsky <mdempsky@google.com> | 2021-05-04 23:14:32 +0000 |
| commit | cb0658e624e33ca3e96036dbdd48b1282acb189d (patch) | |
| tree | a100b4122d4b7adf6ef210cf96c22ac5b985306c /src | |
| parent | 62a87f64b97d27e79d53a84e9006425aa234d7e6 (diff) | |
| download | go-cb0658e624e33ca3e96036dbdd48b1282acb189d.tar.xz | |
go/types: expose more API under -tags=typeparams
Updates #44933.
Change-Id: I0c4c2a54f67b47771f4fa59f11c47fa7b0dde799
Reviewed-on: https://go-review.googlesource.com/c/go/+/317029
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/go/types/api_typeparams.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/go/types/api_typeparams.go b/src/go/types/api_typeparams.go index 108e526fbf..639bc3b3bf 100644 --- a/src/go/types/api_typeparams.go +++ b/src/go/types/api_typeparams.go @@ -11,7 +11,11 @@ import ( "go/ast" ) -type Inferred = _Inferred +type ( + Inferred = _Inferred + Sum = _Sum + TypeParam = _TypeParam +) func GetInferred(info *Info) map[ast.Expr]Inferred { return info._Inferred @@ -20,3 +24,16 @@ func GetInferred(info *Info) map[ast.Expr]Inferred { func SetInferred(info *Info, inferred map[ast.Expr]Inferred) { info._Inferred = inferred } + +func NewSum(types []Type) Type { return _NewSum(types) } + +func (s *Signature) TParams() []*TypeName { return s._TParams() } +func (s *Signature) SetTParams(tparams []*TypeName) { s._SetTParams(tparams) } + +func (t *Interface) HasTypeList() bool { return t._HasTypeList() } +func (t *Interface) IsComparable() bool { return t._IsComparable() } +func (t *Interface) IsConstraint() bool { return t._IsConstraint() } + +func (t *Named) TParams() []*TypeName { return t._TParams() } +func (t *Named) TArgs() []Type { return t._TArgs() } +func (t *Named) SetTArgs(args []Type) { t._SetTArgs(args) } |
