erg/tests/should_err/mut_dict.er
Shunsuke Shibayama 07b98112a7 fix: dict type bug
2024-10-19 03:11:14 +09:00

20 lines
447 B
Python

d as {{"a", "b"}: {1, 2}} = {"a": 1}
dict = !d
dict.insert! "b", 2
_ = dict.get("a") == "a" # ERR
_ = dict.get("b") == "a" # ERR
_ = dict.get("c") # OK
_ = dict["b"] # OK
_ = dict["c"] # ERR
_: Mapping(Int, Str) = !{1: "a", 2: "b"}
_: Mapping(Str, Int) = !{1: "a", 2: "b"} # ERR
Manager = Class {
.tasks = List Dict! { Int: Str }
}
Manager.
show_tasks! self, id: Str =
for! self.tasks, task =>
print! task[id] # ERR