diff options
author | Dan Scales <danscales@google.com> | 2021-05-09 11:38:34 -0700 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-05-21 17:03:30 +0000 |
commit | ccbfbb1c3327fffe88dd6b6da550f4a0cd37db6e (patch) | |
tree | e54eac11914c8444e78acaa5e9f941ce9f3bfdc2 /test/typeparam/index.go | |
parent | 243076da64d251853ed7a69ce770e9fa71b5bf0d (diff) | |
download | go-ccbfbb1c3327fffe88dd6b6da550f4a0cd37db6e.tar.gz go-ccbfbb1c3327fffe88dd6b6da550f4a0cd37db6e.zip |
[dev.typeparams] cmd/compile: export OFUNCINST and OSELRECV2 nodes (for generic functions)
Added new test typeparam/factimp.go and changed a bunch of other tests
to test exporting more generic functions and types.
Change-Id: I573d75431cc92482f8f908695cfbc8e84dbb36d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/321749
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/typeparam/index.go')
-rw-r--r-- | test/typeparam/index.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/typeparam/index.go b/test/typeparam/index.go index 83e65acdd0..cb9b2613c3 100644 --- a/test/typeparam/index.go +++ b/test/typeparam/index.go @@ -11,7 +11,7 @@ import ( ) // Index returns the index of x in s, or -1 if not found. -func index[T comparable](s []T, x T) int { +func Index[T comparable](s []T, x T) int { for i, v := range s { // v and x are type T, which has the comparable // constraint, so we can use == here. @@ -30,17 +30,17 @@ func main() { want := 2 vec1 := []string{"ab", "cd", "ef"} - if got := index(vec1, "ef"); got != want { + if got := Index(vec1, "ef"); got != want { panic(fmt.Sprintf("got %d, want %d", got, want)) } vec2 := []byte{'c', '6', '@'} - if got := index(vec2, '@'); got != want { + if got := Index(vec2, '@'); got != want { panic(fmt.Sprintf("got %d, want %d", got, want)) } vec3 := []*obj{&obj{2}, &obj{42}, &obj{1}} - if got := index(vec3, vec3[2]); got != want { + if got := Index(vec3, vec3[2]); got != want { panic(fmt.Sprintf("got %d, want %d", got, want)) } } |