summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2008-11-05 12:06:48 -0800
committerIan Lance Taylor <iant@golang.org>2008-11-05 12:06:48 -0800
commitd3fd1bde1a397e880a9e8a9cb8840f544108c61f (patch)
tree9a4774f3fb20e5cff9e6297e76f46ae455532a69
parentf93e9122d55a438ef33e00d99f90d157e39c0e8a (diff)
downloadgolang-d3fd1bde1a397e880a9e8a9cb8840f544108c61f.tar.gz
Fix powser1.go to compile with the current 6g, which doesn't
recognize methods for a variable whose type is a named type which is a pointer type. Add bug117 to test this case. R=r DELTA=24 (22 added, 0 deleted, 2 changed) OCL=18547 CL=18554
-rw-r--r--test/bugs/bug117.go21
-rw-r--r--test/chan/powser1.go4
-rw-r--r--test/golden.out6
3 files changed, 29 insertions, 2 deletions
diff --git a/test/bugs/bug117.go b/test/bugs/bug117.go
new file mode 100644
index 000000000..a18e68849
--- /dev/null
+++ b/test/bugs/bug117.go
@@ -0,0 +1,21 @@
+// 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.
+
+package main
+type S struct { a int }
+type PS *S
+func (p *S) get() int {
+ return p.a
+}
+func fn(p PS) int {
+ return p.get()
+}
+func main() {
+ s := S{1};
+ if s.get() != 1 {
+ panic()
+ }
+}
diff --git a/test/chan/powser1.go b/test/chan/powser1.go
index 6c57894a9..775cb6316 100644
--- a/test/chan/powser1.go
+++ b/test/chan/powser1.go
@@ -116,7 +116,7 @@ func put(dat item, out *dch){
out.dat <- dat;
}
-func get(in *dch) item{
+func get(in *dch) *rat {
seqno++;
in.req <- seqno;
return <-in.dat;
@@ -610,7 +610,7 @@ func Init() {
Twos = Rep(itor(2));
}
-func check(U PS, c item, count int, str string) {
+func check(U PS, c *rat, count int, str string) {
for i := 0; i < count; i++ {
r := get(U);
if !r.eq(c) {
diff --git a/test/golden.out b/test/golden.out
index c1410a1ea..4bea55fb1 100644
--- a/test/golden.out
+++ b/test/golden.out
@@ -144,6 +144,12 @@ BUG: errchk: command succeeded unexpectedly: 6g bugs/bug108.go
bugs/bug115.go:8: overflow converting constant to uint
BUG: bug115 should compile
+=========== bugs/bug117.go
+bugs/bug117.go:9: undefined DOT get on PS
+bugs/bug117.go:10: illegal types for operand: RETURN
+ int
+BUG: should compile
+
=========== fixedbugs/bug016.go
fixedbugs/bug016.go:7: overflow converting constant to uint