fix breakage with Nim HEAD

This commit is contained in:
Ștefan Talpalaru 2019-01-03 21:47:32 +01:00 committed by zah
parent a594f68d7d
commit d645a88dfe
1 changed files with 4 additions and 1 deletions

View File

@ -160,7 +160,10 @@ proc `[]=`*[T, U, V](r: MutRange[T], s: HSlice[U, V], v: openarray[T]) =
raise newException(RangeError, "different lengths for slice assignment") raise newException(RangeError, "different lengths for slice assignment")
template toOpenArray*[T](r: Range[T]): auto = template toOpenArray*[T](r: Range[T]): auto =
when (NimMajor,NimMinor,NimPatch)>=(0,19,9): when false:
# when (NimMajor,NimMinor,NimPatch)>=(0,19,9):
# error message in Nim HEAD 2019-01-02:
# "for a 'var' type a variable needs to be passed, but 'toOpenArray(cast[ptr UncheckedArray[T]](curHash.start), 0, high(curHash))' is immutable"
toOpenArray(cast[ptr UncheckedArray[T]](r.start), 0, r.high) toOpenArray(cast[ptr UncheckedArray[T]](r.start), 0, r.high)
else: else:
# NOTE: `0` in `array[0, T]` is irrelevant # NOTE: `0` in `array[0, T]` is irrelevant