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:
|
of dcEqOrDistinctOf:
|
||||||
while a.kind == tyDistinct: a = a.sons[0]
|
while a.kind == tyDistinct: a = a.sons[0]
|
||||||
if a.kind != b.kind: return false
|
if a.kind != b.kind: return false
|
||||||
if x.Kind == tyGenericInst or y.Kind == tyGenericInst:
|
|
||||||
c.cmp = dcEqIgnoreDistinct
|
|
||||||
case a.Kind
|
case a.Kind
|
||||||
of tyEmpty, tyChar, tyBool, tyNil, tyPointer, tyString, tyCString,
|
of tyEmpty, tyChar, tyBool, tyNil, tyPointer, tyString, tyCString,
|
||||||
tyInt..tyBigNum, tyStmt:
|
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)
|
result = sameObjectStructures(a, b, c) and sameFlags(a, b)
|
||||||
of tyDistinct:
|
of tyDistinct:
|
||||||
CycleCheck()
|
CycleCheck()
|
||||||
if c.cmp == dcEq: result = sameTypeAux(a, b, c) and sameFlags(a, b)
|
if c.cmp == dcEq:
|
||||||
else: result = sameTypeAux(a.sons[0], b.sons[0], c) and sameFlags(a, b)
|
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:
|
of tyEnum, tyForward, tyProxy:
|
||||||
# XXX generic enums do not make much sense, but require structural checking
|
# XXX generic enums do not make much sense, but require structural checking
|
||||||
result = a.id == b.id and sameFlags(a, b)
|
result = a.id == b.id and sameFlags(a, b)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue