mojo
mojo copied to clipboard
[BUG] `object` does not implement `__truediv__` or `__floordiv__`
Bug description
When running the code snippets linked below in the Mojo Playground, I get the following errors:
__floordiv__
code:
/source/prog.mojo:2:20: error: 'object' does not implement the '__floordiv__' method
return (x + y) // 2
~~~~~~~ ^
mojo: error: failed to parse the provided Mojo
It is supposed to print 1
__truediv__
code:
/source/prog.mojo:2:20: error: 'object' does not implement the '__truediv__' method
return (x + y) / 2
~~~~~~~ ^
mojo: error: failed to parse the provided Mojo
It is supposed to print 1.5
I consider this to be a bug as the exact same code works perfectly fine in Python.
Steps to reproduce
- Include relevant code snippet or link to code that did not work as expected.
Just run the above snippets in the Playground.
System information
I ran this on the Mojo Playground as of 06-04-2024.