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:
Zahary Karadjov 2020-03-29 02:17:47 +02:00 • committed by Andreas Rumpf
commit 0521f98486
8 changed files with 23 additions and 22 deletions

View file

@ -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.} =