lcompilers / lpython

Python compiler
https://lpython.org/
Other
1.5k stars 158 forks source link

Implementing for-else and while-else loops #2555

Closed advikkabra closed 6 months ago

advikkabra commented 7 months ago

Adding support for for-else and while-else loops according to #2353 . I have implemented a while_else pass which adds flag variables to all while else loops and adds an if check at the end of the loops. I have also added tests for the same.

advikkabra commented 7 months ago

I think the tests which are failing have been updated in my pull request.

Thirumalai-Shaktivel commented 7 months ago

Please mark this PR as ready for review once it is ready.

Thirumalai-Shaktivel commented 6 months ago

The tests fail because of reference not being updated. Do ./run_tests.py -u to update tests.

Thirumalai-Shaktivel commented 6 months ago

@Shaikh-Ubaid, do you see any design improvements in while_else.cpp

advikkabra commented 6 months ago

@Thirumalai-Shaktivel I have added all the suggested improvements. It is ready for review.

Thirumalai-Shaktivel commented 6 months ago

Update the branch and resolve conflicts.

advikkabra commented 6 months ago

I am not sure why tests are failing now. What is the issue?

Thirumalai-Shaktivel commented 6 months ago

For every main branch merge or rebase, we recommend a clean build and then update tests. I think the issue was related to that.

We do:

$ git merge lpython main
or 
$ git rebase main
$ git clean -dfx
$ ./build.sh
$ ./run_tests.py -u