aboutsummaryrefslogtreecommitdiff
path: root/test/alias2.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2018-04-04 18:42:39 -0700
committerMatthew Dempsky <mdempsky@google.com>2018-04-05 22:01:17 +0000
commit638f112d6982e83132051ccb4f0b27684b9c0f34 (patch)
treedfd714cb183b8df6834ca70f1d1856cbfb9258c3 /test/alias2.go
parent2e7e57770c71109cc036478c656309c41ddee143 (diff)
downloadgo-638f112d6982e83132051ccb4f0b27684b9c0f34.tar.gz
go-638f112d6982e83132051ccb4f0b27684b9c0f34.zip
cmd/compile: cleanup method symbol creation
There were multiple ad hoc ways to create method symbols, with subtle and confusing differences between them. This CL unifies them into a single well-documented encoding and implementation. This introduces some inconsequential changes to symbol format for the sake of simplicity and consistency. Two notable changes: 1) Symbol construction is now insensitive to the package currently being compiled. Previously, non-exported methods on anonymous types received different method symbols depending on whether the method was local or imported. 2) Symbols for method values parenthesized non-pointer receiver types and non-exported method names, and also always package-qualified non-exported method names. Now they use the same rules as normal method symbols. The methodSym function is also now stricter about rejecting non-sensical method/receiver combinations. Notably, this means that typecheckfunc needs to call addmethod to validate the method before calling declare, which also means we no longer emit errors about redeclaring bogus methods. Change-Id: I9501c7a53dd70ef60e5c74603974e5ecc06e2003 Reviewed-on: https://go-review.googlesource.com/104876 Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'test/alias2.go')
-rw-r--r--test/alias2.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/alias2.go b/test/alias2.go
index 32c3654995..7ea1b2908d 100644
--- a/test/alias2.go
+++ b/test/alias2.go
@@ -95,10 +95,10 @@ type _ = reflect.ValueOf // ERROR "reflect.ValueOf is not a type|expected type"
func (A1) m() {} // ERROR "cannot define new methods on non-local type int|may not define methods on non-local type"
func (A2) m() {} // ERROR "invalid receiver type"
func (A3) m() {} // ERROR "cannot define new methods on non-local type reflect.Value|may not define methods on non-local type"
-func (A4) m() {} // ERROR "reflect.Value.m redeclared in this block" "cannot define new methods on non-local type reflect.Value|may not define methods on non-local type"
+func (A4) m() {} // ERROR "cannot define new methods on non-local type reflect.Value|may not define methods on non-local type"
type B1 = struct{}
-func (B1) m() {} // ERROR "m redeclared in this block" "invalid receiver type"
+func (B1) m() {} // ERROR "invalid receiver type"
// TODO(gri) expand