summary refs log tree commit diff stats
path: root/tests/template/tmixin_in_proc.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/template/tmixin_in_proc.nim')
-rw-r--r--tests/template/tmixin_in_proc.nim22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/template/tmixin_in_proc.nim b/tests/template/tmixin_in_proc.nim
new file mode 100644
index 000000000..fede9290b
--- /dev/null
+++ b/tests/template/tmixin_in_proc.nim
@@ -0,0 +1,22 @@
+discard """
+  output: '''monkey'''
+"""
+# bug #5478
+template creature*(name: untyped) =
+  type
+    name*[T] = object
+      color: T
+
+  proc `init name`*[T](c: T): name[T] =
+    mixin transform
+    transform()
+
+creature(Lion)
+
+type Monkey* = object
+proc transform*() =
+  echo "monkey"
+
+var
+  m: Monkey
+  y = initLion(m)  #this one failed to compile