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.)
This commit is contained in:
Michael J. Sullivan 2019-10-10 11:50:51 -07:00 committed by Jelle Zijlstra
parent d9e71a75cc
commit 6fe800933d
2 changed files with 4 additions and 1 deletions

View File

@ -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 ###
#######################