spec: adjust scope of function/method type parameters

Change scope rules per the accepted proposal #52038.
Match prose for type parameters of type declarations.
Fixing the implementation is tracked by #51503.

Fixes #52038.
For #51503.

Change-Id: Iebd88a82c896b7b2e8520cd514ef6a2cc903e807
Reviewed-on: https://go-review.googlesource.com/c/go/+/405754
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Robert Griesemer 2022-05-11 14:40:34 -07:00
parent 900ae5b35a
commit 5d0400c72d
1 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Version of April 19, 2022",
"Subtitle": "Version of May 11, 2022",
"Path": "/ref/spec"
}-->
@ -2158,9 +2158,8 @@ Go is lexically scoped using <a href="#Blocks">blocks</a>:
or result variable is the function body.</li>
<li>The scope of an identifier denoting a type parameter of a function
or declared by a method receiver is the function body and all parameter lists of the
function.
</li>
or declared by a method receiver begins after the name of the function
and ends at the end of the function body.</li>
<li>The scope of an identifier denoting a type parameter of a type
begins after the name of the type and ends at the end