Fixes #10
This commit is contained in:
parent
3435dc1155
commit
42c8e730de
|
@ -18,7 +18,7 @@ proc toImmutableRange[T](a: seq[T]): Range[T] =
|
|||
if a.len != 0:
|
||||
when rangesGCHoldEnabled:
|
||||
result.gcHold = a
|
||||
result.start = unsafeAddr a[0]
|
||||
result.start = addr result.gcHold[0]
|
||||
result.mLen = int32(a.len)
|
||||
|
||||
when unsafeAPIEnabled:
|
||||
|
|
|
@ -63,3 +63,9 @@ suite "Typed ranges":
|
|||
check n == @[A, B, C ,D]
|
||||
check n != @[A, B, C ,C]
|
||||
|
||||
test "shallowness":
|
||||
var s = @[1, 2, 3]
|
||||
var r = s.toRange()
|
||||
var r2 = r
|
||||
check(r.baseAddr == r2.baseAddr)
|
||||
# check(r.baseAddr == addr s[0]) # XXX: Uncomment once nim bug #8044 is fixed
|
||||
|
|
Loading…
Reference in New Issue