summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorSirOlaf <34164198+SirOlaf@users.noreply.github.com>2023-08-23 06:18:35 +0200
committerGitHub <noreply@github.com>2023-08-23 06:18:35 +0200
commit3de75ffc02ea85b95702ec0dc0976748954d3e2c (patch)
treed4f49457ea6d6a0227f822a3d0b357604ed1fba4 /compiler
parent6b04d0395ab1d6d8efa7d287c73da2c7230800c9 (diff)
downloadNim-3de75ffc02ea85b95702ec0dc0976748954d3e2c.tar.gz
Fix #21532: Check if template return is untyped (#22517)
* Don't ignore return in semTemplateDef

* Add test

---------

Co-authored-by: SirOlaf <>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semtempl.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim
index a72143bdd..85411f7c4 100644
--- a/compiler/semtempl.nim
+++ b/compiler/semtempl.nim
@@ -674,6 +674,9 @@ proc semTemplateDef(c: PContext, n: PNode): PNode =
     # a template's parameters are not gensym'ed even if that was originally the
     # case as we determine whether it's a template parameter in the template
     # body by the absence of the sfGenSym flag:
+    let retType = s.typ[0]
+    if retType != nil and retType.kind != tyUntyped:
+      allUntyped = false
     for i in 1..<s.typ.n.len:
       let param = s.typ.n[i].sym
       if param.name.id != ord(wUnderscore):