summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-10-30 21:27:02 +0100
committerAraq <rumpf_a@web.de>2011-10-30 21:27:02 +0100
commit47f523cfb8b5d430d1105c608440200950183bb1 (patch)
treed2196ff4cb8e64ae4f2c83b6eb3f5dc188544c95
parent15fcb58e2aff206ac051a6ab9afcacc05ec602c7 (diff)
downloadNim-47f523cfb8b5d430d1105c608440200950183bb1.tar.gz
bugfix: template t(f_no_Type) does not crash the compiler anymore in 'check' mode
-rwxr-xr-xcompiler/semtypes.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index 3536a2a34..1d855d97f 100755
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -529,6 +529,12 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
       #  debug a.sons[length-2][0][1]
     else:
       typ = nil
+      # consider: 
+      # template T(x)
+      # it's wrong, but the parser might not generate a fatal error (when in
+      # 'check' mode for example), so we need to check again here:
+      if unlikely(a.sons[length-1].kind == nkEmpty): continue
+      
     if a.sons[length-1].kind != nkEmpty:
       def = semExprWithType(c, a.sons[length-1]) 
       # check type compability between def.typ and typ: