Skip to content

Commit c62093e

Browse files
committed
Pass all tests
1 parent 879b274 commit c62093e

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

mypyc/test-data/irbuild-match.test

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff 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
17721770
L0:
17731771
r0 = __main__.Foo :: type
17741772
r1 = PyObject_IsInstance(x, r0)
@@ -1792,13 +1790,9 @@ L2:
17921790
goto L8
17931791
L3:
17941792
L4:
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
18001794
L5:
1801-
r18 = raise AssertionError('Unreachable')
1795+
r14 = raise AssertionError('Unreachable')
18021796
unreachable
18031797
L6:
18041798
goto L8

test-data/unit/check-incremental.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5417,7 +5417,7 @@ tmp/c.py:2: note: Revealed type is "a.<subclass of "a.A" and "a.B">"
54175417
[out2]
54185418
tmp/c.py:2: note: Revealed type is "a.A"
54195419

5420-
[case testIsInstanceAdHocIntersectionIncrementalUnreachaableToIntersection]
5420+
[case testIsInstanceAdHocIntersectionIncrementalUnreachableToIntersection]
54215421
import c
54225422
[file a.py]
54235423
class A:

test-data/unit/deps-classes.test

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,23 @@ class A: pass
8484
<a> -> m
8585

8686
[case testIfFalseInClassBody]
87+
from typing import Any
88+
8789
class 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+
96100
class 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]

test-data/unit/deps.test

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,9 @@ class B:
414414

415415
def 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]
583585
from typing import List, Tuple
584586

585-
def f() -> None: pass
587+
def f() -> int: pass
586588

587589
class C:
588590
def __init__(self, x: int) -> None:

test-data/unit/fine-grained.test

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9692,10 +9692,9 @@ reveal_type(z)
96929692
[out]
96939693
c.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]
96999698
import c
97009699
[file a.py]
97019700
class A:
@@ -9724,8 +9723,7 @@ from b import z
97249723
reveal_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
==
97309728
c.py:2: note: Revealed type is "a.<subclass of "a.A" and "a.B">"
97319729

0 commit comments

Comments
 (0)