Skip to content

Commit

Permalink
Add testcases for nim-lang#17199
Browse files Browse the repository at this point in the history
  • Loading branch information
Clyybber committed Mar 25, 2021
1 parent 5272184 commit 8f0b3d5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/arc/tarcmisc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,19 @@ proc newPixelBuffer(): PixelBuffer =

discard newPixelBuffer()


# bug #17199

proc passSeq(data: seq[string]) =
# used the system.& proc initially
let wat = data & "hello"

proc test =
let name = @["hello", "world"]
passSeq(name)
doAssert name == @["hello", "world"]

# works at runtime but not compile-time
static:
test()

22 changes: 22 additions & 0 deletions tests/vm/tissues.nim
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,25 @@ block t4952:
let tree = newTree(nnkExprColonExpr)
let t = (n: tree)
doAssert: t.n.kind == tree.kind


# bug #17199

proc merge(x: sink seq[string], y: sink string): seq[string] =
newSeq(result, x.len + 1)
for i in 0..x.len-1:
result[i] = move(x[i])
result[x.len] = move(y)

proc passSeq(data: seq[string]) =
# used the system.& proc initially
let wat = merge(data, "hello")

proc test =
let name = @["hello", "world"]
passSeq(name)
doAssert name == @["hello", "world"]

# works at runtime but not compile-time
static:
test()

0 comments on commit 8f0b3d5

Please sign in to comment.