File tree Expand file tree Collapse file tree 5 files changed +18
-20
lines changed Expand file tree Collapse file tree 5 files changed +18
-20
lines changed Original file line number Diff line number Diff line change @@ -1765,10 +1765,8 @@ def f(x):
17651765 r10 :: object
17661766 r11 :: object[1]
17671767 r12 :: object_ptr
1768- r13, r14 :: object
1769- r15 :: i32
1770- r16 :: bit
1771- r17, r18 :: bool
1768+ r13 :: object
1769+ r14 :: bool
17721770L0:
17731771 r0 = __main__.Foo :: type
17741772 r1 = PyObject_IsInstance(x, r0)
@@ -1792,13 +1790,9 @@ L2:
17921790 goto L8
17931791L3:
17941792L4:
1795- r14 = box(bool, 0)
1796- r15 = PyObject_IsTrue(r14)
1797- r16 = r15 >= 0 :: signed
1798- r17 = truncate r15: i32 to builtins.bool
1799- if r17 goto L6 else goto L5 :: bool
1793+ if 0 goto L6 else goto L5 :: bool
18001794L5:
1801- r18 = raise AssertionError('Unreachable')
1795+ r14 = raise AssertionError('Unreachable')
18021796 unreachable
18031797L6:
18041798 goto L8
Original file line number Diff line number Diff line change @@ -5417,7 +5417,7 @@ tmp/c.py:2: note: Revealed type is "a.<subclass of "a.A" and "a.B">"
54175417[out2]
54185418tmp/c.py:2: note: Revealed type is "a.A"
54195419
5420- [case testIsInstanceAdHocIntersectionIncrementalUnreachaableToIntersection ]
5420+ [case testIsInstanceAdHocIntersectionIncrementalUnreachableToIntersection ]
54215421import c
54225422[file a.py]
54235423class A:
Original file line number Diff line number Diff line change @@ -84,19 +84,23 @@ class A: pass
8484<a> -> m
8585
8686[case testIfFalseInClassBody]
87+ from typing import Any
88+
8789class A:
8890 if False:
89- x = None # type: str
91+ x: Any = None
9092 x.foo()
9193[builtins fixtures/bool.pyi]
9294[out]
9395<m.A> -> m.A
9496
9597[case testAlwaysFalseIsinstanceInClassBody]
98+ from typing import Any
99+
96100class A:
97101 x: int
98102 if isinstance(x, str):
99- y: str = None
103+ y: Any = None
100104 y.foo()
101105[builtins fixtures/isinstance.pyi]
102106[out]
Original file line number Diff line number Diff line change @@ -414,7 +414,9 @@ class B:
414414
415415def f(x: A) -> None:
416416 if isinstance(x, B):
417- x.y
417+ # TODO: this should narrow to Never and therefore not error
418+ #x.y
419+ pass
418420[builtins fixtures/isinstancelist.pyi]
419421[out]
420422<m.A> -> <m.f>, m.A, m.f
@@ -582,7 +584,7 @@ def f(a: A) -> None:
582584[case testUnreachableAssignment]
583585from typing import List, Tuple
584586
585- def f() -> None : pass
587+ def f() -> int : pass
586588
587589class C:
588590 def __init__(self, x: int) -> None:
Original file line number Diff line number Diff line change @@ -9692,10 +9692,9 @@ reveal_type(z)
96929692[out]
96939693c.py:2: note: Revealed type is "a.<subclass of "a.A" and "a.B">"
96949694==
9695- c.py:2: note: Revealed type is "Any"
9696- b.py:2: error: Cannot determine type of "y"
9695+ c.py:2: note: Revealed type is "a.A"
96979696
9698- [case testIsInstanceAdHocIntersectionFineGrainedIncrementalUnreachaableToIntersection ]
9697+ [case testIsInstanceAdHocIntersectionFineGrainedIncrementalUnreachableToIntersection ]
96999698import c
97009699[file a.py]
97019700class A:
@@ -9724,8 +9723,7 @@ from b import z
97249723reveal_type(z)
97259724[builtins fixtures/isinstance.pyi]
97269725[out]
9727- b.py:2: error: Cannot determine type of "y"
9728- c.py:2: note: Revealed type is "Any"
9726+ c.py:2: note: Revealed type is "a.A"
97299727==
97309728c.py:2: note: Revealed type is "a.<subclass of "a.A" and "a.B">"
97319729
You can’t perform that action at this time.
0 commit comments