Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Using list() on a list variable does not work #2667

Open
@ubaidsk

Description

@ubaidsk
% cat examples/expr2.py   
from lpython import i32

a: list[i32]
a = [2, 3]
b: list[i32]
b = list(a)
print(b)
% python examples/expr2.py
[2, 3]
% lpython examples/expr2.py
semantic error: Type mismatch in assignment, the types must be compatible
 --> examples/expr2.py:6:1
  |
6 | b = list(a)
  | ^   ^^^^^^^ type mismatch ('list[i32]' and 'list[str]')


Note: Please report unclear or confusing messages as bugs at
https://github.com/lcompilers/lpython/issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions