]> Cypherpunks repositories - gostls13.git/commitdiff
Don't use a named pointer type as a receiver type. The
authorIan Lance Taylor <iant@golang.org>
Wed, 5 Nov 2008 19:25:30 +0000 (11:25 -0800)
committerIan Lance Taylor <iant@golang.org>
Wed, 5 Nov 2008 19:25:30 +0000 (11:25 -0800)
current spec forbids it:
    The type specified by the type name is called ``receiver
    base type''.  The receiver base type must be a type
    declared in the current file, and it must not be a pointer
    type.

R=r
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=18527
CL=18541

test/chan/powser1.go

index 4b0aa6128e5875e77d662c65d10c13c3f7840292..6c57894a9ba48718103e4b3df196632e0d0709c0 100644 (file)
@@ -19,13 +19,13 @@ type rat struct  {
 
 type item *rat;
 
-func (u item) pr(){
+func (u *rat) pr(){
        if u.den==1 { print(u.num) }
        else { print(u.num, "/", u.den) }
        print(" ")
 }
 
-func (u item) eq(c item) bool {
+func (u *rat) eq(c item) bool {
        return u.num == c.num && u.den == c.den
 }