Add issue 'keyword can't be an expression'

This commit is contained in:
Dave Halter
2017-07-25 00:58:08 +02:00
parent 6085c91df1
commit 00bc1a5b94
2 changed files with 5 additions and 0 deletions

View File

@@ -231,6 +231,10 @@ class ErrorFinder(Normalizer):
self._add_syntax_error(message, lhs.parent) self._add_syntax_error(message, lhs.parent)
else: else:
self._add_syntax_error(message % type_, lhs.parent) self._add_syntax_error(message % type_, lhs.parent)
elif node.type == 'argument':
if node.children[1] == '=' and node.children[0].type != 'name':
message = "keyword can't be an expression"
self._add_syntax_error(message, node.children[0])
yield yield

View File

@@ -90,6 +90,7 @@ def test_indentation_errors(code, positions):
'(a, b): int', '(a, b): int',
'*star,: int', '*star,: int',
'a, b: int = 3', 'a, b: int = 3',
'foo(+a=3)',
# IndentationError # IndentationError
' foo', ' foo',