Debian Codegraph @

gopls/internal/test/marker/testdata/quickfix/stubmethods/shadowedmethods.txt

raw
1 This test exercises verifies that the stubmethods quickfix does not shadow existing methods.
2 See golang/go#77130.
3
4 -- go.mod --
5 module mod.com
6
7 go 1.22
8
9 -- main.go --
10 package main
11
12 type I interface {
13 Foo()
14 Bar()
15 }
16
17 type B struct {
18 *A
19 }
20
21 type A struct {
22 }
23
24 func (a *A) Foo() {
25 }
26
27 // Interface I requires implementing Foo() and Bar(). B embeds A, and A already
28 // implements Foo. To avoid method shadowing, the stub for B should only
29 // implement Bar and not Foo.
30 var _ I = (*B)(nil) //@quickfix(re"..B..nil.", re"missing method", stub)
31
32 -- @stub/main.go --
33 @@ -12 +12,5 @@
34 +// Bar implements [I].
35 +func (b *B) Bar() {
36 + panic("unimplemented")
37 +}
38 +
39 @@ -22 +27 @@
40 -