Mypy 1.6.1 didn't produce any errors in this code, but 1.7.0 does. Link to [mypy playground](https://mypy-play.net/?mypy=1.7.0&python=3.11&gist=135eba4b938aea41286374cfcf962db0) ```python from typing import Callable, Generic, TypeVar A = TypeVar("A") B = TypeVar("B") class Gen(Generic[A]): ... def id_(x: A) -> A: raise NotImplementedError() def bstep( x: Gen[A], y: A, ) -> Gen[Gen[A]]: raise NotImplementedError() def bfn( x: Gen[Gen[A]], ) -> Gen[A]: return bfn_generic(x, id_, bstep) # False positive error here def bfn_generic( x: Gen[A], id_: Callable[[B], B], step: Callable[[A, B], Gen[A]], ) -> A: raise NotImplementedError() ``` Note that pyright has a similar bug in its constraint solver, which is how I became aware of this issue. Here's the [original pyright bug report](https://github.com/microsoft/pyright/issues/5855).
Activity
Use namespaces for function type variables (#17311)