pylint-dev / pylint-dev/astroid
Enforce inference strong updates when possible
- Dominant language
- Python
- Stars
- 582
- Forks
- 357
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
### Steps to reproduce
Run an inference over the following example:
```
options = []
if len(sys.argv) > 1:
options = [["Woof!"]]
else:
options = [["Barf!"]]
```
### Current behavior
When we try to infer `options`, we get three results: an empty list and the two values from the `if` statement.
### Expected behavior
We should only infer two lists here from the `if` statement, since the first empty list is lost after the `if` statement
### ``python -c "from astroid import __pkginfo__; print(__pkginfo__.version)"`` output
All versions.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running the Python example from the issue and tracing how inference handles the initial empty list and the two conditional assignments. Identify the inference entry point and relevant tests for list assignment merging. Done means inference returns only the two lists produced by the if branches, with regression coverage for this example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100