Open Zaikaba opened 3 hours ago
from collections.abc import Callable from typing import NamedTuple class Bar1: def __init__( self, val: bool, fun: Callable[ [ bool ], bool ] ): self.val = val self.fun = fun # fine: "x: bool" bar1 = Bar1( True, lambda x: x ) class Bar2( NamedTuple ): val: bool fun: Callable[ [ bool ], bool ] # Type of parameter "x" is unknown bar = Bar2( True, lambda x: x )
Type check should derive (bool)->bool in both cases.
NamedTuple version fails, x is unknown.
Could someone from the pylance team please transfer this to the pyright project since this is a core type checker issue? Thanks!
Environment data
Code Snippet
Expected behavior
Type check should derive (bool)->bool in both cases.
Actual behavior
NamedTuple version fails, x is unknown.
Logs