GoPLS Viewer

Home|gopls/go/callgraph/vta/testdata/src/go117.go
1// Copyright 2021 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
7package testdata
8
9type J interface {
10    Foo()
11    Bar()
12}
13
14type B struct {
15    p int
16}
17
18func (b BFoo() {}
19func (b BBar() {}
20
21func Wobble(b *Bs []J) {
22    x := (*[3]J)(s)
23    x[1] = b
24
25    a := &s[2]
26    (*a).Bar()
27}
28
29// Relevant SSA:
30// func Wobble(b *B, s []J):
31//   t0 = slice to array pointer *[3]J <- []J (s)                      *[3]J
32//   t1 = &t0[1:int]                                                      *J
33//   t2 = make J <- *B (b)                                                 J
34//   *t1 = t2
35//   t3 = &s[2:int]                                                       *J
36//   ...
37
38// WANT:
39// Local(t1) -> Slice([]testdata.J)
40// Slice([]testdata.J) -> Local(t1), Local(t3)
41
MembersX
Wobble.b
Wobble.s
Wobble.x
B.p
B.Bar.b
B.Bar
Wobble
Members
X