Skip to content

type casting between u16 and i32 needed #2170

Closed
@rebcabin

Description

@rebcabin

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    BLOCKERworkaround not found yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions