improved support for typedesc values

* can be stored in constants and variables (including in containers like sequences)
* can be passed to and returned from macros
This commit is contained in:
Zahary Karadjov 2012-09-25 00:22:32 +03:00
commit badb6c0f66
11 changed files with 90 additions and 79 deletions

View file

@ -271,7 +271,7 @@ proc matchTypeClass(c: var TCandidate, typeClass, t: PType): TTypeRelation =
of tyTypeClass:
match = matchTypeClass(c, req, t) == isGeneric
else: nil
elif t.kind in {tyTypeDesc, tyObject}:
elif t.kind in {tyObject}:
match = sameType(t, req)
if tfAny in typeClass.flags:
@ -659,7 +659,8 @@ proc ParamTypesMatchAux(c: PContext, m: var TCandidate, f, a: PType,
of isGeneric:
inc(m.genericMatches)
if m.calleeSym != nil and m.calleeSym.kind in {skMacro, skTemplate}:
result = argOrig
if f.kind == tyTypeDesc: result = arg
else: result = argOrig
else:
result = copyTree(arg)
result.typ = getInstantiatedType(c, arg, m, f)