-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid printing continuations within import identifiers (#7744)
## Summary It turns out that _some_ identifiers can contain newlines -- specifically, dot-delimited import identifiers, like: ```python import foo\ .bar ``` At present, we print all identifiers verbatim, which causes us to retain the `\` in the formatted output. This also leads to violating some debug assertions (see the linked issue, though that's a symptom of this formatting failure). This PR adds detection for import identifiers that contain newlines, and formats them via `text` (slow) rather than `source_code_slice` (fast) in those cases. Closes #7734. ## Test Plan `cargo test`
- Loading branch information
1 parent
0df2737
commit c71ff7e
Showing
5 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters