implicit-any-empty-container raised on chained assignment
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the Bug
pyrefly is able to infer the empty container type in the following code:
```python
key: str = "foo"
table: dict[str, dict[str, int]] = {}
foo = table.get(key, None)
if foo is None:
foo = {}
table[key] = foo
```
however, if chained assignment is used to save one line, then pyrefly now reports an implicit-any-empty-container error:
```python
key: str = "foo"
table: dict[str, dict[str, int]] = {}
foo = table.get(key, None)
if foo is None:
foo = table[key] = {} # pyrefly reports error here
```
The chain assignment order does not matter, this also fails:
```python
key: str = "foo"
table: dict[str, dict[str, int]] = {}
foo = table.get(key, None)
if foo is None:
table[key] = foo = {} # pyrefly reports error here
```
### Sandbox Link
_No response_
### (Only applicable for extension issues) IDE Information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.