summary refs log tree commit diff stats
path: root/tests/compile
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-05-27 16:22:48 +0200
committerAraq <rumpf_a@web.de>2012-05-27 16:22:48 +0200
commitbb7a14fec0fe3b88cddb51ae9550c2b6a4d75099 (patch)
tree9682df8488441fce144a57de213b240d760e98ba /tests/compile
parent7a249eb8c183cf0db0a49b82ee80700e08473e66 (diff)
downloadNim-bb7a14fec0fe3b88cddb51ae9550c2b6a4d75099.tar.gz
bugfix: UFCS for templates (ttempl3.nim enhanced)
Diffstat (limited to 'tests/compile')
-rwxr-xr-xtests/compile/ttempl3.nim15
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