Debian Codegraph @

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

raw
1 This test exercises some renaming conflict scenarios
2 and ensures that the errors are informative.
3
4 -- settings.json --
5 {"analyses": {"unusedfunc": false}}
6
7 -- go.mod --
8 module example.com
9 go 1.12
10
11 -- super/p.go --
12 package super
13
14 var x int
15
16 func _(y int) {
17 println(x)
18 println(y) //@renameerr("y", "x", errSuperBlockConflict)
19 }
20
21 -- @errSuperBlockConflict --
22 super/p.go:5:8: renaming this var "y" to "x"
23 super/p.go:6:10: would shadow this reference
24 super/p.go:3:5: to the var declared here
25 -- sub/p.go --
26 package sub
27
28 var a int
29
30 func _(b int) {
31 println(a) //@renameerr("a", "b", errSubBlockConflict)
32 println(b)
33 }
34
35 -- @errSubBlockConflict --
36 sub/p.go:3:5: renaming this var "a" to "b"
37 sub/p.go:6:10: would cause this reference to become shadowed
38 sub/p.go:5:8: by this intervening var definition
39 -- pkgname/p.go --
40 package pkgname
41
42 import e1 "errors" //@renameerr("e1", "errors", errImportConflict)
43 import "errors"
44
45 var _ = errors.New
46 var _ = e1.New
47
48 -- @errImportConflict --
49 pkgname/p.go:3:8: renaming this imported package name "e1" to "errors"
50 pkgname/p.go:4:8: conflicts with imported package name in same block
51 -- pkgname2/p1.go --
52 package pkgname2
53 var x int
54
55 -- pkgname2/p2.go --
56 package pkgname2
57 import "errors" //@renameerr("errors", "x", errImportConflict2)
58 var _ = errors.New
59
60 -- @errImportConflict2 --
61 pkgname2/p2.go:2:8: renaming this imported package name "errors" to "x" would conflict
62 pkgname2/p1.go:2:5: with this package member var