1
0
mirror of https://github.com/golang/go synced 2024-11-19 07:54:43 -07:00
go/internal/lsp/testdata/godef/b/b.go.golden
Suzy Mueller b76e30ffa0 internal/lsp: fix references for type switch vars
Implicit local variables for type switches do not appear in the Uses
map and do not have objects associated with them.  This change
associates all of the different types objects for the same local type
switch declaration with one another in the declaration.

The identifier for the implicit local variable does not have a type but
does have declaration objects.

Find references for type switch vars will return references to all the
identifiers in all of the case clauses and the declaration.

Fixes golang/go#32584

Change-Id: I5563a2a48d31ca615c1e4e73b46eabca0f5dd72a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/182462
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-06-19 18:18:01 +00:00

251 lines
4.2 KiB
Plaintext

-- A-definition --
godef/a/a.go:7:6-7: defined here as A string //@A
-- A-definition-json --
{
"span": {
"uri": "file://godef/a/a.go",
"start": {
"line": 7,
"column": 6,
"offset": 75
},
"end": {
"line": 7,
"column": 7,
"offset": 76
}
},
"description": "A string //@A"
}
-- A-hover --
A string //@A
-- AImport-definition --
godef/b/b.go:5:2: defined here as package a ("golang.org/x/tools/internal/lsp/godef/a")
-- AImport-definition-json --
{
"span": {
"uri": "file://godef/b/b.go",
"start": {
"line": 5,
"column": 2,
"offset": 121
},
"end": {
"line": 5,
"column": 2,
"offset": 121
}
},
"description": "package a (\"golang.org/x/tools/internal/lsp/godef/a\")"
}
-- AImport-hover --
package a ("golang.org/x/tools/internal/lsp/godef/a")
-- PackageFoo-definition --
foo/foo.go:1:9-12: defined here as
-- PackageFoo-definition-json --
{
"span": {
"uri": "file://foo/foo.go",
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 1,
"column": 12,
"offset": 11
}
},
"description": ""
}
-- PackageFoo-hover --
-- S1-definition --
godef/b/b.go:8:6-8: defined here as S1 struct {
F1 int //@mark(S1F1, "F1")
S2 //@godef("S2", S2), mark(S1S2, "S2")
a.A //@godef("A", A)
}
-- S1-definition-json --
{
"span": {
"uri": "file://godef/b/b.go",
"start": {
"line": 8,
"column": 6,
"offset": 196
},
"end": {
"line": 8,
"column": 8,
"offset": 198
}
},
"description": "S1 struct {\n\tF1 int //@mark(S1F1, \"F1\")\n\tS2 //@godef(\"S2\", S2), mark(S1S2, \"S2\")\n\ta.A //@godef(\"A\", A)\n}"
}
-- S1-hover --
S1 struct {
F1 int //@mark(S1F1, "F1")
S2 //@godef("S2", S2), mark(S1S2, "S2")
a.A //@godef("A", A)
}
-- S1F1-definition --
godef/b/b.go:9:2-4: defined here as field F1 int
-- S1F1-definition-json --
{
"span": {
"uri": "file://godef/b/b.go",
"start": {
"line": 9,
"column": 2,
"offset": 215
},
"end": {
"line": 9,
"column": 4,
"offset": 217
}
},
"description": "field F1 int"
}
-- S1F1-hover --
@mark(S1F1, "F1")
field F1 int
-- S1S2-definition --
godef/b/b.go:10:2-4: defined here as field S2 S2
-- S1S2-definition-json --
{
"span": {
"uri": "file://godef/b/b.go",
"start": {
"line": 10,
"column": 2,
"offset": 244
},
"end": {
"line": 10,
"column": 4,
"offset": 246
}
},
"description": "field S2 S2"
}
-- S1S2-hover --
@godef("S2", S2), mark(S1S2, "S2")
field S2 S2
-- S2-definition --
godef/b/b.go:14:6-8: defined here as S2 struct {
F1 string //@mark(S2F1, "F1")
F2 int //@mark(S2F2, "F2")
*a.A //@godef("A", A),godef("a",AImport)
}
-- S2-definition-json --
{
"span": {
"uri": "file://godef/b/b.go",
"start": {
"line": 14,
"column": 6,
"offset": 323
},
"end": {
"line": 14,
"column": 8,
"offset": 325
}
},
"description": "S2 struct {\n\tF1 string //@mark(S2F1, \"F1\")\n\tF2 int //@mark(S2F2, \"F2\")\n\t*a.A //@godef(\"A\", A),godef(\"a\",AImport)\n}"
}
-- S2-hover --
S2 struct {
F1 string //@mark(S2F1, "F1")
F2 int //@mark(S2F2, "F2")
*a.A //@godef("A", A),godef("a",AImport)
}
-- S2F1-definition --
godef/b/b.go:15:2-4: defined here as field F1 string
-- S2F1-definition-json --
{
"span": {
"uri": "file://godef/b/b.go",
"start": {
"line": 15,
"column": 2,
"offset": 342
},
"end": {
"line": 15,
"column": 4,
"offset": 344
}
},
"description": "field F1 string"
}
-- S2F1-hover --
@mark(S2F1, "F1")
field F1 string
-- S2F2-definition --
godef/b/b.go:16:2-4: defined here as field F2 int
-- S2F2-definition-json --
{
"span": {
"uri": "file://godef/b/b.go",
"start": {
"line": 16,
"column": 2,
"offset": 375
},
"end": {
"line": 16,
"column": 4,
"offset": 377
}
},
"description": "field F2 int"
}
-- S2F2-hover --
@mark(S2F2, "F2")
field F2 int
-- Stuff-definition --
godef/a/a.go:9:6-11: defined here as func a.Stuff()
-- Stuff-definition-json --
{
"span": {
"uri": "file://godef/a/a.go",
"start": {
"line": 9,
"column": 6,
"offset": 95
},
"end": {
"line": 9,
"column": 11,
"offset": 100
}
},
"description": "func a.Stuff()"
}
-- Stuff-hover --
func a.Stuff()