summary refs log tree commit diff stats
path: root/tests/ccgbugs/tborrowmagic.nim
blob: 8d42ddcd8efc1e984569ba3b4099679ca9aea628 (plain) (blame)
1
2
3
4
5
6
7
8
type
  Bytes = distinct seq[byte]

proc add(x: var Bytes; b: byte) {.borrow.}
var x = @[].Bytes
x.add(42)
let base = cast[seq[byte]](x)
doAssert base.len == 1 and base[0] == 42