From 3b8e821b8586bf66f2784bd9fe05ee2d3bb07c3a Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Tue, 6 Nov 2018 16:08:53 -0800 Subject: [PATCH] cleanup: use UncheckedArray instead of array[0, T]] --- ranges/typedranges.nim | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ranges/typedranges.nim b/ranges/typedranges.nim index 5b5f0bb..378d22c 100644 --- a/ranges/typedranges.nim +++ b/ranges/typedranges.nim @@ -160,10 +160,7 @@ proc `[]=`*[T, U, V](r: MutRange[T], s: HSlice[U, V], v: openarray[T]) = raise newException(RangeError, "different lengths for slice assignment") template toOpenArray*[T](r: Range[T]): auto = - # TODO: Casting through an {.unchecked.} array would be more appropriate - # here, but currently this results in internal compiler error. - # NOTE: `0` in `array[0, T]` is irrelevant - toOpenArray(cast[ptr array[0, T]](r.start)[], 0, r.high) + toOpenArray(cast[ptr UncheckedArray[T]](r.start), 0, r.high) proc `[]=`*[T, U, V](r: MutRange[T], s: HSlice[U, V], v: Range[T]) {.inline.} = r[s] = toOpenArray(v)