This commit is contained in:
Araq 2015-03-24 23:07:04 +01:00
commit 178a85cd25
2 changed files with 206 additions and 182 deletions

View file

@ -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)

View 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