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]: private function locations are incorrectly reported by parser #24818

Open
DanilaFe opened this issue Apr 10, 2024 · 0 comments
Open

[Bug]: private function locations are incorrectly reported by parser #24818

DanilaFe opened this issue Apr 10, 2024 · 0 comments

Comments

@DanilaFe
Copy link
Contributor

DanilaFe commented Apr 10, 2024

This came up while developing #24735. The 'private' keyword doesn't seem to be included in the location of the function, which causes false positives when trying to validate indentation.

If/when this is closed, consider removing the special case in chplcheck's rules.py that works around this issue.

DanilaFe added a commit that referenced this issue Apr 11, 2024
#24830)

This PR does a few things.

1. Fixes a small bug in which `When` was listed to inherit from
`SimpleBlockLike`, but didn't. This led to some segmentation faults /
memory issues when iterating over 'statements' of 'SimpleBlockLike'
nodes.
2. Adjusts the `IncorrectIndentation` rule to skip all private and
public things, because visibility modifiers' locations are not correctly
reported by the parser
(#24818).
3. Adds a new rule for cases like this:
   ```Chapel
   enum {};
   ```
Previously, `;` (which is unnecessary here and creates a new statement),
would count as a same-line sibling to `enum`, resulting in a warning for
`IncorrectIndentation`. However, the trouble isn't that `;` is
improperly indented, but that it exists at all. Thus, the PR adds a new
linter rule for `;`s where they aren't needed.

Reviewed by @jabraham17 -- thanks!
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