This commit is contained in:
Araq 2015-10-22 10:24:46 +02:00
commit d93507fd2e
4 changed files with 51 additions and 4 deletions

View file

@ -239,14 +239,20 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
pushInfoContext(info)
var entry = TInstantiation.new
entry.sym = result
newSeq(entry.concreteTypes, gp.len)
# we need to compare both the generic types and the concrete types:
# generic[void](), generic[int]()
# see ttypeor.nim test.
var i = 0
newSeq(entry.concreteTypes, fn.typ.len+gp.len)
for s in instantiateGenericParamList(c, gp, pt):
addDecl(c, s)
entry.concreteTypes[i] = s.typ
inc i
pushProcCon(c, result)
instantiateProcType(c, pt, result, info)
for j in 0 .. result.typ.len-1:
entry.concreteTypes[i] = result.typ.sons[j]
inc i
if tfTriggersCompileTime in result.typ.flags:
incl(result.flags, sfCompileTime)
n.sons[genericParamsPos] = ast.emptyNode