mirror of
https://github.com/davidhalter/parso.git
synced 2026-01-10 21:42:44 +08:00
Make sure that function executions are errors as well, see #90
This commit is contained in:
@@ -1095,5 +1095,9 @@ class _NamedExprRule(_CheckAssignmentRule):
|
|||||||
# (a.b := c)
|
# (a.b := c)
|
||||||
message = 'cannot use named assignment with attribute'
|
message = 'cannot use named assignment with attribute'
|
||||||
self.add_issue(namedexpr_test, message=message)
|
self.add_issue(namedexpr_test, message=message)
|
||||||
|
elif first_child.value == '(':
|
||||||
|
# (a[i] := x)
|
||||||
|
message = 'cannot use named assignment with function call'
|
||||||
|
self.add_issue(namedexpr_test, message=message)
|
||||||
else:
|
else:
|
||||||
self._check_assignment(first, is_namedexpr=True)
|
self._check_assignment(first, is_namedexpr=True)
|
||||||
|
|||||||
@@ -327,6 +327,7 @@ if sys.version_info[:2] >= (3, 8):
|
|||||||
'(lambda: x := 1)',
|
'(lambda: x := 1)',
|
||||||
# Case 3
|
# Case 3
|
||||||
'(a[i] := x)',
|
'(a[i] := x)',
|
||||||
|
'(a(i) := x)',
|
||||||
# Case 4
|
# Case 4
|
||||||
'(a.b := c)',
|
'(a.b := c)',
|
||||||
# Case 5
|
# Case 5
|
||||||
|
|||||||
Reference in New Issue
Block a user