diff options
Diffstat (limited to 'gopls/internal/lsp/testdata/stub/stub_typedecl_group.go')
-rw-r--r-- | gopls/internal/lsp/testdata/stub/stub_typedecl_group.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gopls/internal/lsp/testdata/stub/stub_typedecl_group.go b/gopls/internal/lsp/testdata/stub/stub_typedecl_group.go new file mode 100644 index 000000000..f82401faf --- /dev/null +++ b/gopls/internal/lsp/testdata/stub/stub_typedecl_group.go @@ -0,0 +1,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 +) |