Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing a defined proc to dot operator macro results in assertion error #15607

Open
vijaymarupudi opened this issue Oct 17, 2020 · 1 comment

Comments

@vijaymarupudi
Copy link

vijaymarupudi commented Oct 17, 2020

Example

# test.nim
import jsffi

proc log() {.varargs, importc: "console.log", cdecl.}

let d3* {.importc.}: JsObject

let svg = d3
  .call(log)
nim js test

Another example

import jsffi

let d3* {.importc.}: JsObject

proc l() {.varargs, importc: "console.log".}

d3.call(l)

Current Output

Error: unhandled exception: sigmatch.nim(1021, 9) `aOrig != nil`  [AssertionDefec
t]

Expected Output

For it to compile. Or error due to competing values of log

Possible Solution

Unsure

$ nim -v
Nim Compiler Version 1.4.0 [Linux: amd64]
Compiled at 2020-10-16
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: 018ae963ba83934a68d815c3c1c44c06e8ec6178
active boot switches: -d:release
@ghost ghost added the Javascript label Oct 17, 2020
@bung87
Copy link
Collaborator

bung87 commented Nov 11, 2020

the example code will leading to unknown behaviour, js call takes function, context, ...args,
your example d3 is object which is not callable, and if there is call proc in nim d3 will be first param, this will cause log into context position which will also leading to unexpected behaviour, issue here should separate to serveral issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants