chapel
chapel copied to clipboard
[Bug]: Parser loses docstring when preceding function has `do if`
Summary of Problem
Description:
The parser seems to mistakenly lose the docstring for a function if the preceding function has do if
as the body of the function. This means that tools (like chpldoc and CLS) which use the parser output are missing the comment and treat the function as not having a docstring.
Is this issue currently blocking your progress?
no, rewriting the function to not use do
works around this
Steps to Reproduce
The following code demonstrates the issue. Compiled with chpldoc foo.chpl
. The output is missing doc bar
/* doc foo */
proc foo() do if false then ;
/* doc bar */
proc bar() { }
.. function:: proc foo()
doc foo
.. function:: proc bar()
Note that doc bar
is missing.
The following variations do correctly get doc bar
in the output. This indicates to me that to problem is specifically with do if
without an else
.
/* doc foo */
proc foo() do if false then ; else ;
/* doc bar */
proc bar() { }
/* doc foo */
proc foo() do { if false then ; }
/* doc bar */
proc bar() { }
/* doc foo */
proc foo() { if false then ; }
/* doc bar */
proc bar() { }
/* doc foo */
proc foo() do ;
/* doc bar */
proc bar() { }