pass-through of static int generic params to arrays when late instantiation is disabled

This commit is contained in:
Zahary Karadjov 2013-08-23 00:42:43 +03:00
commit 8682ed9bd0
8 changed files with 31 additions and 18 deletions

View file

@ -208,6 +208,12 @@ proc ReplaceTypeVarsT*(cl: var TReplTypeVars, t: PType): PType =
of tyInt:
result = skipIntLit(t)
else:
if t.kind == tyArray:
let idxt = t.sons[0]
if idxt.kind == tyExpr and
idxt.sym != nil and idxt.sym.kind == skGenericParam:
let value = lookupTypeVar(cl, idxt).n
t.sons[0] = makeRangeType(cl.c, 0, value.intVal - 1, value.info)
if containsGenericType(t):
result = copyType(t, t.owner, false)
incl(result.flags, tfFromGeneric)