diff options
Diffstat (limited to 'tests/ccgbugs/tborrowmagic.nim')
-rw-r--r-- | tests/ccgbugs/tborrowmagic.nim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/ccgbugs/tborrowmagic.nim b/tests/ccgbugs/tborrowmagic.nim new file mode 100644 index 000000000..8d42ddcd8 --- /dev/null +++ b/tests/ccgbugs/tborrowmagic.nim @@ -0,0 +1,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 |