Skip to content

Commit

Permalink
spec: adjust scope of function/method type parameters
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
griesemer committed May 12, 2022
1 parent 900ae5b commit 5d0400c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions doc/go_spec.html
Original file line number Diff line number Diff line change
@@ -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"
}-->

Expand Down Expand Up @@ -2158,9 +2158,8 @@ <h2 id="Declarations_and_scope">Declarations and scope</h2>
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
Expand Down

0 comments on commit 5d0400c

Please sign in to comment.