generic types can be used like type classes. distinct can be applied to type classes.

This commit is contained in:
Zahary Karadjov 2012-03-25 20:55:21 +03:00
commit bc2eb0ea9b
11 changed files with 147 additions and 79 deletions

View file

@ -20,7 +20,7 @@ proc instantiateGenericParamList(c: PContext, n: PNode, pt: TIdTable,
if a.kind != nkSym:
InternalError(a.info, "instantiateGenericParamList; no symbol")
var q = a.sym
if q.typ.kind notin {tyTypeDesc, tyGenericParam}: continue
if q.typ.kind notin {tyTypeDesc, tyGenericParam, tyTypeClass}: continue
var s = newSym(skType, q.name, getCurrOwner())
s.info = q.info
s.flags = s.flags + {sfUsed, sfFromGeneric}
@ -107,8 +107,6 @@ proc sideEffectsCheck(c: PContext, s: PSym) =
s.ast.sons[genericParamsPos].kind == nkEmpty:
c.threadEntries.add(s)
template nimdbg: expr = c.filename.endsWith"nimdbg.nim"
proc applyConcreteTypesToSig(genericProc: PSym, concTypes: seq[PType]): PType =
# XXX: This is intended to replace the use of semParamList in generateInstance.
# The results of semParamList's analysis are already encoded in the original