I don't know if it's a compiler bug or not, the manual says `The [] subscript
operator for arrays/openarrays/sequences can be overloaded.` but eg in macros
and I think tables it's used.
Anyway, for me on `git hash: b7bffa35c70eb1a55fe9e35307ba4e99e48abe69`
* Tuple and object versions with subscript operator both don't work
* Object version with call syntax doesn't work
* Tuple version with call syntax works.
echo x["p2"] # subscript operator
echo `[]`(x, "p2") # call syntax
For debugging the compiler, have a look at
[this](https://github.com/nim-lang/Nim/wiki/Debugging-the-compiler) .
Mostly you have to build a debug compiler ( `koch temp` ) and then use this
version (normally it's `nim_temp` in your nim/bin folder) to run your test.
Eg. traceback with `nim_temp c -r test.nim`
Traceback (most recent call last)
nim.nim(121) nim
nim.nim(77) handleCmdLine
main.nim(163) mainCommand
main.nim(74) commandCompileToC
modules.nim(240) compileProject
modules.nim(180) compileModule
passes.nim(215) processModule
passes.nim(135) processTopLevelStmt
sem.nim(536) myProcess
sem.nim(508) semStmtAndGenerateGenerics
semstmts.nim(1679) semStmt
semexprs.nim(828) semExprNoType
semexprs.nim(2268) semExpr
semexprs.nim(1905) semMagic
semexprs.nim(811) semDirectOp
semexprs.nim(649) semOverloadedCallAnalyseEffects
semcall.nim(388) semOverloadedCall
semcall.nim(211) resolveOverloads
semcall.nim(91) pickBestCandidate
sigmatch.nim(2044) matches
sigmatch.nim(2001) matchesAux
sigmatch.nim(1836) prepareOperand
semexprs.nim(26) semOperand
semexprs.nim(2294) semExpr
semexprs.nim(1315) semArrayAccess
semexprs.nim(1280) semSubscript
msgs.nim(1030) localError
msgs.nim(1018) liMessage
msgs.nim(872) handleError
msgs.nim(857) quit