mojo
mojo copied to clipboard
[BUG]: `[]` notation of `Dictionary` doesn't pick the right overload
Bug description
There are two overloads:
fn __setitem__(self: Self, key: PythonObject, value: PythonObject): ...
# and
fn __setitem__(self: Self, key: PythonObject, value: Self): ...
and the compiler is not able to pick the second one when []
notation is used.
Steps to reproduce
from python import Python as py
fn main() raises:
var d = py.dict()
d["test"] = d # error: cannot implicitly convert 'Dictionary' value to 'PythonObject' in assignment
d.__setitem__("test", d) # works fine
System information
Mojo 24.1 on Docker, Intel Mac