diff options
author | Araq <rumpf_a@web.de> | 2013-08-31 11:49:33 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-08-31 11:49:33 +0200 |
commit | b40ab4dc9e4b5ee93f29864218af6b8d78fa1cc2 (patch) | |
tree | 469de1221768eccaa99a81cde0d66848c456b182 /compiler | |
parent | 1161482ec2c2d83e1cd4f24d51e19b5bde6bcc3c (diff) | |
download | Nim-b40ab4dc9e4b5ee93f29864218af6b8d78fa1cc2.tar.gz |
fixes #554, fixes #179
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semstmts.nim | 9 | ||||
-rw-r--r-- | compiler/semtypes.nim | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 0ee950faf..7e69dbd92 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -775,9 +775,12 @@ proc typeSectionFinalPass(c: PContext, n: PNode) = if aa.kind in {nkRefTy, nkPtrTy} and aa.len == 1 and aa.sons[0].kind == nkObjectTy: # give anonymous object a dummy symbol: - assert s.typ.sons[0].sym == nil - s.typ.sons[0].sym = newSym(skType, getIdent(s.name.s & ":ObjectType"), - getCurrOwner(), s.info) + var st = s.typ + if st.kind == tyGenericBody: st = st.lastSon + InternalAssert st.kind in {tyPtr, tyRef} + InternalAssert st.sons[0].sym == nil + st.sons[0].sym = newSym(skType, getIdent(s.name.s & ":ObjectType"), + getCurrOwner(), s.info) proc SemTypeSection(c: PContext, n: PNode): PNode = typeSectionLeftSidePass(c, n) diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index b02fa7c31..14f96497d 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -558,7 +558,7 @@ proc semObjectNode(c: PContext, n: PNode, prev: PType): PType = checkSonsLen(n, 3) if n.sons[1].kind != nkEmpty: base = skipTypes(semTypeNode(c, n.sons[1].sons[0], nil), skipPtrs) - var concreteBase = skipGenericInvokation(base) + var concreteBase = skipGenericInvokation(base).skipTypes(skipPtrs) if concreteBase.kind == tyObject and tfFinal notin concreteBase.flags: addInheritedFields(c, check, pos, concreteBase) else: |