Open
Description
Example
type X = object
template `[]`(x: X, i: int) = 0
var x: X
x[0] = 1
Actual Output
bug.nim(5, 2) Error: type mismatch: got <X, int literal(0)>
but expected one of:
proc `[]`(s: string; i: BackwardsIndex): char
first type mismatch at position: 0
[ ... many examples later ... ]
template `[]`(x: X; i: int)
first type mismatch at position: 0
expression: `[]`(x, 0)
Expected Output
bug.nim(5, 2) Error: type mismatch: got <X, int literal(0), int literal(1)>
but expected one of:
proc `[]=`(s: var string; i: BackwardsIndex; x: char)
first type mismatch at position: 0
[ ... many examples later ... ]
expression: `[]=`(x, 0, 1)
I was super confused because my []
template was appearing there, but didn't realize it was missing the []=
and not []
.