-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Nim Version
2.3.1
2.*
Description
static: assert defined(js)
proc f(_: SomeFloat): int{.exportc.} = discard
Current Output
Error: unhandled exception: index 7 not in 0 .. 6 [IndexDefect]
Expected Output
(compiles with no error)
Known Workarounds
Delete one of these properties:
- exportc
- generic
- has return type
- (js backend)
Additional Information
real world example: nimpylib/nimpylib#43
Traceback:
compiler/jsgen.nim:3063
genSym accesses n[namePos]
(and the line above it checks proc has sfExportc and no sfCompilerProc)
→ genProcForSymIfNeeded →attachProc →
genProc checks
if prc.typ.returnType != nil and sfPure notin prc.flags:
and then call gen(p, prc.ast[resultPos], a)
where prc is n[namePos]
But n[namePos].sym.ast.sons.len != 8
So n[namePos].sym.ast[resultPos]
(resultPos = 7) raises IndexDefect
compiler/pipelines
However, we can find that even in C backend, the node that'll be passed as n[namePos].sym.ast
in JS backend still doesn't contain Item#7
Metadata
Metadata
Assignees
Labels
No labels