You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pyrefly says explicit Any type parameters can be subclassed but not **kwargs entries with explicit Any type #5422
Hello Pyrefly team!
Thanks so much for all you do. I am sharing the following bug report in the hopes it is useful to you in achieving consistency in the tool behavior and parity with other type checkers like pyright.
In Python and passing some other type checkers (e.g. pyright 1.1.414 commandline and the pyright playground ) it is ok to subclass an entry passed within the **kwargs which is typed as Any, but Pyrefly is rejecting it (seems like a bug).
fromtypingimportUnpack, TypedDict, Any, reveal_typeclassPerson(TypedDict):
name: strage: intsome_any_field: Anydeffoo(arg: bool, arg_any: Any, **kwargs: Unpack[Person]) ->None:
reveal_type(kwargs['name'])
reveal_type(arg_any)
reveal_type(kwargs['some_any_field'])
classSub0(arg_any): pass# pyrefly says this Any typed argument is ok as a base classclassSub1(kwargs['some_any_field']): pass# like mypy (a bug I think) and unlike pyright, pyrefly does not recognize a kwargs entry with an explicit `Any` type as a valid base (a bug I think)# comment out just the Sub1 declaration and Pyrefly will say this is ok
Python: 3.12
See also #5397 for analogous problem with *args entries which are explicitly Any typed not being allowed as class bases.
Activity