-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
Mypy 1.6.1 didn't produce any errors in this code, but 1.7.0 does.
Link to mypy playground
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.
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong