Merge pull request #2333 from def-/recursive-type

Fix infinite recursion in semtypes with recursive types
This commit is contained in:
Andreas Rumpf
2015-03-15 00:46:33 +01:00
2 changed files with 10 additions and 0 deletions

View File

@@ -787,6 +787,8 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode,
result = addImplicitGeneric(typ)
else:
for i in 0 .. <paramType.sons.len:
if paramType.sons[i] == paramType:
globalError(info, errIllegalRecursionInTypeX, typeToString(paramType))
var lifted = liftingWalk(paramType.sons[i])
if lifted != nil:
paramType.sons[i] = lifted

View File

@@ -0,0 +1,8 @@
discard """
errormsg: "illegal recursion in type 'XIM'"
line: 8
"""
type
XIM* = ptr XIM
XIMProc* = proc (a2: XIM)