4 func wantsVariadicPtr(...*int) {}
6 func wantsVariadic(...int) {}
8 type foo struct{ c int } //@item(addrFieldC, "c", "int", "field")
12 a string //@item(addrA, "a", "string", "var")
13 b int //@item(addrB, "b", "int", "var")
16 &b //@item(addrBRef, "&b", "int", "var")
18 wantsPtr() //@rank(")", addrBRef, addrA),snippet(")", addrBRef, "&b", "&b")
19 wantsPtr(&b) //@snippet(")", addrB, "b", "b")
21 wantsVariadicPtr() //@rank(")", addrBRef, addrA),snippet(")", addrBRef, "&b", "&b")
24 s.c //@item(addrDeepC, "s.c", "int", "field")
25 &s.c //@item(addrDeepCRef, "&s.c", "int", "field")
26 wantsPtr() //@snippet(")", addrDeepCRef, "&s.c", "&s.c")
27 wantsPtr(s) //@snippet(")", addrDeepCRef, "&s.c", "&s.c")
28 wantsPtr(&s) //@snippet(")", addrDeepC, "s.c", "s.c")
30 // don't add "&" in item (it gets added as an additional edit)
31 wantsPtr(&s.c) //@snippet(")", addrFieldC, "c", "c")
33 // check dereferencing as well
35 *c //@item(addrCPtr, "*c", "*int", "var")
36 var _ int = _ //@rank("_ //", addrCPtr, addrA),snippet("_ //", addrCPtr, "*c", "*c")
38 wantsVariadic() //@rank(")", addrCPtr, addrA),snippet(")", addrCPtr, "*c", "*c")
41 **d //@item(addrDPtr, "**d", "**int", "var")
42 var _ int = _ //@rank("_ //", addrDPtr, addrA),snippet("_ //", addrDPtr, "**d", "**d")
46 *np //@item(addrNamedPtr, "*np", "namedPtr", "var")
47 var _ int = _ //@rank("_ //", addrNamedPtr, addrA)
49 // don't get tripped up by recursive pointer type
50 type dontMessUp *dontMessUp
51 var dmu *dontMessUp //@item(addrDMU, "dmu", "*dontMessUp", "var")
53 var _ int = dmu //@complete(" //", addrDMU)
56 func (f foo) ptr() *foo { return &f }
59 getFoo := func() foo { return foo{} }
62 getFoo().c //@item(addrGetFooC, "getFoo().c", "int", "field")
65 getFoo().ptr().c //@item(addrGetFooPtrC, "getFoo().ptr().c", "int", "field")
66 &getFoo().ptr().c //@item(addrGetFooPtrCRef, "&getFoo().ptr().c", "int", "field")
68 wantsPtr() //@rank(addrGetFooPtrCRef, addrGetFooC),snippet(")", addrGetFooPtrCRef, "&getFoo().ptr().c", "&getFoo().ptr().c")
69 wantsPtr(&g) //@rank(addrGetFooPtrC, addrGetFooC),snippet(")", addrGetFooPtrC, "getFoo().ptr().c", "getFoo().ptr().c")
77 getNested := func() nested { return nested{} }
79 getNested().f.c //@item(addrNestedC, "getNested().f.c", "int", "field")
80 &getNested().f.ptr().c //@item(addrNestedPtrC, "&getNested().f.ptr().c", "int", "field")
82 // addrNestedC is not addressable, so rank lower
83 wantsPtr(getNestedfc) //@fuzzy(")", addrNestedPtrC, addrNestedC)