Skip to content

Avoid widening or promoting comprehension values #2486

@ibraheemdev

Description

@ibraheemdev

Even after #1602 is resolved, we may still fail to infer comprehensions that iterate over a list literal, e.g.,

# revealed: Unknown | str
x = [reveal_type(string) for string in ["a", "b"]]

We should always avoid literal promotion and Unknown widening here, as the list is immutable.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions