-
Notifications
You must be signed in to change notification settings - Fork 2.8k
is_type_comment() is wrong #2097
Copy link
Copy link
Closed
Labels
F: commentsThe syntactic kind. Not in the language grammar, always on our minds. Best bugs.The syntactic kind. Not in the language grammar, always on our minds. Best bugs.T: bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Metadata
Metadata
Assignees
Labels
F: commentsThe syntactic kind. Not in the language grammar, always on our minds. Best bugs.The syntactic kind. Not in the language grammar, always on our minds. Best bugs.T: bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Currently, the implementation of
is_type_comment()looks like this:But this is wrong, because typed-ast also recognizes a comment with multiple spaces after the
#as a type comment. Concretely this could lead Black to skip some of the checks we have to avoid moving type comments to the wrong line.Ideally, Black should also standardize the formatting of type comments by cleaning up excessive whitespace after the
#and after the:.