Unnecessary semicolon fix removes subsequent lines #6214
Closed
Description
Consider the following snippet:
a = \
5;
We would expect that the (admittedly contrived example) would be corrected to:
a = \
5
Instead, it is corrected to:
a =
This completely removes the second half of the expression on the continuation.
thread '<unnamed>' panicked at 'Fixed source has a syntax error where the source document does not. This is a bug in one of the generated fixes:
<filename>:1:5: E999 SyntaxError: Unexpected token Newline
|
1 | a =
| ^ E999
|
Last generated fixes:
<filename>:2:4: E703 [*] Statement ends with an unnecessary semicolon
|
1 | a = \
2 | 5;
| ^ E703
|
= help: Remove unnecessary semicolon
ℹ Fix
1 |-a = \
2 |- 5;
1 |+a =
Source with applied fixes:
a =
', /home/addisoncrump/git/ruff/crates/ruff/src/test.rs:202:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted