diff options
author | Araq <rumpf_a@web.de> | 2015-07-03 00:06:13 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-07-03 00:20:33 +0200 |
commit | 3df9d2bd0ce3e7af872cb99cae96d8108510b64c (patch) | |
tree | 6ec61e185b2c47939f71fff4cae9074e517d45a6 | |
parent | dc65f9a5f787a14c8aef615104050d938dfa77f2 (diff) | |
download | Nim-3df9d2bd0ce3e7af872cb99cae96d8108510b64c.tar.gz |
fixes #2540
-rw-r--r-- | compiler/semtypinst.nim | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index c5caf8b92..fc7807228 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -440,8 +440,14 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType = for i in countup(0, sonsLen(result) - 1): if result.sons[i] != nil: - result.sons[i] = replaceTypeVarsT(cl, result.sons[i]) - propagateToOwner(result, result.sons[i]) + var r = replaceTypeVarsT(cl, result.sons[i]) + if result.kind == tyObject: + # carefully coded to not skip the precious tyGenericInst: + let r2 = r.skipTypes({tyGenericInst}) + if r2.kind in {tyPtr, tyRef}: + r = skipTypes(r2, {tyPtr, tyRef}) + result.sons[i] = r + propagateToOwner(result, r) result.n = replaceTypeVarsN(cl, result.n) |