diff options
author | Tim King <taking@google.com> | 2022-03-06 14:32:59 -0800 |
---|---|---|
committer | Tim King <taking@google.com> | 2022-03-09 22:54:42 +0000 |
commit | fd72fd66f6942eba57acf68b91749da38ff16e9b (patch) | |
tree | 5bcc14d9ea6c68c6803a999fe642dea99c58bf3d /go/ssa/interp/testdata/src/reflect/reflect.go | |
parent | b105aac5705e64187ac8851a26636693404b0ec4 (diff) | |
download | golang-x-tools-fd72fd66f6942eba57acf68b91749da38ff16e9b.tar.gz |
go/ssa/interp: adding external functions for tests
Adding additional external functions to be available for go/ssa/interp's testdata.
These functions are used by main files in $GOROOT/test/typeparams/*.go
Updates golang/go#48525
Change-Id: I80b280e2efb4616d24b50ccf3d2aefa7b486a893
Reviewed-on: https://go-review.googlesource.com/c/tools/+/390294
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Tim King <taking@google.com>
Diffstat (limited to 'go/ssa/interp/testdata/src/reflect/reflect.go')
-rw-r--r-- | go/ssa/interp/testdata/src/reflect/reflect.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/go/ssa/interp/testdata/src/reflect/reflect.go b/go/ssa/interp/testdata/src/reflect/reflect.go index f6c4e2794..8a23d272f 100644 --- a/go/ssa/interp/testdata/src/reflect/reflect.go +++ b/go/ssa/interp/testdata/src/reflect/reflect.go @@ -2,6 +2,8 @@ package reflect type Type interface { String() string + Kind() Kind + Elem() Type } type Value struct { @@ -9,8 +11,47 @@ type Value struct { func (Value) String() string +func (Value) Elem() string +func (Value) Kind() Kind +func (Value) Int() int64 + func SliceOf(Type) Type func TypeOf(interface{}) Type func ValueOf(interface{}) Value + +type Kind uint + +// Constants need to be kept in sync with the actual definitions for comparisons in tests. +const ( + Invalid Kind = iota + Bool + Int + Int8 + Int16 + Int32 + Int64 + Uint + Uint8 + Uint16 + Uint32 + Uint64 + Uintptr + Float32 + Float64 + Complex64 + Complex128 + Array + Chan + Func + Interface + Map + Pointer + Slice + String + Struct + UnsafePointer +) + +const Ptr = Pointer |