]> Cypherpunks repositories - gostls13.git/commit
go/types: improve errors for method calls with pointer receivers
authorRebecca Stambler <rstambler@golang.org>
Mon, 27 Apr 2020 23:41:14 +0000 (19:41 -0400)
committerRebecca Stambler <rstambler@golang.org>
Tue, 28 Apr 2020 01:38:32 +0000 (01:38 +0000)
commit5c22c01d450c2da859644d2c020b75860308bf71
tree531ceb3770f40452e132f4beaef52a79831733f0
parent7be3f09deb2dc1d57cfc18b18e12192be3544794
go/types: improve errors for method calls with pointer receivers

The compiler has better error messages for methods called without a
pointer receiver when one is expected. This change is similar to
CL 229801, but for method calls.

Also, added better error messages for functions called with the wrong
capitalization. I left the third TODO in this switch statement almost
as-is because I'm not sure that the extra complexity is worth it -
I adjusted the error to look like the one the compiler reports.

Fixes golang/go#38658

Change-Id: Ie0ca2503e12f3659f112f0135cc27db1b027fdcb
Reviewed-on: https://go-review.googlesource.com/c/go/+/230380
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/call.go
src/go/types/testdata/decls3.src
src/go/types/testdata/decls4.src
src/go/types/testdata/expr3.src
src/go/types/testdata/issue28251.src
src/go/types/testdata/issues.src
src/go/types/testdata/methodsets.src