diff options
author | Robert Griesemer <gri@golang.org> | 2017-01-13 17:23:01 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2017-01-20 05:55:53 +0000 |
commit | 5802cfd900c238baeb835bff62bad61c4f4c9852 (patch) | |
tree | 61d49b2e1e7cda8bb4fdd57d57f7339f2f340cce /test/alias2.go | |
parent | d7cabd40dd92e5364969273229373d515bee14e8 (diff) | |
download | go-5802cfd900c238baeb835bff62bad61c4f4c9852.tar.gz go-5802cfd900c238baeb835bff62bad61c4f4c9852.zip |
[dev.typealias] cmd/compile: export/import test cases for type aliases
Plus a few minor changes.
For #18130.
Change-Id: Ica6503fe9c888cc05c15b46178423f620c087491
Reviewed-on: https://go-review.googlesource.com/35233
Reviewed-by: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'test/alias2.go')
-rw-r--r-- | test/alias2.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/alias2.go b/test/alias2.go index fb0a97feb2..f404d0dd3b 100644 --- a/test/alias2.go +++ b/test/alias2.go @@ -35,9 +35,11 @@ type ( ) // Methods can be declared on the original named type and the alias. -func (T0) m1() {} -func (A0) m1() {} // TODO(gri) this should be an error -func (A0) m2() {} +func (T0) m1() {} +func (*T0) m1() {} // ERROR "method redeclared: T0\.m1" +func (A0) m1() {} // TODO(gri) this should be an error +func (A0) m1() {} // ERROR "A0\.m1 redeclared in this block" +func (A0) m2() {} // Type aliases and the original type name can be used interchangeably. var _ A0 = T0{} @@ -91,6 +93,9 @@ func _() { type _ = reflect.ValueOf // ERROR "reflect.ValueOf is not a type" func (A1) m() {} // ERROR "cannot define new methods on non-local type int" +func (A2) m() {} // ERROR "invalid receiver type struct {}" +func (A3) m() {} // ERROR "cannot define new methods on non-local type reflect.Value" +func (A4) m() {} // ERROR "cannot define new methods on non-local type reflect.Value" type B1 = struct{} |