Comments (3)
The error message is not great at all, but the problem is that the compiler cannot resolve the setitem parameter "idx" so it doesn't see the setitem overload. That's why it is complaining about not being mutable. I'll take a look at the error message
from mojo.
Thank you for reporting this, we now produce:
x.mojo:7:8: error: invalid call to '__setitem__': could not deduce parameter 'idx' of callee '__setitem__'
lst[0] = 0
^
x.mojo:4:8: note: function declared here
fn __setitem__[idx: Int](inout self, value: Int): pass
^
from mojo.
Hello, @lattner. Thank you so much for taking a look at this.
Considering that you closed the issue, I got the impression that the problem I reported was only with the error message. I couldn't understand why, in this case, it is expected that the compiler cannot resolve the setitem parameter "idx" so it doesn't see the setitem overload. What is the difference between this setitem and, for example, the setitem of the StaticTuple struct?
@always_inline("nodebug")
fn __setitem__[index: Int](inout self, val: Self.element_type): ...
All the best,
from mojo.
Related Issues (20)
- [Modular CLI] cannot create account with gmail ? HOT 4
- [BUG] Unexpected constructor resolution due to implicit type casting
- DTypepointer scatter fails to compile inside an object
- [Docs] Install Mojo SSL Error HOT 2
- [BUG] `0! == 0` HOT 5
- [BUG] Wrong type conversion HOT 2
- [Feature Request] Gradual adoption into python project
- [Feature Request] Align Mojo `alias` with `type` HOT 1
- [Feature Request] `--free-standing` option in command line to make embedded systems
- [BUG] mojo test: couldn't build the test executable in current nightlies HOT 3
- [BUG] .mojopkg files do not support nested package directory structures HOT 1
- [BUG] REPL incorrectly displays boolean SIMD vector contents
- [Modular CLI] Running `modular auth` fails with the error message: http error: response code 404 HOT 1
- mojo slower that python HOT 1
- [Modular CLI] modular: error: invalid manifest: expiration has passed HOT 9
- [Feature Request] Inline assembly support HOT 2
- Generalize `init` argument convention with named result slots HOT 1
- [BUG] Strange behavior with conformance
- [BUG] mlir types confuse overload resolution HOT 1
- [BUG] crash when trying to run open3d.visualization.draw(mesh)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mojo.