diff options
author | Jason Beetham <beefers331@gmail.com> | 2021-09-30 08:55:43 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-30 16:55:43 +0200 |
commit | f915b3aa86929d87e162b6ddd7589e6337a30397 (patch) | |
tree | 145681372e5c59cf5ffd468507b96bee76d85a5b /compiler | |
parent | c38ab3e257fbb08622f9ec6f0068a0fd3a5d82d7 (diff) | |
download | Nim-f915b3aa86929d87e162b6ddd7589e6337a30397.tar.gz |
Alternative to #18928 (#18931)
* fixed #18841 * Added test
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semtypinst.nim | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index 2ca355e7d..0bb53e04d 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -344,11 +344,7 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType = x = lookupTypeVar(cl, x) if x != nil: if header == t: header = instCopyType(cl, t) - header[i] = - if x.kind == tyGenericInst: - t[i] - else: - x + header[i] = x propagateToOwner(header, x) else: propagateToOwner(header, x) @@ -382,7 +378,11 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType = cl.typeMap = newTypeMapLayer(cl) for i in 1..<t.len: - var x = replaceTypeVarsT(cl, header[i]) + var x = replaceTypeVarsT(cl): + if header[i].kind == tyGenericInst: + t[i] + else: + header[i] assert x.kind != tyGenericInvocation header[i] = x propagateToOwner(header, x) |