diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index e3c6fb1090..757076f850 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -257,6 +257,22 @@ proc isRecursiveType(t: PType, cycleDetector: var IntSet): bool = else: return false +proc annotateClosureConv(n: PNode) = + case n.kind + of {nkNone..nkNilLit}: + discard + of nkTupleConstr: + if n.typ.kind == tyProc and n.typ.callConv == ccClosure and + n[0].typ.kind == tyProc and n[0].typ.callConv != ccClosure: + # restores `transf.generateThunk` + n[0] = newTreeIT(nkHiddenSubConv, n[0].info, n.typ, + newNodeI(nkEmpty, n[0].info), n[0]) + n.transitionSonsKind(nkClosure) + n.flags.incl nfTransf + else: + for i in 0..