(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py
semantic error: Unhashable type: 'list'
--> ./examples/example.py:3:15
|
3 | my_dict: dict[list[i32], str] = {[1, 2]: "first", [3, 4]: "second"}
| ^^^^^^^^^ Mutable type 'list' cannot become a key in dict. Hint: Use an immutable type for key.
Note: Please report unclear or confusing messages as bugs at
https://github.com/lcompilers/lpython/issues.
(base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py
semantic error: Unhashable type: 'set'
--> ./examples/example.py:3:15
|
3 | my_dict: dict[set[str], str] = {{1, 2}: "first", {3, 4}: "second"}
| ^^^^^^^^ Mutable type 'set' cannot become a key in dict. Hint: Use an immutable type for key.
Note: Please report unclear or confusing messages as bugs at
https://github.com/lcompilers/lpython/issues.
Fixes #2663
Working for
dict
is shown below. It is the same forset
.List
Dictionary
Set