Commit 6fe80093 authored by Michael J. Sullivan's avatar Michael J. Sullivan Committed by Jelle Zijlstra
Browse files

Fix issue with type comments on lines with trailing commas (#1058)

The code introduced in #1027 to detect whether a type comment appeared
after a regular comment in a Line would spuriously misfire when a leaf
was in the comments dict but had an empty list of comments. This can
occur as an artifact of how comments on trailing commas are handled,
it seems.

(This was discovered trying to test black out on mypy.)
parent d9e71a75
Loading
Loading
Loading
Loading
+3 −0
Changes for tests/data/comments2.py: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ def inline_comments_in_brackets_ruin_everything():
        ],
    )

CONFIG_FILES = [CONFIG_FILE, ] + SHARED_CONFIG_FILES + USER_CONFIG_FILES  # type: Final

#######################
### SECTION COMMENT ###
@@ -313,6 +314,8 @@ def inline_comments_in_brackets_ruin_everything():
    )


CONFIG_FILES = [CONFIG_FILE] + SHARED_CONFIG_FILES + USER_CONFIG_FILES  # type: Final

#######################
### SECTION COMMENT ###
#######################
+1 −1

File changed.

Contains only whitespace changes.