Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression: runnableExamples in template should not affect caller #16993

Closed
timotheecour opened this issue Feb 10, 2021 · 0 comments · Fixed by #18082
Closed

regression: runnableExamples in template should not affect caller #16993

timotheecour opened this issue Feb 10, 2021 · 0 comments · Fixed by #18082
Labels
Documentation Generation Related to documentation generation (but not content). Regression

Comments

@timotheecour
Copy link
Member

timotheecour commented Feb 10, 2021

reduced from CI failure in #16988

Example

# t11840b.nim:
template doAssert2*(cond: untyped) =
  ## foo
  runnableExamples:
    echo "D20210209T192323"
  discard

# main.nim:
import t11840b
doAssert2 true
doAssert2 true
doAssert2 true

nim doc main.nm

Current Output

D20210209T192323
D20210209T192323
D20210209T192323

Expected Output

(nothing)

Additional Information

worked in 0.19.0
fails since 0.19.6 including devel 1.5.1 0d34345

as an example, this prevents adding runnableExamples in doAssert (refs #16988) but obviously this affects other code, eg when adding runnableExamples to a template.

Note that transforming a proc (that would contain a runnableExamples) to a template shouldn't affect semantics wrt runnableExamples.
Also note that current behavior is bad because it makes it impossible to add runnableExamples to templates without it affecting semantics as demoed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Generation Related to documentation generation (but not content). Regression
Projects
None yet
1 participant