Debian Codegraph @

gopls/internal/test/marker/testdata/references/issue60676.txt

raw
1 This test verifies that even after importing from export data, the references
2 algorithm is able to find all references to struct fields or methods that are
3 shared by types from multiple packages. See golang/go#60676.
4
5 Note that the marker test runner awaits the initial workspace load, so export
6 data should be populated at the time references are requested.
7
8 -- go.mod --
9 module mod.test
10
11 go 1.18
12
13 -- a/a.go --
14 package a
15
16 type A struct {
17 F int //@loc(FDef, "F")
18 E //@loc(EDef, "E")
19 }
20
21 type E struct {
22 G string //@loc(GDef, "G")
23 }
24
25 type AI interface {
26 M() //@loc(MDef, "M")
27 EI
28 error
29 }
30
31 type EI interface {
32 N() //@loc(NDef, "N")
33 }
34
35 type T[P any] struct{ f P }
36
37 type Error error
38
39
40 -- b/b.go --
41 package b
42
43 import "mod.test/a"
44
45 type B a.A
46
47 type BI a.AI
48
49 type T a.T[int] // must not panic
50
51 -- c/c.go --
52 package c
53
54 import "mod.test/b"
55
56 func _() {
57 x := b.B{
58 F: 42, //@refs("F", FDef, "F", Fuse)
59 }
60 x.G = "hi" //@refs("G", GDef, "G")
61 _ = x.E //@refs("E", EDef, "E")
62 _ = x.F //@loc(Fuse, "F")
63 }
64
65 func _(y b.BI) {
66 _ = y.M //@refs("M", MDef, "M")
67 _ = y.N //@refs("N", NDef, "N")
68 }