fixes #1700
This commit is contained in:
parent
5d132b75ef
commit
178a85cd25
2 changed files with 206 additions and 182 deletions
|
|
@ -308,6 +308,10 @@ proc getTypeDescWeak(m: BModule; t: PType; check: var IntSet): PRope =
|
|||
let x = getUniqueType(etB)
|
||||
result = getTypeForward(m, x)
|
||||
pushType(m, x)
|
||||
of tySequence:
|
||||
let x = getUniqueType(etB)
|
||||
result = getTypeForward(m, x).con("*")
|
||||
pushType(m, x)
|
||||
else:
|
||||
result = getTypeDescAux(m, t, check)
|
||||
|
||||
|
|
@ -430,6 +434,9 @@ proc genRecordFieldsAux(m: BModule, n: PNode,
|
|||
if fieldType.kind == tyArray and tfUncheckedArray in fieldType.flags:
|
||||
appf(result, "$1 $2[SEQ_DECL_SIZE];$n",
|
||||
[getTypeDescAux(m, fieldType.elemType, check), sname])
|
||||
elif fieldType.kind == tySequence:
|
||||
# we need to use a weak dependency here for trecursive_table.
|
||||
appf(result, "$1 $2;$n", [getTypeDescWeak(m, field.loc.t, check), sname])
|
||||
else:
|
||||
# don't use fieldType here because we need the
|
||||
# tyGenericInst for C++ template support
|
||||
|
|
@ -484,7 +491,7 @@ proc getTupleDesc(m: BModule, typ: PType, name: PRope,
|
|||
for i in countup(0, sonsLen(typ) - 1):
|
||||
appf(desc, "$1 Field$2;$n",
|
||||
[getTypeDescAux(m, typ.sons[i], check), toRope(i)])
|
||||
if (desc == nil): app(result, "char dummy;" & tnl)
|
||||
if desc == nil: app(result, "char dummy;" & tnl)
|
||||
else: app(result, desc)
|
||||
app(result, "};" & tnl)
|
||||
|
||||
|
|
|
|||
17
tests/ccgbugs/trecursive_table.nim
Normal file
17
tests/ccgbugs/trecursive_table.nim
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
# bug #1700
|
||||
import tables
|
||||
|
||||
type
|
||||
E* = enum
|
||||
eX
|
||||
eY
|
||||
T* = object
|
||||
case kind: E
|
||||
of eX:
|
||||
xVal: Table[string, T]
|
||||
of eY:
|
||||
nil
|
||||
|
||||
proc p*(x: Table[string, T]) =
|
||||
discard
|
||||
Loading…
Add table
Add a link
Reference in a new issue