Skip to content

Instantly share code, notes, and snippets.

@stisa
Created October 16, 2016 18:05
Show Gist options
  • Save stisa/bbcaa021a100f826dfd18615dfe90b70 to your computer and use it in GitHub Desktop.
Save stisa/bbcaa021a100f826dfd18615dfe90b70 to your computer and use it in GitHub Desktop.
type A = object
data: ref seq[float]
proc `$`[T](a:ref seq[T]):string = $(a[])
var ar : A
new ar.data
ar.data[] = @[0.0,1.0,2.0]
echo ar
# With C backend: nim c -r test.nim
# results in:
# (data: @[0.0, 1.0, 2.0])
# With js backend: nim js test.nim
# results in:
# test.nim(8, 8) Error: internal error: genDeref
# No stack traceback available
# To create a stacktrace, rerun compilation with ./koch temp js <file>
# And runing it with koch temp js test.nim
# results in:
#[
test.nim(8, 8) Error: internal error: genDeref
Traceback (most recent call last)
nim.nim(115) nim
nim.nim(71) handleCmdLine
main.nim(272) mainCommand
main.nim(116) commandCompileToJS
modules.nim(238) compileProject
system.nim(1105) compileModule
passes.nim(198) processModule
passes.nim(131) processTopLevelStmt
jsgen.nim(2212) myProcess
jsgen.nim(2201) genModule
jsgen.nim(1994) genStmt
jsgen.nim(2139) gen
jsgen.nim(878) genAsgn
jsgen.nim(841) genAsgnAux
jsgen.nim(2097) gen
jsgen.nim(1182) genDeref
msgs.nim(994) internalError
msgs.nim(968) liMessage
msgs.nim(840) handleError
msgs.nim(824) quit
FAILURE
]#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment