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 770c5d0 commit 29e77f1Copy full SHA for 29e77f1
1 file changed
test-data/unit/check-narrowing.test
@@ -3021,6 +3021,15 @@ if type(x) is not int:
3021
else:
3022
reveal_type(x) # N: Revealed type is "builtins.int"
3023
3024
+[case testTypeNarrowingAgainstType]
3025
+# flags: --strict-equality --warn-unreachable
3026
+class A:
3027
+ def foo(self, x: object) -> None:
3028
+ reveal_type(self) # N: Revealed type is "__main__.A"
3029
+ if type(self) is type(x):
3030
3031
+ reveal_type(x) # N: Revealed type is "__main__.A"
3032
+
3033
[case testNarrowInElseCaseIfFinal]
3034
# flags: --strict-equality --warn-unreachable
3035
from typing import final, Union
0 commit comments