support derived values in non-generic user type classes

This commit is contained in:
Zahary Karadjov 2016-08-11 09:09:15 +03:00
commit 0b0a3e5f20
7 changed files with 59 additions and 47 deletions

View file

@ -175,7 +175,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
result.add mapTypeToAst(t.sons[i], info)
else:
result = mapTypeToAstX(t.lastSon, info, inst, allowRecursion)
of tyGenericBody, tyOrdinal, tyUserTypeClassInst:
of tyGenericBody, tyOrdinal:
result = mapTypeToAst(t.lastSon, info)
of tyDistinct:
if inst:
@ -285,9 +285,12 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
of tyProxy: result = atomicType("error", mNone)
of tyBuiltInTypeClass:
result = mapTypeToBracket("builtinTypeClass", mNone, t, info)
of tyUserTypeClass:
result = mapTypeToBracket("concept", mNone, t, info)
result.add t.n.copyTree
of tyUserTypeClass, tyUserTypeClassInst:
if t.isResolvedUserTypeClass:
result = mapTypeToAst(t.lastSon, info)
else:
result = mapTypeToBracket("concept", mNone, t, info)
result.add t.n.copyTree
of tyCompositeTypeClass:
result = mapTypeToBracket("compositeTypeClass", mNone, t, info)
of tyAnd: result = mapTypeToBracket("and", mAnd, t, info)