]> Cypherpunks repositories - gostls13.git/commitdiff
spec: adjust scope of function/method type parameters
authorRobert Griesemer <gri@golang.org>
Wed, 11 May 2022 21:40:34 +0000 (14:40 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 12 May 2022 04:47:13 +0000 (04:47 +0000)
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>
doc/go_spec.html

index b272cb5df6e119feae5b1d92c459f39f39f8fd64..70efddf626944ad7d0515683b525b01e89891790 100644 (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