parent
ac3c4a94ad
commit
231a83a6b1
2 changed files with 30 additions and 6 deletions
|
|
@ -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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue