-
-
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
Doc Comment in Template Causes Compilation Failure #13511
Comments
related:
in all cases, a template is involved, and the added doc comment affects semantics proposal
template myquit2*():untyped=
## foo
quit(1)
template insertSomeComment*(msg, body):untyped=
## this is a helper proc to create a doc comment
## those litteral doc comment lines won't be forwarded as per this RFC
## however `astDocComment(msg)` will be forwarded as a doc comment to instantiating scope
astDocComment("current nim: " & NimVersion & " " & msg) # this creates a doc comment node for instantiation scope
body
template bar*():untyped=
insertSomeComment("this is bar"): echo "implementation of `bar`" in this case
|
Why not patch vmgen and friends so that it works? |
what does |
Well it's a bug, do we know for certain it's so hard to fix that we need to change once again how the AST looks like? |
…support for addr (nim-lang#16002) * fix nim-lang#14339: fixes limited VM support for addr * strengthen test * reference bug nim-lang#16003 * also fixes nim-lang#13511 * also fixes nim-lang#14420
…support for addr (nim-lang#16002) * fix nim-lang#14339: fixes limited VM support for addr * strengthen test * reference bug nim-lang#16003 * also fixes nim-lang#13511 * also fixes nim-lang#14420
A doc comment in the template
foo
causes a compilation failure.Example
Current Output
If I delete the doc comment, or convert it to a normal comment, the output is the following:
The only difference here is, the
StmtListExpr
is missing.Possible Solution
Additional Information
If this would be my code, I could easily work around this bug. Builder is a
ref
object and passed as avar
parameter. This is not necessary and removing either theref
or thevar
would fix this specific problem as well. But that is how argparse is implemented and works. My part is the template with the doc comment. The template is insystem.nim
and I don't like the idea to remove the doc comment. Other people would make a PR to introduce it again and then wonder why CI fails.The text was updated successfully, but these errors were encountered: