From e64dde734bbc3075f1251b902640d8303808d827 Mon Sep 17 00:00:00 2001
From: Jasper Jenkins
Date: Tue, 23 Apr 2019 05:20:27 -0700
Subject: [PATCH] Fixes #11078 (#11079)
* Fixes #11078
* Move to existing runnableExamples, update the expected html.
* Remove second comment token.
---
compiler/sempass2.nim | 2 +-
nimdoc/testproject/expected/testproject.html | 4 +++-
nimdoc/testproject/testproject.nim | 2 ++
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index e5b12e228..7fd2bd5b6 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -832,7 +832,7 @@ proc track(tracked: PEffects, n: PNode) =
createTypeBoundOps(tracked.c, it.typ, it.info)
let iterCall = n[n.len-2]
let loopBody = n[n.len-1]
- if tracked.owner.kind != skMacro and iterCall.len > 1:
+ if tracked.owner.kind != skMacro and iterCall.safelen > 1:
# XXX this is a bit hacky:
if iterCall[1].typ != nil and iterCall[1].typ.skipTypes(abstractVar).kind notin {tyVarargs, tyOpenArray}:
createTypeBoundOps(tracked.c, iterCall[1].typ, iterCall[1].info)
diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html
index c562e731e..504b64a69 100644
--- a/nimdoc/testproject/expected/testproject.html
+++ b/nimdoc/testproject/expected/testproject.html
@@ -878,7 +878,9 @@ function main() {
subdir / subdir_b / utils
doAssert bar(3, 4) == 7
-foo(enumValueA, enumValueB)
+foo(enumValueA, enumValueB)
+for x in "xx":
+ discard
diff --git a/nimdoc/testproject/testproject.nim b/nimdoc/testproject/testproject.nim
index d6fac4751..32bf286e8 100644
--- a/nimdoc/testproject/testproject.nim
+++ b/nimdoc/testproject/testproject.nim
@@ -6,6 +6,8 @@ runnableExamples:
import subdir / subdir_b / utils
doAssert bar(3, 4) == 7
foo(enumValueA, enumValueB)
+ # bug #11078
+ for x in "xx": discard
template foo*(a, b: SomeType) =