diff options
author | Araq <rumpf_a@web.de> | 2012-05-27 16:22:48 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-05-27 16:22:48 +0200 |
commit | bb7a14fec0fe3b88cddb51ae9550c2b6a4d75099 (patch) | |
tree | 9682df8488441fce144a57de213b240d760e98ba /tests/compile | |
parent | 7a249eb8c183cf0db0a49b82ee80700e08473e66 (diff) | |
download | Nim-bb7a14fec0fe3b88cddb51ae9550c2b6a4d75099.tar.gz |
bugfix: UFCS for templates (ttempl3.nim enhanced)
Diffstat (limited to 'tests/compile')
-rwxr-xr-x | tests/compile/ttempl3.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/compile/ttempl3.nim b/tests/compile/ttempl3.nim index d8e67cc3e..a2e95ab03 100755 --- a/tests/compile/ttempl3.nim +++ b/tests/compile/ttempl3.nim @@ -40,3 +40,18 @@ template typedef(name: expr, typ: typeDesc) {.immediate.} = typedef(myint, int) var x: PMyInt + +# Test UFCS + +type + Foo = object + arg: int + +proc initFoo(arg: int): Foo = + result.arg = arg + +template create(typ: typeDesc, arg: expr): expr = `init typ`(arg) + +var ff = Foo.create(12) + +echo ff.arg |