bugfix: template t(f_no_Type) does not crash the compiler anymore in 'check' mode
This commit is contained in:
parent
15fcb58e2a
commit
47f523cfb8
1 changed files with 6 additions and 0 deletions
|
|
@ -529,6 +529,12 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
|
||||||
# debug a.sons[length-2][0][1]
|
# debug a.sons[length-2][0][1]
|
||||||
else:
|
else:
|
||||||
typ = nil
|
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:
|
if a.sons[length-1].kind != nkEmpty:
|
||||||
def = semExprWithType(c, a.sons[length-1])
|
def = semExprWithType(c, a.sons[length-1])
|
||||||
# check type compability between def.typ and typ:
|
# check type compability between def.typ and typ:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue