From: Robert Griesemer Date: Tue, 4 Aug 2015 18:29:28 +0000 (-0700) Subject: spec: clarify that short variable declarations can redeclare parameters X-Git-Tag: go1.5rc1~17 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=85789daac3ed499683dd03ae7a35bf30dc1e74c0;p=gostls13.git 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 Reviewed-by: Rob Pike Reviewed-by: Russ Cox --- diff --git a/doc/go_spec.html b/doc/go_spec.html index fd47f10530..b3d50888ad 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -2006,12 +2006,12 @@ _, y, _ := coord(p) // coord() returns three values; only interested in y coord

-Unlike regular variable declarations, a short variable declaration may redeclare variables provided they -were originally declared earlier in the same block with the same type, and at -least one of the non-blank variables is new. As a consequence, redeclaration -can only appear in a multi-variable short declaration. -Redeclaration does not introduce a new -variable; it just assigns a new value to the original. +Unlike regular variable declarations, a short variable declaration may redeclare +variables provided they were originally declared earlier in the same block +(or the parameter lists if the block is the function body) with the same type, +and at least one of the non-blank variables is new. +As a consequence, redeclaration can only appear in a multi-variable short declaration. +Redeclaration does not introduce a new variable; it just assigns a new value to the original.