aboutsummaryrefslogtreecommitdiff
path: root/test/alias2.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2017-01-13 17:23:01 -0800
committerRobert Griesemer <gri@golang.org>2017-01-20 05:55:53 +0000
commit5802cfd900c238baeb835bff62bad61c4f4c9852 (patch)
tree61d49b2e1e7cda8bb4fdd57d57f7339f2f340cce /test/alias2.go
parentd7cabd40dd92e5364969273229373d515bee14e8 (diff)
downloadgo-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.go11
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{}