better fix for Issue #629 Recursive generic types not working
This commit is contained in:
parent
9df232911c
commit
4330c986db
1 changed files with 14 additions and 11 deletions
|
|
@ -825,8 +825,6 @@ proc SameTypeAux(x, y: PType, c: var TSameTypeClosure): bool =
|
|||
of dcEqOrDistinctOf:
|
||||
while a.kind == tyDistinct: a = a.sons[0]
|
||||
if a.kind != b.kind: return false
|
||||
if x.Kind == tyGenericInst or y.Kind == tyGenericInst:
|
||||
c.cmp = dcEqIgnoreDistinct
|
||||
case a.Kind
|
||||
of tyEmpty, tyChar, tyBool, tyNil, tyPointer, tyString, tyCString,
|
||||
tyInt..tyBigNum, tyStmt:
|
||||
|
|
@ -839,8 +837,13 @@ proc SameTypeAux(x, y: PType, c: var TSameTypeClosure): bool =
|
|||
result = sameObjectStructures(a, b, c) and sameFlags(a, b)
|
||||
of tyDistinct:
|
||||
CycleCheck()
|
||||
if c.cmp == dcEq: result = sameTypeAux(a, b, c) and sameFlags(a, b)
|
||||
else: result = sameTypeAux(a.sons[0], b.sons[0], c) and sameFlags(a, b)
|
||||
if c.cmp == dcEq:
|
||||
result = false
|
||||
if a.sym != nil and b.sym != nil:
|
||||
if a.sym.name == b.sym.name:
|
||||
result = sameTypeAux(a.sons[0], b.sons[0], c) and sameFlags(a, b)
|
||||
else:
|
||||
result = sameTypeAux(a.sons[0], b.sons[0], c) and sameFlags(a, b)
|
||||
of tyEnum, tyForward, tyProxy:
|
||||
# XXX generic enums do not make much sense, but require structural checking
|
||||
result = a.id == b.id and sameFlags(a, b)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue