diff options
author | Zahary Karadjov <zahary@gmail.com> | 2014-03-16 17:12:30 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2014-03-16 20:42:06 +0200 |
commit | f0953db3ba59f2e23df2fb7932c672f5020db5fb (patch) | |
tree | 4d19cedca26380083c6374f8a97f3b0c0eba8892 /compiler/semtypinst.nim | |
parent | da5d88f04ef8adb7e2606fb16c6cbde770d39fe0 (diff) | |
download | Nim-f0953db3ba59f2e23df2fb7932c672f5020db5fb.tar.gz |
handle arbitrary expressions dependent on static input params in proc signatures
Diffstat (limited to 'compiler/semtypinst.nim')
-rw-r--r-- | compiler/semtypinst.nim | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index 30810a1d1..4a8a463f5 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -96,8 +96,11 @@ proc replaceTypeVarsT*(cl: var TReplTypeVars, t: PType): PType = checkMetaInvariants(cl, result) proc prepareNode(cl: var TReplTypeVars, n: PNode): PNode = + let t = replaceTypeVarsT(cl, n.typ) + if t != nil and t.kind == tyStatic and t.n != nil: + return t.n result = copyNode(n) - result.typ = replaceTypeVarsT(cl, n.typ) + result.typ = t if result.kind == nkSym: result.sym = replaceTypeVarsS(cl, n.sym) let isCall = result.kind in nkCallKinds for i in 0 .. <n.safeLen: @@ -197,10 +200,10 @@ proc replaceTypeVarsS(cl: var TReplTypeVars, s: PSym): PSym = result = copySym(s, false) incl(result.flags, sfFromGeneric) idTablePut(cl.symMap, s, result) - result.typ = replaceTypeVarsT(cl, s.typ) result.owner = s.owner + result.typ = replaceTypeVarsT(cl, s.typ) result.ast = replaceTypeVarsN(cl, s.ast) - + proc lookupTypeVar(cl: TReplTypeVars, t: PType): PType = result = PType(idTableGet(cl.typeMap, t)) if result == nil: |