Fix spurious space after unary expression

This happened when the operand was a complex expression.

Fixes #15
This commit is contained in:
Łukasz Langa 2018-03-15 14:54:37 -07:00 committed by Lukasz Langa
parent da3c2f3582
commit 5370714c96
3 changed files with 11 additions and 0 deletions

View File

@ -257,6 +257,12 @@ You can still try but prepare to be disappointed.
* fixed spurious space in parenthesized set expressions (#7)
* fixed spurious space after opening parentheses and in default
arguments (#14, #17)
* fixed spurious space after unary operators when the operand was
a complex expression (#15)
### 18.3a0

View File

@ -815,6 +815,9 @@ def whitespace(leaf: Leaf) -> str:
if prevp.parent and prevp.parent.type == syms.subscript:
return NO
elif prevp.parent and prevp.parent.type == syms.factor:
return NO
elif prev.type in OPENING_BRACKETS:
return NO

View File

@ -31,6 +31,7 @@
-1
~int and not v1 ^ 123 + v2 | True
(~int) and (not ((v1 ^ (123 + v2)) | True))
flags & ~ select.EPOLLIN and waiters.write_task is not None
lambda arg: None
lambda a=True: a
lambda a, b, c=True: a
@ -155,6 +156,7 @@ async def f():
-1
~int and not v1 ^ 123 + v2 | True
(~int) and (not ((v1 ^ (123 + v2)) | True))
flags & ~select.EPOLLIN and waiters.write_task is not None
lambda arg: None
lambda a=True: a
lambda a, b, c=True: a