File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -1730,3 +1730,44 @@ L0:
1730
1730
def f5():
1731
1731
L0:
1732
1732
return 4
1733
+
1734
+ [case testI64Cast]
1735
+ from typing import cast
1736
+ from mypy_extensions import i64
1737
+
1738
+ def cast_object(o: object) -> i64:
1739
+ return cast(i64, o)
1740
+
1741
+ def cast_int(x: int) -> i64:
1742
+ return cast(i64, x)
1743
+ [out]
1744
+ def cast_object(o):
1745
+ o :: object
1746
+ r0 :: int64
1747
+ L0:
1748
+ r0 = unbox(int64, o)
1749
+ return r0
1750
+ def cast_int(x):
1751
+ x :: int
1752
+ r0 :: native_int
1753
+ r1 :: bit
1754
+ r2, r3 :: int64
1755
+ r4 :: ptr
1756
+ r5 :: c_ptr
1757
+ r6 :: int64
1758
+ L0:
1759
+ r0 = x & 1
1760
+ r1 = r0 == 0
1761
+ if r1 goto L1 else goto L2 :: bool
1762
+ L1:
1763
+ r2 = x >> 1
1764
+ r3 = r2
1765
+ goto L3
1766
+ L2:
1767
+ r4 = x ^ 1
1768
+ r5 = r4
1769
+ r6 = CPyLong_AsInt64(r5)
1770
+ r3 = r6
1771
+ keep_alive x
1772
+ L3:
1773
+ return r3
You can’t perform that action at this time.
0 commit comments