summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-01-11 02:23:39 +0100
committerAraq <rumpf_a@web.de>2015-01-11 02:23:39 +0100
commitfd10866ae301c43adff35ac427b6765f80689478 (patch)
tree3f8a58b2737fa0511fd589cf9467e440bb9df192 /compiler
parentd37ff0ab4248a4a36bffa8fbf423b4796ced8c58 (diff)
downloadNim-fd10866ae301c43adff35ac427b6765f80689478.tar.gz
fixes #1919
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semtypes.nim13
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index deb4b1288..0d7472607 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -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()