fix #14698 nkRecWhen caused internalAssert in semConstructFields when generic type not mentioned in fields (#14709)
* fix #14698 nkRecWhen caused internalAssert in semConstructFields when generic type not mentioned in fields * address comment * Update compiler/semtypinst.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
parent
cac09a43ae
commit
377f716766
2 changed files with 24 additions and 1 deletions
|
|
@ -630,7 +630,10 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType =
|
|||
result = t
|
||||
|
||||
# Slow path, we have some work to do
|
||||
if result.n != nil and t.kind == tyObject:
|
||||
if t.kind == tyRef and t.len > 0 and t[0].kind == tyObject and t[0].n != nil:
|
||||
discard replaceObjBranches(cl, t[0].n)
|
||||
|
||||
elif result.n != nil and t.kind == tyObject:
|
||||
# Invalidate the type size as we may alter its structure
|
||||
result.size = -1
|
||||
result.n = replaceObjBranches(cl, result.n)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue