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

ASR -> CPython: Add TupleConstant visitor #2691

Closed

Conversation

kmr-srbh
Copy link
Contributor

@kmr-srbh kmr-srbh commented May 9, 2024

Global scope

from lpython import i32, f64

my_first_tuple: tuple[i32, str, f64] = (1, "hello", 2.4)
print(my_first_tuple)

my_second_tuple: tuple[tuple[i32, str], str] = ((1, "hello"), "world")
print(my_second_tuple)
(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py --show-python
def __main__global_init():
    my_first_tuple = (1, "hello", 2.400000)
    my_second_tuple = ((1, "hello"), "world")
def __main__global_stmts():
    print(my_first_tuple)
    print(my_second_tuple)

Local scope

from lpython import i32, f64

def f():
    my_first_tuple: tuple[i32, str, f64] = (1, "hello", 2.4)
    print(my_first_tuple)

    my_second_tuple: tuple[tuple[i32, str], str] = ((1, "hello"), "world")
    print(my_second_tuple)

f()
(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py --show-python
def __main__global_stmts():
    f()
def f():
    my_first_tuple: tuple[i32, str, f64]
    my_second_tuple: tuple[tuple[i32, str], str]
    my_first_tuple = (1, "hello", 2.400000)
    print(my_first_tuple)
    my_second_tuple = ((1, "hello"), "world")
    print(my_second_tuple)

TODO

  • Add tests

@nikabot
Copy link

nikabot commented May 9, 2024

See: #2690 (comment)

@kmr-srbh
Copy link
Contributor Author

kmr-srbh commented May 9, 2024

Closing due to #2690 (comment)

@kmr-srbh kmr-srbh closed this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants