summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorOscar NihlgÄrd <oscarnihlgard@gmail.com>2018-08-07 09:24:54 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-08-07 09:24:54 +0200
commit9b9cfa7306d696961cc6fd590ca72c08f66bdcb3 (patch)
treee1e9c2123bca89dc8e21207607c800de47f58c9a
parentc3d5ec8eadf3aa887f34231c2d7b5818923818d4 (diff)
downloadNim-9b9cfa7306d696961cc6fd590ca72c08f66bdcb3.tar.gz
Stricter signature for countdown/countup (#8549)
-rw-r--r--lib/system.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 0cfa39e19..94baf7370 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1978,7 +1978,7 @@ when sizeof(int) <= 2:
 else:
   type IntLikeForCount = int|int8|int16|int32|char|bool|uint8|uint16|enum
 
-iterator countdown*[T](a, b: T, step = 1): T {.inline.} =
+iterator countdown*[T](a, b: T, step: Positive = 1): T {.inline.} =
   ## Counts from ordinal value `a` down to `b` (inclusive) with the given
   ## step count. `T` may be any ordinal type, `step` may only
   ## be positive. **Note**: This fails to count to ``low(int)`` if T = int for
@@ -2001,7 +2001,7 @@ iterator countdown*[T](a, b: T, step = 1): T {.inline.} =
       dec(res, step)
 
 when defined(nimNewRoof):
-  iterator countup*[T](a, b: T, step = 1): T {.inline.} =
+  iterator countup*[T](a, b: T, step: Positive = 1): T {.inline.} =
     ## Counts from ordinal value `a` up to `b` (inclusive) with the given
     ## step count. `S`, `T` may be any ordinal type, `step` may only
     ## be positive. **Note**: This fails to count to ``high(int)`` if T = int for
@@ -2018,7 +2018,7 @@ when defined(nimNewRoof):
         inc(res, step)
 
   iterator `..`*[T](a, b: T): T {.inline.} =
-    ## An alias for `countup`.
+    ## An alias for `countup(a, b, 1)`.
     when T is IntLikeForCount:
       var res = int(a)
       while res <= int(b):