This commit is contained in:
Araq
2015-01-11 02:23:39 +01:00
parent d37ff0ab42
commit fd10866ae3
2 changed files with 26 additions and 6 deletions

View File

@@ -608,12 +608,6 @@ proc addInheritedFieldsAux(c: PContext, check: var IntSet, pos: var int,
incl(check, n.sym.name.id)
inc(pos)
else: internalError(n.info, "addInheritedFieldsAux()")
proc addInheritedFields(c: PContext, check: var IntSet, pos: var int,
obj: PType) =
if (sonsLen(obj) > 0) and (obj.sons[0] != nil):
addInheritedFields(c, check, pos, obj.sons[0])
addInheritedFieldsAux(c, check, pos, obj.n)
proc skipGenericInvokation(t: PType): PType {.inline.} =
result = t
@@ -622,6 +616,13 @@ proc skipGenericInvokation(t: PType): PType {.inline.} =
if result.kind == tyGenericBody:
result = lastSon(result)
proc addInheritedFields(c: PContext, check: var IntSet, pos: var int,
obj: PType) =
assert obj.kind == tyObject
if (sonsLen(obj) > 0) and (obj.sons[0] != nil):
addInheritedFields(c, check, pos, obj.sons[0].skipGenericInvokation)
addInheritedFieldsAux(c, check, pos, obj.n)
proc semObjectNode(c: PContext, n: PNode, prev: PType): PType =
if n.sonsLen == 0: return newConstraint(c, tyObject)
var check = initIntSet()

View File

@@ -0,0 +1,19 @@
discard """
output: '0.0'
"""
# bug #1919
type
Base[M] = object of RootObj
a : M
Sub1[M] = object of Base[M]
b : int
Sub2[M] = object of Sub1[M]
c : int
var x: Sub2[float]
echo x.a