diff --git a/compiler/sem/semexprs.nim b/compiler/sem/semexprs.nim index e98531714e9..66dbc8bac7e 100644 --- a/compiler/sem/semexprs.nim +++ b/compiler/sem/semexprs.nim @@ -3148,39 +3148,49 @@ proc semTuplePositionsConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = "expected nkTupleConstr, got: " & $n.kind) let - tupExp = n # we don't modify n, but compute the type: + tupExp = shallowCopy(n) typ = newTypeS(tyTuple, c) # leave typ.n nil! - for i in 0.. 0: # don't interpret () as type - isTupleType = tupExp[0].typ.kind == tyTypeDesc + let isTupleType = tupExp[0].typ.kind == tyTypeDesc # check if either everything or nothing is tyTypeDesc for i in 1..