pyright icon indicating copy to clipboard operation
pyright copied to clipboard

Incorrect handling of class that is a subtype of multiple constraints in a value-constrained TypeVar

Open erictraut opened this issue 6 months ago • 0 comments

The following should type check without errors:

from typing import TypeVar, reveal_type

class A:
    ...

class B:
    ...

class C(A, B):
    ...

T = TypeVar("T", A, B)

def test(a: T, b: T):
    ...

test(A(), C())
test(B(), C()) # False positive error

erictraut avatar Aug 01 '24 06:08 erictraut