Fixed scoping issues of for loops in global scope#2672
Fixed scoping issues of for loops in global scope#2672ubaidsk merged 10 commits intolcompilers:mainfrom
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
3Stringc: 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. 👍 |
ubaidsk
left a comment
There was a problem hiding this comment.
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 !
ubaidsk
left a comment
There was a problem hiding this comment.
It looks good to me. Thanks for this! Great work @tanay-man!
Co-authored-by: Shaikh Ubaid <[email protected]>
fixes #2608 , fixes #1475.