diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-10-30 00:27:30 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-10-30 00:27:30 +0100 |
commit | d7a896f19dfc7ff2ad22b78ef03e4db73332fc7e (patch) | |
tree | fccacd396f51cb078f8e1d7cdaec511c88908ec1 /doc/manual | |
parent | aa526da70645f28a284defa9a1487371ae7bd339 (diff) | |
download | Nim-d7a896f19dfc7ff2ad22b78ef03e4db73332fc7e.tar.gz |
breaking change: 'and' and 'mod' do not produce a subrange type anymore; fixes #5854
Diffstat (limited to 'doc/manual')
-rw-r--r-- | doc/manual/types.txt | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/doc/manual/types.txt b/doc/manual/types.txt index 4d66bf664..8361ec1f2 100644 --- a/doc/manual/types.txt +++ b/doc/manual/types.txt @@ -137,25 +137,6 @@ determined). Assignments from the base type to one of its subrange types A subrange type has the same size as its base type (``int`` in the example). -Nim requires `interval arithmetic`:idx: for subrange types over a set -of built-in operators that involve constants: ``x %% 3`` is of -type ``range[0..2]``. The following built-in operators for integers are -affected by this rule: ``-``, ``+``, ``*``, ``min``, ``max``, ``succ``, -``pred``, ``mod``, ``div``, ``%%``, ``and`` (bitwise ``and``). - -Bitwise ``and`` only produces a ``range`` if one of its operands is a -constant *x* so that (x+1) is a power of two. -(Bitwise ``and`` is then a ``%%`` operation.) - -This means that the following code is accepted: - -.. code-block:: nim - case (x and 3) + 7 - of 7: echo "A" - of 8: echo "B" - of 9: echo "C" - of 10: echo "D" - # note: no ``else`` required as (x and 3) + 7 has the type: range[7..10] Pre-defined floating point types |