Skip to content

[fix] Prevent eliding parens in locations that require primary expressions - #986

Open
reese wants to merge 2 commits into
trunkfrom
reese-922
Open

reese wants to merge 2 commits into
trunkfrom
reese-922

Conversation

@reese

@reese reese commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #922

(Note: I'd suggest reviewing with whitespace hidden, as much of the diff in format_prism.rs is just wrapping callers with with_formatting_context.)

Eliding parens inside of certain syntactical constructs changes argument binding or otherwise causes syntax errors. In particular, there's a distinction between callers which allow for command-style calls (raise "foo") and those which require primary expressions, i.e. expressions which are self-enclosing.

This PR wraps several of callers with additional formatting context to prevent the removal of parentheses for special-cased names (describe, it, raise, etc.) when they're in positions that require parens, such as in the middle of argument lists, call chains, and so forth.

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.

Behavior Change: Parentheses Removed from raise, describe, etc., Changing Arguments, Breaking Code

1 participant