Skip to content

Commit

Permalink
spec: clarify nil case in type switches
Browse files Browse the repository at this point in the history
The old wording seemed to imply that nil is a kind of type.
Slightly reworded for clarity.

Fixes #21580.

Change-Id: I29898bf0125a10cb8dbb5c7e63ec5399ebc590ca
Reviewed-on: https://go-review.googlesource.com/58490
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Rob Pike <r@golang.org>
  • Loading branch information
griesemer committed Aug 25, 2017
1 parent 770d8d8 commit 84ac90e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 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 August 14, 2017",
"Subtitle": "Version of August 25, 2017",
"Path": "/ref/spec"
}-->

Expand Down Expand Up @@ -4820,8 +4820,9 @@ <h4 id="Type_switches">Type switches</h4>
</p>

<p>
The type in a case may be <a href="#Predeclared_identifiers"><code>nil</code></a>;
that case is used when the expression in the TypeSwitchGuard
Instead of a type, a case may use the predeclared identifier
<a href="#Predeclared_identifiers"><code>nil</code></a>;
that case is selected when the expression in the TypeSwitchGuard
is a <code>nil</code> interface value.
There may be at most one <code>nil</code> case.
</p>
Expand Down

0 comments on commit 84ac90e

Please sign in to comment.