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

Docgen issue with runnableExamples on specific usage of anyIt template. #17835

Closed
alaviss opened this issue Apr 24, 2021 · 1 comment · Fixed by #18082
Closed

Docgen issue with runnableExamples on specific usage of anyIt template. #17835

alaviss opened this issue Apr 24, 2021 · 1 comment · Fixed by #18082
Labels
Documentation Generation Related to documentation generation (but not content).

Comments

@alaviss
Copy link
Collaborator

alaviss commented Apr 24, 2021

Example

import std/sequtils

proc foo*(n: seq[int]): bool =
  result = anyIt(n, it == 0)

Current Output

$ nim doc test.nim
Hint: used config file '/etc/nim/nim.cfg' [Conf]
Hint: used config file '/etc/nim/config.nims' [Conf]
Hint: used config file '/etc/nim/nimdoc.cfg' [Conf]
......
sequtils.nim(721, 3) Error: runnableExamples must appear before the first non-comment statement

Additional Information

Any statement before result = will make the bug disappear.

This is causing disruptek/cps docs to not build.

$ nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-04-24
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: b667e288e27a09ce4f65166fc66a6b713350a9b6
active boot switches: -d:release -d:nimUseLinenoise -d:nativeStackTrace

Bisect shows that a807233 is the first bad commit.

/cc @timotheecour @xflywind

@alaviss alaviss added the Documentation Generation Related to documentation generation (but not content). label Apr 24, 2021
@timotheecour timotheecour changed the title Docgen issue with runnableExample on specific usage of anyIt template. Docgen issue with runnableExamples on specific usage of anyIt template. Apr 24, 2021
@timotheecour
Copy link
Member

timotheecour commented Apr 24, 2021

yes, it's a regression, but the real cause is #16993 (which is a regression itself)
2 options:

@ringabout ringabout self-assigned this Apr 25, 2021
alaviss added a commit to alaviss/cps that referenced this issue May 15, 2021
alaviss added a commit to nim-works/cps that referenced this issue May 15, 2021
timotheecour added a commit to timotheecour/Nim that referenced this issue May 24, 2021
timotheecour added a commit to timotheecour/Nim that referenced this issue May 24, 2021
@ringabout ringabout removed their assignment Jun 2, 2021
timotheecour added a commit that referenced this issue Jun 2, 2021
PMunch pushed a commit to PMunch/Nim that referenced this issue Mar 28, 2022
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).
Projects
None yet
3 participants