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)
|
let x = getUniqueType(etB)
|
||||||
result = getTypeForward(m, x)
|
result = getTypeForward(m, x)
|
||||||
pushType(m, x)
|
pushType(m, x)
|
||||||
|
of tySequence:
|
||||||
|
let x = getUniqueType(etB)
|
||||||
|
result = getTypeForward(m, x).con("*")
|
||||||
|
pushType(m, x)
|
||||||
else:
|
else:
|
||||||
result = getTypeDescAux(m, t, check)
|
result = getTypeDescAux(m, t, check)
|
||||||
|
|
||||||
|
|
@ -430,6 +434,9 @@ proc genRecordFieldsAux(m: BModule, n: PNode,
|
||||||
if fieldType.kind == tyArray and tfUncheckedArray in fieldType.flags:
|
if fieldType.kind == tyArray and tfUncheckedArray in fieldType.flags:
|
||||||
appf(result, "$1 $2[SEQ_DECL_SIZE];$n",
|
appf(result, "$1 $2[SEQ_DECL_SIZE];$n",
|
||||||
[getTypeDescAux(m, fieldType.elemType, check), sname])
|
[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:
|
else:
|
||||||
# don't use fieldType here because we need the
|
# don't use fieldType here because we need the
|
||||||
# tyGenericInst for C++ template support
|
# 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):
|
for i in countup(0, sonsLen(typ) - 1):
|
||||||
appf(desc, "$1 Field$2;$n",
|
appf(desc, "$1 Field$2;$n",
|
||||||
[getTypeDescAux(m, typ.sons[i], check), toRope(i)])
|
[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)
|
else: app(result, desc)
|
||||||
app(result, "};" & tnl)
|
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