Closed colehaus closed 1 month ago
Thanks for the bug report. I'm able to repro, and I agree it's a bug. I'll investigate further.
As a quick note to myself, here's a stripped-down sample that exhibits the problem. If I rename Dim1
to something else, the problem goes away. Likewise, if I swap out the definition of N
for the commented-out version (which should be equivalent, in theory), the problem goes away.
from typing import Any, Generic, TypeVar, TypeVarTuple, Callable
D = TypeVar("D")
S = TypeVarTuple("S")
class N(Generic[*S, D]): ...
# class N[*S, D]:
# x: D
def func1[*S1, D1, *S2, D2, Dim1](
c: Callable[[N[*S1, D1], N[*S2, D2]], Any],
) -> Callable[[N[Dim1, *S1, D1], N[Dim1, *S2, D2]], Any]: ...
def func2[X, Y, Z](x: N[X, Y, Z], y: N[X, Y, Z]):
_ = func1(func3)(x, y)
def func3[Dim1, T](x: N[Dim1, T], y: N[Dim1, T]) -> N[T]: ...
This is addressed in pyright 1.1.380.
The preceding code type checks under 1.1.375 and Mypy. It errors under 1.1.376 with the following complaints: