Closed kmr-srbh closed 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?
The failing tests are irrelevant to the changes made.
Please mark this PR ready for review once it is ready.
Overview
Trying to access a key from a
Const dict
threw aSemanticError
stating type mismatch. AnASR pass error
was thrown when trying to access values from aConst list
,Const tuple
andConst str
. This was chiefly because the case of aConst
value was not addressed in handling subscript indices.Fix
Check for
Const
when visiting subscript indices and handle item access through the contained type in thellvm
back-end.Throw a
SemanticError
for immutable types liketuple
andstr
.Tuple
String
Dictionary
List
Note
The
get
attribute ofConst dict
still throws aSemanticError
now. I will push the fix for that in a separate PR.