From b21782a667f7a819124e95da14053387bd0079a0 Mon Sep 17 00:00:00 2001
From: Clyybber <darkmine956@gmail.com>
Date: Fri, 10 Jul 2020 17:02:49 +0200
Subject: Add testcase for #4722 (#14954)

---
 tests/template/template_issues.nim | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

(limited to 'tests')

diff --git a/tests/template/template_issues.nim b/tests/template/template_issues.nim
index e56d44480..420373e61 100644
--- a/tests/template/template_issues.nim
+++ b/tests/template/template_issues.nim
@@ -8,6 +8,9 @@ hi
 Hello, World!
 (e: 42)
 hey
+foo
+foo
+foo
 '''
 """
 
@@ -245,3 +248,21 @@ proc foo(): auto =
     echo "hey"
 
 discard foo()
+
+
+# bug #4722
+type
+  IteratorF*[In] = iterator() : In {.closure.}
+
+template foof(In: untyped) : untyped = 
+  proc ggg*(arg: IteratorF[In]) =
+    for i in arg():
+      echo "foo"
+
+
+iterator hello() : int {.closure.} =
+  for i in 1 .. 3:
+    yield i
+    
+foof(int)
+ggg(hello)
-- 
cgit 1.4.1-2-gfad0