-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bogus error when the RHS of Table.[]=
is not a compatible type
#1439
Comments
Tables.[]=
is not a compatible typeTables.[]=
is not a compatible type
Tables.[]=
is not a compatible typeTable.[]=
is not a compatible type
A reduced reproducer: type Type = object
proc `[]=`(a: Type, b, c: int) =
discard
var x: Type
x[0] = 1.0 How to report a sensible error, I'm not sure yet (the necessary context to do so is missing), but I don't think |
Been staring at this for a bit, not sure how we'd improve the error beyond wording or formatting perhaps, but otherwise the core meaning of it would remain intact as we can't find a matching overload. 😬 |
For the particular error I posted, this part got me confused:
It didn't even occur to me that the RHS was wrong... |
What would help is trying to actually try and use a At the moment, only the nimskull/compiler/sem/semexprs.nim Lines 2219 to 2231 in d393260
Beyond the incomplete error message, it also means that the following doesn't work: type Object = object
a: array[16, int]
proc `[]`(x: var Object, i: int): var int = x.a[i]
var o: Object
o[0] = 1 |
Example
Actual Output
Expected Output
Something that says the last
0
is not a compatible typeThe text was updated successfully, but these errors were encountered: