3 // Tests of 'definition' query, -json output.
4 // See golang.org/x/tools/cmd/guru/guru_test.go for explanation.
5 // See main.golden for expected query results.
7 // TODO(adonovan): test: selection of member of same package defined in another file.
16 var _ int // @definition builtin "int"
18 var _ undef // @definition lexical-undef "undef"
19 var x lib.T // @definition lexical-pkgname "lib"
20 f() // @definition lexical-func "f"
21 print(x) // @definition lexical-var "x"
22 if x := ""; x == "" { // @definition lexical-shadowing "x"
25 var _ lib.Type // @definition qualified-type "Type"
26 var _ lib.Func // @definition qualified-func "Func"
27 var _ lib.Var // @definition qualified-var "Var"
28 var _ lib.Const // @definition qualified-const "Const"
29 var _ lib2.Type // @definition qualified-type-renaming "Type"
30 var _ lib.Nonesuch // @definition qualified-nomember "Nonesuch"
31 var _ nosuchpkg.T // @definition qualified-nopkg "nosuchpkg"
34 print(u.field) // @definition select-field "field"
35 u.method() // @definition select-method "method"
40 type T struct{ field int }
47 W // @definition embedded-other-file "W"
51 *W // @definition embedded-other-file-pointer "W"
55 int // @definition embedded-basic "int"
59 *int // @definition embedded-basic-pointer "int"
63 lib.Type // @definition embedded-other-pkg "Type"
67 T // @definition embedded-same-file "T"