Describe the Bug
pyrefly is able to infer the empty container type in the following code:
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:
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:
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
Describe the Bug
pyrefly is able to infer the empty container type in the following code:
however, if chained assignment is used to save one line, then pyrefly now reports an implicit-any-empty-container error:
The chain assignment order does not matter, this also fails:
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response