Debian Codegraph @

gopls/internal/test/marker/testdata/rename/issue42301.txt

raw
1 This test verifies the fix for golang/go#42301: renaming an ident inside its doc
2 comment should also rename the ident.
3
4 -- go.mod --
5 module example.com
6
7 go 1.21
8 -- a/a.go --
9 package a
10
11 // Foo doesn't do anything, Foo is just an empty function. //@rename(re"()Foo", "Bar", fooToBar), renameerr(re"()anything", "Bar", "no identifier found")
12 func Foo() {}
13
14 func _() {
15 Foo()
16 }
17
18 -- b/b.go --
19 package b
20
21 import "example.com/a"
22
23 func _() {
24 a.Foo()
25 }
26
27 -- c/c.go --
28 package c
29
30 // A is an empty struct. //@rename(re"()A", "B", aToB)
31 type A struct {}
32
33 -- d/d.go --
34 package d
35
36 // Bar doesn't do anything, Bar is just an empty function. //@rename(re", ()Bar", "Foo", barToFoo)
37 func Bar() {}
38
39 -- @aToB/c/c.go --
40 @@ -3,2 +3,2 @@
41 -// A is an empty struct. //@rename(re"()A", "B", aToB)
42 -type A struct {}
43 +// B is an empty struct. //@rename(re"()B", "B", aToB)
44 +type B struct {}
45 -- @barToFoo/d/d.go --
46 @@ -3,2 +3,2 @@
47 -// Bar doesn't do anything, Bar is just an empty function. //@rename(re", ()Bar", "Foo", barToFoo)
48 -func Bar() {}
49 +// Foo doesn't do anything, Foo is just an empty function. //@rename(re", ()Foo", "Foo", barToFoo)
50 +func Foo() {}
51 -- @fooToBar/a/a.go --
52 @@ -3,2 +3,2 @@
53 -// Foo doesn't do anything, Foo is just an empty function. //@rename(re"()Foo", "Bar", fooToBar), renameerr(re"()anything", "Bar", "no identifier found")
54 -func Foo() {}
55 +// Bar doesn't do anything, Bar is just an empty function. //@rename(re"()Bar", "Bar", fooToBar), renameerr(re"()anything", "Bar", "no identifier found")
56 +func Bar() {}
57 @@ -7 +7 @@
58 - Foo()
59 + Bar()
60 -- @fooToBar/b/b.go --
61 @@ -6 +6 @@
62 - a.Foo()
63 + a.Bar()