-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix #14846; add macros.extractDocCommentsAndRunnables #14849
Conversation
Why not 2 |
because of interleaving; having to procs would not preserve interleaving eg: proc fn*=
## c1
runnableExamples:
discard
runnableExamples:
discard
## c2
runnableExamples:
discard
## c3
echo "start of actual code" (interleaving is supported since #14441; before that it was buggy as it dropped the doc comments after the 1st one) |
IMO docgen should simply support this pattern instead (the doc comment appearing after template definitions/other code). |
we can debate that in nim-lang/RFCs#231 but until then this PR fixes docgen for async procs; one potential problem is doc comments appearing inside proc body but not intended to be docgen'd; another one is doc comments in templates called from a proc. |
d72976f
to
c46b320
Compare
the failure is potentially caused by this PR, not sure yet 2020-06-30T18:09:23.7296506Z FAIL: tests/async/testmanyasyncevents.nim C
2020-06-30T18:09:23.7297206Z Test "tests\async\testmanyasyncevents.nim" in category "async"
2020-06-30T18:09:23.7298204Z Failure: reOutputsDiffer
2020-06-30T18:09:23.7298736Z Expected:
2020-06-30T18:09:23.7299265Z hasPendingOperations: false
2020-06-30T18:09:23.7299819Z triggerCount: 100
2020-06-30T18:09:23.7300206Z
2020-06-30T18:09:23.7300642Z Gotten:
2020-06-30T18:09:23.7301187Z hasPendingOperations: true
2020-06-30T18:09:23.7301763Z triggerCount: 68
2020-06-30T18:09:23.7302159Z |
async
which inserted doc comments after a block that added template definitions, resulting in something like:before #14439, the doc comment would be docgen'd even though the doc comment is at wrong place (after some initial non-doc comment/non-runnableExamples statement)
after #14439,
in main
correctly doesn't get docgen'dthis PR fixes async template by introducing
extractDocCommentsAndRunnables
which extracts all top-level runnableExamples and doc commentsafter this PR
after this I have another PR that removes the
awaitDefinition
block which redefinesawait
templates in each each async proc, and instead bindSym's aawait
template defined once, which simplifies the generated code