-
Notifications
You must be signed in to change notification settings - Fork 158
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
Fixed scoping issues of for loops in global scope #2672
Conversation
@tanay-man I think this should also fix #1475. Could you please verify it? |
Please make the changes to handle subscripts also. |
It does fix the issue. |
Great! Please link the PR to close that too. |
The same solution doesn't work for the subscripts. It produces asr but it cannot be converted to llvm further. I'll have to look into it for further analysis. |
I tested the changes locally. They work for both subscripts of strings and lists. Listfrom lpython import i32
i: i32
my_list: list[i32] = [1, 2, 3, 4, 5]
for i in my_list[1:3]:
print(i) (base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py
2
3 Stringc: str
s: str = "abcde"
for c in s[1:3]:
print(c) (base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py
b
c |
@tanay-man you can change this to 'fixes #2608, fixes #1475' to link this PR to the issues. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shared few comments. Apart from the removed c
label for one of the tests, the rest of the things look good to me.
I think this will be good to merge after the shared comments are resolved. Thanks for this. Great work @tanay-man !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me. Thanks for this! Great work @tanay-man!
Co-authored-by: Shaikh Ubaid <shaikhubaid769@gmail.com>
fixes #2608 , fixes #1475.