lcompilers / lpython

Python compiler
https://lpython.org/
Other
1.37k stars 157 forks source link

Add support for accessing values from data-structures contained within `Const` #2560

Closed kmr-srbh closed 4 months ago

kmr-srbh commented 4 months ago

Overview

Trying to access a key from a Const dict threw a SemanticError stating type mismatch. An ASR pass error was thrown when trying to access values from a Const list, Const tuple and Const str. This was chiefly because the case of a Const value was not addressed in handling subscript indices.

Fix

Note

The get attribute of Const dict still throws a SemanticError now. I will push the fix for that in a separate PR.

kmr-srbh commented 4 months ago

@certik Please guide me where I should put the tests. It is a bit difficult to understand now. Is this the correct folder? Shall I refactor them to a more professional and readable manner?

kmr-srbh commented 4 months ago

The failing tests are irrelevant to the changes made.

Thirumalai-Shaktivel commented 4 months ago

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