lcompilers / lpython

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

Bug: Dict methods do not work on a `Const dict` #2585

Closed kmr-srbh closed 5 months ago

kmr-srbh commented 7 months ago

Trying to use dict methods on Const dict result in a Internal Compiler Error.

get()

d: Const[dict[str, i32]] = {"a": 1, "b": 2, "c": 3}
print(d.get("a"))
(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
.
.
.
AssertFailed: is_a<T>(*f)

keys()

d: Const[dict[str, i32]] = {"a": 1, "b": 2, "c": 3}
print(d.keys())
(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
.
.
.
AssertFailed: is_a<T>(*f)

The error is the same for other available methods.