diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index c7ff437e7c..5f846c80ac 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -572,7 +572,7 @@ proc eraseTupleVoidFields*(t: PType) = # found first void field, compact from here var pos = i for j in i+1..= t.n.len or t.n[j].kind != nkRecList): + if t[j].kind != tyVoid and j < t.n.len and t.n[j].kind != nkRecList: t.n[pos] = t.n[j] t[pos] = t[j] if t.n[pos].kind == nkSym: