aboutsummaryrefslogtreecommitdiff
path: root/gopls/internal/lsp/testdata/stub/stub_typedecl_group.go
blob: f82401fafddd74be982dd65a3770a97e9d088274 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package stub

// Regression test for Issue #56825: file corrupted by insertion of
// methods after TypeSpec in a parenthesized TypeDecl.

import "io"

func newReadCloser() io.ReadCloser {
	return rdcloser{} //@suggestedfix("rd", "refactor.rewrite", "")
}

type (
	A        int
	rdcloser struct{}
	B        int
)

func _() {
	// Local types can't be stubbed as there's nowhere to put the methods.
	// The suggestedfix assertion can't express this yet. TODO(adonovan): support it.
	type local struct{}
	var _ io.ReadCloser = local{} // want error: `local type "local" cannot be stubbed`
}

type (
	C int
)