Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport] [mypyc] Fix test case testI64Cast on 32-bit architectures #14700

Merged
merged 1 commit into from
Feb 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 34 additions & 1 deletion mypyc/test-data/irbuild-i64.test
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,7 @@ def f5():
L0:
return 4

[case testI64Cast]
[case testI64Cast_64bit]
from typing import cast
from mypy_extensions import i64

Expand Down Expand Up @@ -1772,6 +1772,39 @@ L2:
L3:
return r3

[case testI64Cast_32bit]
from typing import cast
from mypy_extensions import i64

def cast_int(x: int) -> i64:
return cast(i64, x)
[out]
def cast_int(x):
x :: int
r0 :: native_int
r1 :: bit
r2, r3, r4 :: int64
r5 :: ptr
r6 :: c_ptr
r7 :: int64
L0:
r0 = x & 1
r1 = r0 == 0
if r1 goto L1 else goto L2 :: bool
L1:
r2 = extend signed x: builtins.int to int64
r3 = r2 >> 1
r4 = r3
goto L3
L2:
r5 = x ^ 1
r6 = r5
r7 = CPyLong_AsInt64(r6)
r4 = r7
keep_alive x
L3:
return r4

[case testI64ExplicitConversionFromVariousTypes]
from mypy_extensions import i64

Expand Down