summary refs log tree commit diff stats
path: root/tests/template
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-08-22 19:08:35 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-08-22 19:08:35 +0200
commit9aad99bdfd90394634b97a1c9b005d1c86c9c7e2 (patch)
tree0acd12d370a5fcc73635e365f9032071089d8f15 /tests/template
parent085fbcea6f054ec638250853c3e85a0e51c3f3bd (diff)
downloadNim-9aad99bdfd90394634b97a1c9b005d1c86c9c7e2.tar.gz
closes #7117
Diffstat (limited to 'tests/template')
-rw-r--r--tests/template/template_various.nim18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/template/template_various.nim b/tests/template/template_various.nim
index 36fa42050..ac7e91fa2 100644
--- a/tests/template/template_various.nim
+++ b/tests/template/template_various.nim
@@ -9,6 +9,7 @@ bar7
 10
 4true
 132
+20
 '''
 """
 
@@ -192,7 +193,7 @@ block ttempl:
 
 
 block ttempl4:
-  template `:=`(name, val: untyped): typed =
+  template `:=`(name, val: untyped) =
     var name = val
 
   ha := 1 * 4
@@ -211,7 +212,7 @@ block ttempl5:
       discard
 
   # Call parse_to_close
-  template get_next_ident: typed =
+  template get_next_ident =
       discard "{something}".parse_to_close(0, open = '{', close = '}')
 
   get_next_ident()
@@ -231,3 +232,16 @@ block ttempl5:
 block templreturntype:
   template `=~` (a: int, b: int): bool = false
   var foo = 2 =~ 3
+
+# bug #7117
+template parse9(body: untyped): untyped =
+
+  template val9(arg: string): int {.inject.} =
+    var b: bool
+    if b: 10
+    else: 20
+
+  body
+
+parse9:
+  echo val9("1")