Fix: Dedent omission was wrong, see davidhalter/jedi#1499

This commit is contained in:
Dave Halter
2020-03-22 01:25:45 +01:00
parent 287a86c242
commit 2cd0d6c9fc
3 changed files with 70 additions and 4 deletions

View File

@@ -129,7 +129,7 @@ class Parser(BaseParser):
or token.type == DEDENT and '\n' not in last_leaf.value
and '\r' not in last_leaf.value):
# In Python statements need to end with a newline. But since it's
# possible (and valid in Python ) that there's no newline at the
# possible (and valid in Python) that there's no newline at the
# end of a file, we have to recover even if the user doesn't want
# error recovery.
if self.stack[-1].dfa.from_rule == 'simple_stmt':
@@ -208,6 +208,7 @@ class Parser(BaseParser):
o = self._omit_dedent_list
if o and o[-1] == self._indent_counter:
o.pop()
self._indent_counter -= 1
continue
self._indent_counter -= 1