Debian Codegraph @

gopls/internal/test/marker/testdata/implementation/basic.txt

raw
1 Basic test of implementation query.
2
3 -- go.mod --
4 module example.com
5 go 1.18
6
7 -- implementation/implementation.go --
8 package implementation
9
10 import "example.com/other"
11
12 type ImpP struct{} //@loc(ImpP, "ImpP"),implementation("ImpP", Laugher, OtherLaugher)
13
14 func (*ImpP) Laugh() { //@loc(LaughP, "Laugh"),implementation("Laugh", Laugh, OtherLaugh)
15 }
16
17 type ImpS struct{} //@loc(ImpS, "ImpS"),implementation("ImpS", Laugher, OtherLaugher)
18
19 func (ImpS) Laugh() { //@loc(LaughS, "Laugh"),implementation("Laugh", Laugh, OtherLaugh)
20 }
21
22 type Laugher interface { //@loc(Laugher, "Laugher"),implementation("Laugher", ImpP, OtherImpP, ImpS, OtherLaugher, OtherImpS, EmbedsImpP)
23 Laugh() //@loc(Laugh, "Laugh"),implementation("Laugh", LaughP, OtherLaughP, LaughS, OtherLaugh, OtherLaughS)
24 }
25
26 type Foo struct { //@implementation("Foo", Joker)
27 other.Foo
28 }
29
30 type Joker interface { //@loc(Joker, "Joker")
31 Joke() //@loc(Joke, "Joke"),implementation("Joke", ImpJoker)
32 }
33
34 type cryer int //@implementation("cryer", Cryer)
35
36 func (cryer) Cry(other.CryType) {} //@loc(CryImpl, "Cry"),implementation("Cry", Cry)
37
38 type Empty any //@implementation("Empty")
39
40 var _ interface{ Joke() } //@implementation("Joke", Joke, ImpJoker)
41
42 type EmbedsImpP struct { //@loc(EmbedsImpP, "EmbedsImpP")
43 ImpP //@implementation("ImpP", Laugher, OtherLaugher)
44 }
45
46 var _ error //@defloc(StdError, "error")
47
48 type MyError struct {} //@implementation("MyError", StdError)
49
50 func (MyError) Error() string { return "bah" }
51
52 -- other/other.go --
53 package other
54
55 type ImpP struct{} //@loc(OtherImpP, "ImpP")
56
57 func (*ImpP) Laugh() { //@loc(OtherLaughP, "Laugh")
58 }
59
60 type ImpS struct{} //@loc(OtherImpS, "ImpS")
61
62 func (ImpS) Laugh() { //@loc(OtherLaughS, "Laugh")
63 }
64
65 type ImpI interface { //@loc(OtherLaugher, "ImpI")
66 Laugh() //@loc(OtherLaugh, "Laugh")
67 }
68
69 type Foo struct { //@implementation("Foo", Joker)
70 }
71
72 func (Foo) Joke() { //@loc(ImpJoker, "Joke"),implementation("Joke", Joke)
73 }
74
75 type CryType int
76
77 type Cryer interface { //@loc(Cryer, "Cryer")
78 Cry(CryType) //@loc(Cry, "Cry"),implementation("Cry", CryImpl)
79 }