summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim9
1 files changed, 6 insertions, 3 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)