mirror of https://github.com/golang/go.git
spec: clarify nil case in type switches
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>
This commit is contained in:
parent
770d8d8207
commit
84ac90ebf1
|
|
@ -1,6 +1,6 @@
|
||||||
<!--{
|
<!--{
|
||||||
"Title": "The Go Programming Language Specification",
|
"Title": "The Go Programming Language Specification",
|
||||||
"Subtitle": "Version of August 14, 2017",
|
"Subtitle": "Version of August 25, 2017",
|
||||||
"Path": "/ref/spec"
|
"Path": "/ref/spec"
|
||||||
}-->
|
}-->
|
||||||
|
|
||||||
|
|
@ -4820,8 +4820,9 @@ in the TypeSwitchGuard.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The type in a case may be <a href="#Predeclared_identifiers"><code>nil</code></a>;
|
Instead of a type, a case may use the predeclared identifier
|
||||||
that case is used when the expression in the TypeSwitchGuard
|
<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.
|
is a <code>nil</code> interface value.
|
||||||
There may be at most one <code>nil</code> case.
|
There may be at most one <code>nil</code> case.
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue