Summary
The roc fmt command crashes when encountering an inline definition inside parentheses followed by a method call, such as (x = 5).foo(). Instead of gracefully handling the parse error or preserving the original code, the formatter fails entirely.
Minimal Reproduction
Expected Behavior
The formatter should either:
- Report a clear syntax error indicating that inline definitions in expression context are not supported
- Gracefully preserve the original code when it cannot parse/format it
Actual Behavior
The formatter fails with cascading parse errors:
expected_expr_close_round_or_comma, at token CloseRound
Snapshot Test
A minimal reproduction test/snapshots/expr/inline_def_in_parens.md is attached
inline_def_in_parens.md
Summary
The
roc fmtcommand crashes when encountering an inline definition inside parentheses followed by a method call, such as(x = 5).foo(). Instead of gracefully handling the parse error or preserving the original code, the formatter fails entirely.Minimal Reproduction
Expected Behavior
The formatter should either:
Actual Behavior
The formatter fails with cascading parse errors:
Snapshot Test
A minimal reproduction
test/snapshots/expr/inline_def_in_parens.mdis attachedinline_def_in_parens.md