]> Cypherpunks repositories - gostls13.git/commitdiff
Fix powser1.go to compile with the current 6g, which doesn't
authorIan Lance Taylor <iant@golang.org>
Wed, 5 Nov 2008 20:06:48 +0000 (12:06 -0800)
committerIan Lance Taylor <iant@golang.org>
Wed, 5 Nov 2008 20:06:48 +0000 (12:06 -0800)
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

test/bugs/bug117.go [new file with mode: 0644]
test/chan/powser1.go
test/golden.out

diff --git a/test/bugs/bug117.go b/test/bugs/bug117.go
new file mode 100644 (file)
index 0000000..a18e688
--- /dev/null
@@ -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()
+  }
+}
index 6c57894a9ba48718103e4b3df196632e0d0709c0..775cb63162ac3384372d19ffaf8e8bfdadfc48df 100644 (file)
@@ -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) {
index c1410a1ead103a4e9d79df711fe583a32ced1310..4bea55fb137e585e082d70e00c19e1122cf92fbb 100644 (file)
@@ -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