This commit is contained in:
cooldome 2018-07-12 11:03:08 +02:00 • committed by Andreas Rumpf
commit 231a83a6b1
2 changed files with 30 additions and 6 deletions

View file

@ -24,3 +24,23 @@ macro foo: typed =
else: echo "Does not compute! (test OK)"
foo()
#------------------------------------
# bug #8287
type MyString = distinct string
proc `$` (c: MyString): string {.borrow.}
proc `!!` (c: cstring): int =
c.len
proc f(name: MyString): int =
!! $ name
macro repr_and_parse(fn: typed): typed =
let fn_impl = fn.getImpl
fn_impl.name = genSym(nskProc, $fn_impl.name)
echo fn_impl.repr
result = parseStmt(fn_impl.repr)
repr_and_parse(f)