bugfix: UFCS for templates (ttempl3.nim enhanced)
This commit is contained in:
parent
7a249eb8c1
commit
bb7a14fec0
3 changed files with 27 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue