Change information
Commit message:
gopls/internal/analysis/ptrtoerror: support type assert and instances
The previous CL missed two important cases where syntax implies
an implements relation between E (or *E) and the error interface:
1. Type assertions and type switches
err.(E)
switch err.(type) { case E: }
2. Instantiatio of type parameters
errors.AsType[E](err)
This change augments the 'conversions' iterator to return them too,
and adds tests for the missing cases.
Updates golang/go#61342
Updates golang/go#70638
Updates golang/go#80159
Change-Id: I7612aa0a9e38079ef4dec1b8eabff458e74ea81b
Files:
- M gopls/internal/analysis/ptrtoerror/conv.go
- M gopls/internal/analysis/ptrtoerror/ptrtoerror_test.go
- A gopls/internal/analysis/ptrtoerror/testdata/src/c/c.go
- A gopls/internal/analysis/ptrtoerror/testdata/src/c/c.go.golden
- A gopls/internal/analysis/ptrtoerror/testdata/src/d/d.go
- A gopls/internal/analysis/ptrtoerror/testdata/src/errors/errors.go
Change size: M
Delta: 6 files changed, 202 insertions(+), 1 deletion(-)
Branch: refs/heads/master