We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8bf049f commit d1732aaCopy full SHA for d1732aa
1 file changed
test-data/unit/check-isinstance.test
@@ -3003,3 +3003,20 @@ def extract(
3003
yield values
3004
raise
3005
[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