|
1 | 1 | <!--{
|
2 | 2 | "Title": "The Go Programming Language Specification",
|
3 |
| - "Subtitle": "Version of November 16, 2018", |
| 3 | + "Subtitle": "Version of February 16, 2019", |
4 | 4 | "Path": "/ref/spec"
|
5 | 5 | }-->
|
6 | 6 |
|
@@ -3439,7 +3439,7 @@ <h3 id="Operators">Operators</h3>
|
3439 | 3439 | </p>
|
3440 | 3440 |
|
3441 | 3441 | <p>
|
3442 |
| -The right operand in a shift expression must have unsigned integer type |
| 3442 | +The right operand in a shift expression must have integer type |
3443 | 3443 | or be an untyped constant <a href="#Representability">representable</a> by a
|
3444 | 3444 | value of type <code>uint</code>.
|
3445 | 3445 | If the left operand of a non-constant shift expression is an untyped constant,
|
@@ -3586,7 +3586,9 @@ <h4 id="Integer_operators">Integer operators</h4>
|
3586 | 3586 |
|
3587 | 3587 | <p>
|
3588 | 3588 | The shift operators shift the left operand by the shift count specified by the
|
3589 |
| -right operand. They implement arithmetic shifts if the left operand is a signed |
| 3589 | +right operand, which must be positive. If the shift count is negative at run time, |
| 3590 | +a <a href="#Run_time_panics">run-time panic</a> occurs. |
| 3591 | +The shift operators implement arithmetic shifts if the left operand is a signed |
3590 | 3592 | integer and logical shifts if it is an unsigned integer.
|
3591 | 3593 | There is no upper limit on the shift count. Shifts behave
|
3592 | 3594 | as if the left operand is shifted <code>n</code> times by 1 for a shift
|
@@ -5921,7 +5923,7 @@ <h3 id="Complex_numbers">Manipulating complex numbers</h3>
|
5921 | 5923 | const b = complex(1.0, -1.4) // untyped complex constant 1 - 1.4i
|
5922 | 5924 | x := float32(math.Cos(math.Pi/2)) // float32
|
5923 | 5925 | var c64 = complex(5, -x) // complex64
|
5924 |
| -var s uint = complex(1, 0) // untyped complex constant 1 + 0i can be converted to uint |
| 5926 | +var s int = complex(1, 0) // untyped complex constant 1 + 0i can be converted to int |
5925 | 5927 | _ = complex(1, 2<<s) // illegal: 2 assumes floating-point type, cannot shift
|
5926 | 5928 | var rl = real(c64) // float32
|
5927 | 5929 | var im = imag(a) // float64
|
|
0 commit comments