Skip to content

Commit d1732aa

Browse files
committed
add another test
1 parent 8bf049f commit d1732aa

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test-data/unit/check-isinstance.test

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3003,3 +3003,20 @@ def extract(
30033003
yield values
30043004
raise
30053005
[builtins fixtures/primitives.pyi]
3006+
3007+
3008+
[case testIsInstanceTypeVarBoundToType]
3009+
# flags: --strict-equality --warn-unreachable
3010+
from __future__ import annotations
3011+
from typing import TypeVar, Protocol
3012+
3013+
class A(Protocol):
3014+
x: int
3015+
3016+
T = TypeVar("T", bound=type[A])
3017+
3018+
def foo(x: object, t: T):
3019+
if isinstance(x, t):
3020+
reveal_type(x) # N: Revealed type is "__main__.A"
3021+
reveal_type(x.x) # N: Revealed type is "builtins.int"
3022+
[builtins fixtures/primitives.pyi]

0 commit comments

Comments
 (0)