bugfix: UFCS for templates (ttempl3.nim enhanced)

This commit is contained in:
Araq 2012-05-27 16:22:48 +02:00
commit bb7a14fec0
3 changed files with 27 additions and 10 deletions

View file

@ -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