Commit e06d9013 authored by Robert Griesemer's avatar Robert Griesemer

spec: receiver types in method expressions can be parenthesized

Fixes #4457.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6862046
parent e93bdd99
...@@ -3316,7 +3316,7 @@ argument that is the receiver of the method. ...@@ -3316,7 +3316,7 @@ argument that is the receiver of the method.
<pre class="ebnf"> <pre class="ebnf">
MethodExpr = ReceiverType "." MethodName . MethodExpr = ReceiverType "." MethodName .
ReceiverType = TypeName | "(" "*" TypeName ")" . ReceiverType = TypeName | "(" "*" TypeName ")" | "(" ReceiverType ")" .
</pre> </pre>
<p> <p>
...@@ -3353,13 +3353,15 @@ func(tv T, a int) int ...@@ -3353,13 +3353,15 @@ func(tv T, a int) int
<p> <p>
That function may be called normally with an explicit receiver, so That function may be called normally with an explicit receiver, so
these three invocations are equivalent: these five invocations are equivalent:
</p> </p>
<pre> <pre>
t.Mv(7) t.Mv(7)
T.Mv(t, 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)
</pre> </pre>
<p> <p>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment