diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-01-27 07:59:40 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-01-27 07:59:40 +0100 |
commit | 68dfd1729e22835d9596b20d419a720ba6452781 (patch) | |
tree | 8d4729202e066b0f535aff618afd6f7002c0c77f /lib | |
parent | 394757dbf521b8b4a16dd694a687039faeb21682 (diff) | |
download | Nim-68dfd1729e22835d9596b20d419a720ba6452781.tar.gz |
fixes #6989
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system.nim | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/system.nim b/lib/system.nim index 2c0617e4d..4e071e802 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -318,7 +318,7 @@ type Slice*[T] = HSlice[T, T] ## an alias for ``HSlice[T, T]`` proc `..`*[T, U](a: T, b: U): HSlice[T, U] {.noSideEffect, inline, magic: "DotDot".} = - ## `slice`:idx: operator that constructs an interval ``[a, b]``, both `a` + ## binary `slice`:idx: operator that constructs an interval ``[a, b]``, both `a` ## and `b` are inclusive. Slices can also be used in the set constructor ## and in ordinal case statements, but then they are special-cased by the ## compiler. @@ -326,7 +326,7 @@ proc `..`*[T, U](a: T, b: U): HSlice[T, U] {.noSideEffect, inline, magic: "DotDo result.b = b proc `..`*[T](b: T): HSlice[int, T] {.noSideEffect, inline, magic: "DotDot".} = - ## `slice`:idx: operator that constructs an interval ``[default(int), b]`` + ## unary `slice`:idx: operator that constructs an interval ``[default(int), b]`` result.b = b when not defined(niminheritable): @@ -677,12 +677,12 @@ proc `<`*[T](x: Ordinal[T]): T {.magic: "UnaryLt", noSideEffect, deprecated.} ## write ``0 ..< 10`` instead of ``0 .. < 10`` (look at the spacing). ## For ``<x`` write ``pred(x)``. -proc succ*[T](x: Ordinal[T], y = 1): T {.magic: "Succ", noSideEffect.} +proc succ*[T: Ordinal](x: T, y = 1): T {.magic: "Succ", noSideEffect.} ## returns the ``y``-th successor of the value ``x``. ``T`` has to be ## an ordinal type. If such a value does not exist, ``EOutOfRange`` is raised ## or a compile time error occurs. -proc pred*[T](x: Ordinal[T], y = 1): T {.magic: "Pred", noSideEffect.} +proc pred*[T: Ordinal](x: T, y = 1): T {.magic: "Pred", noSideEffect.} ## returns the ``y``-th predecessor of the value ``x``. ``T`` has to be ## an ordinal type. If such a value does not exist, ``EOutOfRange`` is raised ## or a compile time error occurs. @@ -3505,8 +3505,8 @@ template `..^`*(a, b: untyped): untyped = a .. ^b template `..<`*(a, b: untyped): untyped = - ## a shortcut for 'a..pred(b)'. - a .. pred(b) + ## a shortcut for 'a .. (when b is BackwardsIndex: succ(b) else: pred(b))'. + a .. (when b is BackwardsIndex: succ(b) else: pred(b)) when defined(nimNewRoof): iterator `..<`*[T](a, b: T): T = |