From: Robert Griesemer Date: Thu, 6 Dec 2012 17:31:42 +0000 (-0800) Subject: spec: receiver types in method expressions can be parenthesized X-Git-Tag: go1.1rc2~1697 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e06d90136f18fbb1ffa46537d01eb3552f45b0bc;p=gostls13.git spec: receiver types in method expressions can be parenthesized Fixes #4457. R=rsc, iant, r, ken CC=golang-dev https://golang.org/cl/6862046 --- diff --git a/doc/go_spec.html b/doc/go_spec.html index f58c323216..d72460da8e 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -3316,7 +3316,7 @@ argument that is the receiver of the method.
 MethodExpr    = ReceiverType "." MethodName .
-ReceiverType  = TypeName | "(" "*" TypeName ")" .
+ReceiverType  = TypeName | "(" "*" TypeName ")" | "(" ReceiverType ")" .
 

@@ -3353,13 +3353,15 @@ func(tv T, a int) int

That function may be called normally with an explicit receiver, so -these three invocations are equivalent: +these five invocations are equivalent:

 t.Mv(7)
 T.Mv(t, 7)
-f := T.Mv; f(t, 7)
+(T).Mv(t, t)
+f1 := T.Mv; f1(t, 7)
+f2 := (T).Mv; f2(t, 7)