Skip to content

type casting between u16 and i32 needed #2170

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

Closed
rebcabin opened this issue Jul 17, 2023 · 2 comments · Fixed by #2171
Closed

type casting between u16 and i32 needed #2170

rebcabin opened this issue Jul 17, 2023 · 2 comments · Fixed by #2171
Labels
BLOCKER workaround not found yet

Comments

@rebcabin
Copy link
Contributor

we expected to be able to convert 32768, which is i32, into u16. please help

from lpython import u16, i32

i : i32
u : u16 = u16(32768)
x : i32

for i in range(i32(u)):
    x = i * 2
/Users/brian/CLionProjects/lpython/src/bin/python /Users/brian/CLionProjects/lpython/lasr/LP-pycharm/IssueCH152.py 
code generation error: Variable type not supported 1
 --> /Users/brian/CLionProjects/lpython/lasr/LP-pycharm/IssueCH152.py:4:1
  |
4 | u : u16 = u16(32768)
  | ^^^^^^^^^^^^^^^^^^^^ 


Note: if any of the above error or warning messages are not clear or are lacking
context please report it to us (we consider that a bug that must be fixed).
@Shaikh-Ubaid
Copy link
Collaborator

Shaikh-Ubaid commented Jul 17, 2023

Team, I think this issue was already fixed in #2164.

@certik
Copy link
Contributor

certik commented Jul 17, 2023

It's not clear if the casting has been implemented properly. I opened up a new issue for this: #2174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BLOCKER workaround not found yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants