summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2018-09-11 20:32:25 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-09-11 20:32:25 +0200
commit8670f4911b742c87210b97150197080310b5ab58 (patch)
tree567e23f6feaa9ec93bfac7d7594bc9eb65487d79 /tests
parente7d404340628ef2ca6170744a7df33e20cd0fc1a (diff)
downloadNim-8670f4911b742c87210b97150197080310b5ab58.tar.gz
Fix semantic pass with borrowed magic procs (#8945)
Reported by pqflx3 on the forum.
Diffstat (limited to 'tests')
-rw-r--r--tests/ccgbugs/tborrowmagic.nim8
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