mirror of
https://github.com/golang/go
synced 2024-11-25 12:57:58 -07:00
fix for conversion rule
R=rsc DELTA=25 (10 added, 7 deleted, 8 changed) OCL=30516 CL=30531
This commit is contained in:
parent
a6c7a80b5b
commit
e2cb60b378
@ -997,7 +997,7 @@ A channel provides a mechanism for two concurrently executing functions
|
|||||||
to synchronize execution and communicate by passing a value of a
|
to synchronize execution and communicate by passing a value of a
|
||||||
specified element type. The element type must be complete (§Types).
|
specified element type. The element type must be complete (§Types).
|
||||||
(TODO: is completeness necessary here?)
|
(TODO: is completeness necessary here?)
|
||||||
A channel value may be <code>nil</code>.
|
A value of channel type may be <code>nil</code>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="grammar">
|
<pre class="grammar">
|
||||||
@ -1161,19 +1161,22 @@ be assigned to otherwise incompatible types:
|
|||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
The predeclared constant <code>nil</code> can be assigned to any
|
|
||||||
pointer, function, slice, map, channel, or interface variable.
|
|
||||||
<li>
|
|
||||||
A pointer to an array can be assigned to a slice variable with compatible element type.
|
|
||||||
The slice variable then refers to the original array; the data is not copied.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
A value can be assigned to an interface variable if the static
|
A value can be assigned to an interface variable if the static
|
||||||
type of the value implements the interface.
|
type of the value implements the interface.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
A value of bidirectional channel type can be assigned to any channel
|
The predeclared constant <code>nil</code> can be assigned to any
|
||||||
variable of compatible channel value type.
|
pointer, function, slice, map, channel, or interface variable.
|
||||||
|
<li>
|
||||||
|
A pointer <code>p</code> to an array can be assigned to a slice variable
|
||||||
|
<code>v</code> with compatible element type
|
||||||
|
if the type of <code>p</code> or <code>v</code> is unnamed.
|
||||||
|
The slice variable then refers to the original array; the data is not copied.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
A bidirectional channel <code>c</code> can be assigned to a channel variable
|
||||||
|
<code>v</code> with compatible channel value type
|
||||||
|
if the type of <code>c</code> or <code>v</code> is unnamed.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -3846,13 +3849,13 @@ The following conversion rules apply:
|
|||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
1) Between two compatible types (§Type identity and compatibility).
|
1) The conversion succeeds if the value is assignment-compatible
|
||||||
The conversion always succeeds.
|
to a variable of type T.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
2) Between two types that would be compatible if they
|
2) The conversion succeeds if the value would be assignment-compatible
|
||||||
or any of their component types were unnamed (§Type identity and compatibility).
|
to a variable of type T if the value type or T or any of their component
|
||||||
The conversion always succeeds.
|
types are unnamed (§Type identity and compatibility).
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
3) Between integer types. If the value is a signed quantity, it is
|
3) Between integer types. If the value is a signed quantity, it is
|
||||||
|
Loading…
Reference in New Issue
Block a user