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

Fix formatting of nodes with no non-error children #96

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

bbannier
Copy link
Member

@bbannier bbannier commented Dec 9, 2024

When formatting a Node's child we allowed omitting passing in of the child to format. In that case the user would pass a None child and we would attempt to default to formatting the next non-error child. The helper we used to get that child could still return None (in case there were only error children remaining, or on incorrect use of the function when the node had no children), but we never handled that case; instead we would have surfaced an AttributeError like

AttributeError: 'NoneType' object has no attribute 'prev_error_siblings'

With this path we explicitly skip any child formatting if we found no child to be formatted.

When formatting a `Node`'s child we allowed omitting passing in of the
child to format. In that case the user would pass a `None` child and we
would attempt to default to formatting the next non-error child. The
helper we used to get that child could still return `None` (in case
there were only error children remaining, or on incorrect use of the
function when the node had no children), but we never handled that case;
instead we would have surfaced an `AttributeError` like

```
AttributeError: 'NoneType' object has no attribute 'prev_error_siblings'
```

With this path we explicitly skip any child formatting if we found no
child to be formatted.
@bbannier bbannier self-assigned this Dec 9, 2024
@bbannier bbannier marked this pull request as ready for review December 9, 2024 12:40
@bbannier bbannier requested a review from awelzel December 9, 2024 12:40
Copy link

@awelzel awelzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤠

@bbannier bbannier merged commit 3d4d6b9 into main Dec 9, 2024
7 checks passed
@bbannier bbannier deleted the topic/bbannier/format-no-non-error-children branch December 9, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants