diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-09-03 11:03:07 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-09-03 11:12:19 +0200 |
commit | 0e9d12639eb896797696925f84ad773a5906d980 (patch) | |
tree | 0f2df8cb2a5620d7a6b100cde658cd800dc69d7d /compiler | |
parent | 1528d7c6e8ede680e3810ffcf538ca5fda9abfc2 (diff) | |
download | Nim-0e9d12639eb896797696925f84ad773a5906d980.tar.gz |
fixes #4677 properly
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semtypinst.nim | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index b809afab6..b42d58474 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -86,7 +86,7 @@ type proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType proc replaceTypeVarsS(cl: var TReplTypeVars, s: PSym): PSym -proc replaceTypeVarsN*(cl: var TReplTypeVars, n: PNode): PNode +proc replaceTypeVarsN*(cl: var TReplTypeVars, n: PNode; start=0): PNode template checkMetaInvariants(cl: TReplTypeVars, t: PType) = when false: @@ -151,7 +151,7 @@ proc reResolveCallsWithTypedescParams(cl: var TReplTypeVars, n: PNode): PNode = return n -proc replaceTypeVarsN(cl: var TReplTypeVars, n: PNode): PNode = +proc replaceTypeVarsN(cl: var TReplTypeVars, n: PNode; start=0): PNode = if n == nil: return result = copyNode(n) if n.typ != nil: @@ -195,7 +195,9 @@ proc replaceTypeVarsN(cl: var TReplTypeVars, n: PNode): PNode = var length = sonsLen(n) if length > 0: newSons(result, length) - for i in countup(0, length - 1): + if start > 0: + result.sons[0] = n.sons[0] + for i in countup(start, length - 1): result.sons[i] = replaceTypeVarsN(cl, n.sons[i]) proc replaceTypeVarsS(cl: var TReplTypeVars, s: PSym): PSym = @@ -462,9 +464,8 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType = r = skipTypes(r2, {tyPtr, tyRef}) result.sons[i] = r propagateToOwner(result, r) - - if result.kind != tyProc: - result.n = replaceTypeVarsN(cl, result.n) + # bug #4677: Do not instantiate effect lists + result.n = replaceTypeVarsN(cl, result.n, ord(result.kind==tyProc)) case result.kind of tyArray: |