Debian Codegraph @

gopls/internal/test/marker/testdata/hover/methods.txt

raw
1 This test checks the formatting of the list of accessible methods.
2
3 Observe that:
4 - interface methods that appear in the syntax are not repeated
5 in the method set of the type;
6 - promoted methods of structs are shown;
7 - receiver variables are correctly named;
8 - receiver variables have a pointer type if appropriate;
9 - only accessible methods are shown.
10
11 -- go.mod --
12 module example.com
13
14 -- lib/lib.go --
15 package lib
16
17 type I interface {
18 A()
19 b()
20 J
21 }
22
23 type J interface { C() }
24
25 type S struct { I }
26 func (s S) A() {}
27 func (s S) b() {}
28 func (s *S) PA() {}
29 func (s *S) pb() {}
30
31 var _ = (*S).pb
32
33 -- a/a.go --
34 package a
35
36 import "example.com/lib"
37
38 var _ lib.I //@hover("I", "I", I)
39 var _ lib.J //@hover("J", "J", J)
40 var _ lib.S //@hover("S", "S", S)
41
42 -- @I --
43 ```go
44 type I interface {
45 A()
46 b()
47 J
48 }
49 ```
50
51 ---
52
53 ```go
54 func (lib.J) C()
55 ```
56
57 ---
58
59 [`lib.I` on pkg.go.dev](https://pkg.go.dev/example.com/lib#I)
60 -- @J --
61 ```go
62 type J interface{ C() }
63 ```
64
65 ---
66
67 [`lib.J` on pkg.go.dev](https://pkg.go.dev/example.com/lib#J)
68 -- @S --
69 ```go
70 type S struct{ I }
71 ```
72
73 ---
74
75 ```go
76 func (s lib.S) A()
77 func (lib.J) C()
78 func (s *lib.S) PA()
79 ```
80
81 ---
82
83 [`lib.S` on pkg.go.dev](https://pkg.go.dev/example.com/lib#S)