golang.org/x/tools@v0.21.1-0.20240520172518-788d39e776b1/go/callgraph/vta/testdata/src/arrays_generics.go (about) 1 // Copyright 2023 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // go:build ignore 6 7 package testdata 8 9 type F func() 10 11 func set[T [1]F | [2]F](arr *T, i int) { 12 // Indexes into a pointer to an indexable type T and T does not have a coretype. 13 // SSA instruction: t0 = &arr[i] 14 (*arr)[i] = bar 15 } 16 17 func bar() { 18 print("here") 19 } 20 21 func Foo() { 22 var arr [1]F 23 set(&arr, 0) 24 arr[0]() 25 } 26 27 // WANT: 28 // Foo: set[[1]testdata.F](t0, 0:int) -> set[[1]testdata.F]; t3() -> bar