microsoft / pyright

Static Type Checker for Python
Other
13.12k stars 1.4k forks source link

type error on `map` #8697

Open uf-fipper opened 1 month ago

uf-fipper commented 1 month ago

Environment data

Code Snippet

a: list[int | None] = [1, 2, 3, None]
b = map(lambda x: x or 0, a)

Expected behavior

type(b) == map[int]

Actual behavior

image

image

erictraut commented 1 month ago

Could someone from the pylance team please transfer this to the pyright project since it's a core type checking issue? Thanks!