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

[Bug]: Parser loses docstring when preceding function has do if #25790

Open
jabraham17 opened this issue Aug 20, 2024 · 0 comments
Open

[Bug]: Parser loses docstring when preceding function has do if #25790

jabraham17 opened this issue Aug 20, 2024 · 0 comments

Comments

@jabraham17
Copy link
Member

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() { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant