Skip to content

used-before-assignment with := in dict node #8125

Closed
@cdce8p

Description

@cdce8p

Bug description

#4828 (comment)

def func(): ...
y = {
    0: x if (x := func()) else "",
}

Configuration

No response

Command used

pylint test.py

Pylint output

test.py:3:7: E0601: Using variable 'x' before assignment (used-before-assignment)

Expected behavior

No error

Pylint version

pylint 2.16.0b1
astroid 2.14.0-dev0
Python 3.11.1

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Assignment expressionRelated to the walrus operator / assignment expressionC: used-before-assignmentIssues related to 'used-before-assignment' checkFalse Positive 🦟A message is emitted but nothing is wrong with the codepython 3.8

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions