fixes #4677 properly
This commit is contained in:
parent
1528d7c6e8
commit
0e9d12639e
1 changed files with 7 additions and 6 deletions
|
|
@ -86,7 +86,7 @@ type
|
||||||
|
|
||||||
proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType
|
proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType
|
||||||
proc replaceTypeVarsS(cl: var TReplTypeVars, s: PSym): PSym
|
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) =
|
template checkMetaInvariants(cl: TReplTypeVars, t: PType) =
|
||||||
when false:
|
when false:
|
||||||
|
|
@ -151,7 +151,7 @@ proc reResolveCallsWithTypedescParams(cl: var TReplTypeVars, n: PNode): PNode =
|
||||||
|
|
||||||
return n
|
return n
|
||||||
|
|
||||||
proc replaceTypeVarsN(cl: var TReplTypeVars, n: PNode): PNode =
|
proc replaceTypeVarsN(cl: var TReplTypeVars, n: PNode; start=0): PNode =
|
||||||
if n == nil: return
|
if n == nil: return
|
||||||
result = copyNode(n)
|
result = copyNode(n)
|
||||||
if n.typ != nil:
|
if n.typ != nil:
|
||||||
|
|
@ -195,7 +195,9 @@ proc replaceTypeVarsN(cl: var TReplTypeVars, n: PNode): PNode =
|
||||||
var length = sonsLen(n)
|
var length = sonsLen(n)
|
||||||
if length > 0:
|
if length > 0:
|
||||||
newSons(result, length)
|
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])
|
result.sons[i] = replaceTypeVarsN(cl, n.sons[i])
|
||||||
|
|
||||||
proc replaceTypeVarsS(cl: var TReplTypeVars, s: PSym): PSym =
|
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})
|
r = skipTypes(r2, {tyPtr, tyRef})
|
||||||
result.sons[i] = r
|
result.sons[i] = r
|
||||||
propagateToOwner(result, r)
|
propagateToOwner(result, r)
|
||||||
|
# bug #4677: Do not instantiate effect lists
|
||||||
if result.kind != tyProc:
|
result.n = replaceTypeVarsN(cl, result.n, ord(result.kind==tyProc))
|
||||||
result.n = replaceTypeVarsN(cl, result.n)
|
|
||||||
|
|
||||||
case result.kind
|
case result.kind
|
||||||
of tyArray:
|
of tyArray:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue