spec: clarify that short variable declarations can redeclare parameters

Fixes #9837.

Change-Id: Ia513c7e5db221eee8e3ab0affa6d3688d2099fd9
Reviewed-on: https://go-review.googlesource.com/13130
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Robert Griesemer 2015-08-04 11:29:28 -07:00
parent 87c8707e6f
commit 85789daac3

View File

@ -2006,12 +2006,12 @@ _, y, _ := coord(p) // coord() returns three values; only interested in y coord
</pre> </pre>
<p> <p>
Unlike regular variable declarations, a short variable declaration may redeclare variables provided they Unlike regular variable declarations, a short variable declaration may <i>redeclare</i>
were originally declared earlier in the same block with the same type, and at variables provided they were originally declared earlier in the same block
least one of the non-<a href="#Blank_identifier">blank</a> variables is new. As a consequence, redeclaration (or the parameter lists if the block is the function body) with the same type,
can only appear in a multi-variable short declaration. and at least one of the non-<a href="#Blank_identifier">blank</a> variables is new.
Redeclaration does not introduce a new As a consequence, redeclaration can only appear in a multi-variable short declaration.
variable; it just assigns a new value to the original. Redeclaration does not introduce a new variable; it just assigns a new value to the original.
</p> </p>
<pre> <pre>