aboutsummaryrefslogtreecommitdiff
path: root/test/interface/pointer.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-05-21 13:46:20 -0700
committerRuss Cox <rsc@golang.org>2009-05-21 13:46:20 -0700
commitb9159722dd874c9ef64dd16af49084077d7a9bb8 (patch)
tree97c2f40f26cc4882dc5adb10c4961a6846f42cf4 /test/interface/pointer.go
parenta016081f435d2cee1de3d3d09d085a8eb213b35a (diff)
downloadgo-b9159722dd874c9ef64dd16af49084077d7a9bb8.tar.xz
add test for yesterday's interface rule change (interface/convert1.go).
move interface tests to subdirectory. R=r DELTA=1632 (827 added, 804 deleted, 1 changed) OCL=29181 CL=29191
Diffstat (limited to 'test/interface/pointer.go')
-rw-r--r--test/interface/pointer.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/interface/pointer.go b/test/interface/pointer.go
new file mode 100644
index 0000000000..202c37d860
--- /dev/null
+++ b/test/interface/pointer.go
@@ -0,0 +1,37 @@
+// errchk $G $D/$F.go
+
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Check that interface{M()} = *interface{M()} produces a compiler error.
+
+package main
+
+type Inst interface {
+ Next() *Inst;
+}
+
+type Regexp struct {
+ code []Inst;
+ start Inst;
+}
+
+type Start struct {
+ foo *Inst;
+}
+
+func (start *Start) Next() *Inst { return nil }
+
+
+func AddInst(Inst) *Inst {
+ print("ok in addinst\n");
+ return nil
+}
+
+func main() {
+ re := new(Regexp);
+ print("call addinst\n");
+ var x Inst = AddInst(new(Start)); // ERROR "illegal|incompatible"
+ print("return from addinst\n");
+}