Hrm, the new errors highlighted some code that seems to be broken
New issue: since `Table[A, B]` allocates its backing storage with `newSeq[KeyValuePair[A, B]]`, it's no longer legal to create a table with `not nil` types used as either keys or values.
This commit is contained in:
parent
f3be5a716f
commit
0521f98486
8 changed files with 23 additions and 22 deletions
|
|
@ -371,9 +371,8 @@ proc map*[T, S](s: openArray[T], op: proc (x: T): S {.closure.}):
|
|||
b = map(a, proc(x: int): string = $x)
|
||||
assert b == @["1", "2", "3", "4"]
|
||||
|
||||
newSeq(result, s.len)
|
||||
for i in 0 ..< s.len:
|
||||
result[i] = op(s[i])
|
||||
result = newSeqOfCap[S](s.len)
|
||||
for elem in s: result.add op(elem)
|
||||
|
||||
proc apply*[T](s: var openArray[T], op: proc (x: var T) {.closure.})
|
||||
{.inline.} =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue