nimsuggest icon indicating copy to clipboard operation
nimsuggest copied to clipboard

Crash after dot character

Open RSDuck opened this issue 8 years ago • 0 comments

Everytime the sug command is triggered in my project, after a . character(regardless of the type, of identifier, before it) nimsuggest crashes. Every other nimsuggest feature seems to work. I think this is due to a several types which were recently introduced through a rather big macro, because the crash didn't happend before. Unfortunately I couldn't isolate the problem, I only have the stack trace:

Traceback (most recent call last)
nimsuggest.nim(625)      nimsuggest
nimsuggest.nim(621)      handleCmdLine
nimsuggest.nim(517)      mainCommand
nimsuggest.nim(464)      mainThread
nimsuggest.nim(431)      execCmd
nimsuggest.nim(193)      execute
modules.nim(240)         compileProject
modules.nim(191)         compileModule
passes.nim(218)          processModule
passes.nim(136)          processTopLevelStmt
sem.nim(561)             myProcess
sem.nim(524)             semStmtAndGenerateGenerics
semstmts.nim(1898)       semStmt
semexprs.nim(782)        semExprNoType
semexprs.nim(2327)       semExpr
semstmts.nim(1659)       semProc
semstmts.nim(1587)       semProcAux
semexprs.nim(1413)       semProcBody
semexprs.nim(2309)       semExpr
semstmts.nim(1831)       semStmtList
semexprs.nim(2307)       semExpr
semexprs.nim(1313)       semAsgn
semexprs.nim(1029)       builtinFieldAccess
suggest.nim(546)         suggestExpr
suggest.nim(526)         suggestExprNoCheck
suggest.nim(511)         sugExpr
suggest.nim(391)         suggestFieldAccess
suggest.nim(320)         suggestOperations
suggest.nim(315)         typeFits
sigmatch.nim(2292)       argtypeMatches
sigmatch.nim(1964)       paramTypesMatch
sigmatch.nim(329)        paramTypesMatchAux
sigmatch.nim(1616)       typeRelImpl
sigmatch.nim(940)        typeRelImpl
system.nim(3686)         failedAssertImpl
system.nim(3678)         raiseAssert
system.nim(2753)         sysFatal
Error: unhandled exception:
not (aOrig == nil)  [AssertionError]

As a temporary solution, I replaced the assert(aOrig != nil) in sigmatch.nim through:

if aOrig.isNil:
    return isNone

the resulting suggestions are(as far as I can tell) not affected.

RSDuck avatar Nov 04 '17 16:11 RSDuck