gotools/gopls/internal/test/marker/testdata/completion/deep2.txt

This test exercises deep completion.

It was originally bundled with deep.go, but is split into a separate test as
the new marker tests do not permit mutating server options for individual
marks.

-- flags --
-ignore_extra_diags

-- go.mod --
module golang.org/lsptests

go 1.18

-- deep/deep2.go --
package deep

type foo struct {
	b bar
}

func (f foo) bar() bar {
	return f.b
}

func (f foo) barPtr() *bar {
	return &f.b
}

type bar struct{}

func (b bar) valueReceiver() int {
	return 0
}

func (b *bar) ptrReceiver() int {
	return 0
}

func _() {
	var (
		i int
		f foo
	)

	f.bar().valueReceiver    //@item(deepBarValue, "f.bar().valueReceiver", "func() int", "method")
	f.barPtr().ptrReceiver   //@item(deepBarPtrPtr, "f.barPtr().ptrReceiver", "func() int", "method")
	f.barPtr().valueReceiver //@item(deepBarPtrValue, "f.barPtr().valueReceiver", "func() int", "method")

	i = fbar //@complete(" //", deepBarValue, deepBarPtrPtr, deepBarPtrValue)
}

func (b baz) Thing() struct{ val int } {
	return b.thing
}

type baz struct {
	thing struct{ val int }
}

func (b baz) _() {
	b.Thing().val    //@item(deepBazMethVal, "b.Thing().val", "int", "field")
	b.thing.val      //@item(deepBazFieldVal, "b.thing.val", "int", "field")
	var _ int = bval //@rank(" //", deepBazFieldVal, deepBazMethVal)
}