Change information
Commit message:
gopls/internal/golang/stubmethods: support generic interfaces
This CL fixes a bug in the "implement missing method" code action
when the interface is generic: previously, it would insert free
type parameters into the concrete method declarations, instead
of using their instantiations from the LHS of the failing
var I = C(...) assignment.
Also, reject attemps to implement interface types that have free
type parameters, either because they are generic, or because
they are local to a generic function and reference its type
parameters.
+ test
How should the interactive "implement interface" refactoring
work when the interface is generic? Should it prompt for a
type for each type argument? Currently it will reject it.
Also, flip incorrect got/want in marker test error message.
Fixes golang/go#79845
Change-Id: I9164c0fbb2a9255cf7068fcb221d4919d0a527d9
Files:
- M gopls/internal/golang/codeaction.go
- M gopls/internal/golang/implement_interface.go
- M gopls/internal/golang/stubmethods/stubmethods.go
- M gopls/internal/test/marker/marker_test.go
- A gopls/internal/test/marker/testdata/quickfix/stubmethods/anoniface.txt
- A gopls/internal/test/marker/testdata/quickfix/stubmethods/issue79845.txt
- A gopls/internal/test/marker/testdata/quickfix/stubmethods/localiface.txt
Change size: M
Delta: 7 files changed, 137 insertions(+), 83 deletions(-)
Branch: refs/heads/master