diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 87d144dc64..75a4198a5f 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -495,12 +495,8 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = # keep documentation information: b.comment = a.comment addSon(b, newSymNode(v)) - # keep type desc for doc generator, but only if the user explicitly - # added it - if a.sons[length-2].kind != nkEmpty: - addSon(b, newNodeIT(nkType, a.info, typ)) - else: - addSon(b, a.sons[length-2]) + # keep type desc for doc generator + addSon(b, a.sons[length-2]) addSon(b, copyTree(def)) addToVarSection(c, result, n, b) else: diff --git a/compiler/transf.nim b/compiler/transf.nim index 0c3ddf27a0..b31be71a35 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -935,12 +935,11 @@ proc transform(c: PTransf, n: PNode): PTransNode = else: result = transformSons(c, n) of nkIdentDefs, nkConstDef: - when true: - result = transformSons(c, n) - else: - result = n.PTransNode - let L = n.len-1 - result[L] = transform(c, n.sons[L]) + result = PTransNode(n) + result[0] = transform(c, n[0]) + # Skip the second son since it only contains an unsemanticized copy of the + # variable type used by docgen + result[2] = transform(c, n[2]) # XXX comment handling really sucks: if importantComments(c.graph.config): PNode(result).comment = n.comment diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html index 784fbe9b70..064a700114 100644 --- a/nimdoc/testproject/expected/testproject.html +++ b/nimdoc/testproject/expected/testproject.html @@ -1244,6 +1244,14 @@ function main() { +