Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect space before colon in if/while stmts #1655

Merged
merged 2 commits into from Aug 31, 2020

Commits on Aug 29, 2020

  1. Fix incorrect space before colon in if/while stmts

    Previously Black would format this code
    
    ```
    if (foo := True):
    	print(foo)
    ```
    
    as
    
    ```
    if (foo := True) :
    	print(foo)
    ```
    
    adding an incorrect space after the RPAR. Buggy code in the
    normalize_invisible_parens function caused the colon to be wrapped in
    invisible parentheses. The LPAR of that pair was then prefixed with a
    single space at the request of the whitespace function.
    
    This commit fixes the accidental skipping of a pre-condition check
    which must return True before parenthesis normalization of a specific
    child Leaf or Node can happen. The pre-condition check being skipped
    was why the colon was wrapped in invisible parentheses.
    ichard26 committed Aug 29, 2020
    Copy the full SHA
    3cde63a View commit details
    Browse the repository at this point in the history
  2. Add an entry in CHANGES.md

    ichard26 committed Aug 29, 2020
    Copy the full SHA
    188814d View commit details
    Browse the repository at this point in the history