From e26545797e23b40cd857f7ccba63919cb87ed51b Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Wed, 15 May 2019 21:12:07 +0200 Subject: [PATCH] fixes #7816 (#11261) --- compiler/renderer.nim | 2 +- compiler/semtypinst.nim | 1 + tests/stdlib/tsugar.nim | 11 ++++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/compiler/renderer.nim b/compiler/renderer.nim index 115fd0201..b51bd3162 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -943,7 +943,7 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) = of nkCharLit: put(g, tkCharLit, atom(g, n)) of nkNilLit: put(g, tkNil, atom(g, n)) # complex expressions of nkCall, nkConv, nkDotCall, nkPattern, nkObjConstr: - if n.len > 0 and isBracket(n[0]): + if renderIds notin g.flags and n.len > 0 and isBracket(n[0]): gsub(g, n, 1) put(g, tkBracketLe, "[") gcomma(g, n, 2) diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index 85d0b1c5a..479f88bf0 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -201,6 +201,7 @@ proc replaceTypeVarsN(cl: var TReplTypeVars, n: PNode; start=0): PNode = case n.kind of nkNone..pred(nkSym), succ(nkSym)..nkNilLit: discard + of nkOpenSymChoice, nkClosedSymChoice: result = n of nkSym: result.sym = replaceTypeVarsS(cl, n.sym) if result.sym.typ.kind == tyVoid: diff --git a/tests/stdlib/tsugar.nim b/tests/stdlib/tsugar.nim index 111ca96a4..5006cf52b 100644 --- a/tests/stdlib/tsugar.nim +++ b/tests/stdlib/tsugar.nim @@ -1,5 +1,5 @@ discard """ - output: "" + output: "@[@[], @[], @[], @[], @[]]" """ import sugar import macros @@ -26,3 +26,12 @@ block distinctBase: Uint[bits: static[int]] = distinct uintImpl(bits) doAssert Uint[128].distinctBase is UintImpl[uint64] + +# bug #7816 +import sequtils + +proc tester[T](x: T) = + let test = toSeq(0..4).map(i => newSeq[int]()) + echo test + +tester(1)