-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/lsp/analysis/stubmethods: recognize *ast.CallExpr
This change makes it so that the stub methods analysis can recognize errors happening to method and function call expressions that are being passed a concrete type to an interface parameter. This way, a method stub CodeAction will appear at the call site. Updates golang/go#37537 Change-Id: I886d53f06a85b9e5160d882aa742bb2b7fcea139 Reviewed-on: https://go-review.googlesource.com/c/tools/+/404655 gopls-CI: kokoro <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Robert Findley <[email protected]> Reviewed-by: Suzy Mueller <[email protected]> Run-TryBot: Suzy Mueller <[email protected]>
- Loading branch information
1 parent
facb0d3
commit 13bcb69
Showing
5 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package stub | ||
|
||
func main() { | ||
check(&callExpr{}) //@suggestedfix("&", "refactor.rewrite") | ||
} | ||
|
||
func check(err error) { | ||
if err != nil { | ||
panic(err) | ||
} | ||
} | ||
|
||
type callExpr struct{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- suggestedfix_stub_call_expr_4_8 -- | ||
package stub | ||
|
||
func main() { | ||
check(&callExpr{}) //@suggestedfix("&", "refactor.rewrite") | ||
} | ||
|
||
func check(err error) { | ||
if err != nil { | ||
panic(err) | ||
} | ||
} | ||
|
||
type callExpr struct{} | ||
|
||
// Error implements error | ||
func (*callExpr) Error() string { | ||
panic("unimplemented") | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters