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

Bizzare import interaction resulting in attempting to call undeclared routine: 'toJson'. #94

Open
dawdmaow opened this issue Dec 23, 2024 · 0 comments

Comments

@dawdmaow
Copy link

dawdmaow commented Dec 23, 2024

This is probably a compiler error, but I wasn't able to come up with a reproduction without jsony.

Nim version: 2.2.0
Backend: c

imported.nim

import pkg/jsony

type
  Foo* = ref object
    foo: float # Remove this line and everything works 🤡

proc serialize*(msg: Foo|float) =
  discard toJson(msg)

main.nim

import imported
# import jsony # Add this line and everything works 🤡

serialize(Foo())

Output

...template/generic instantiation of `toJson` from here
/Users/dawid/.nimble/pkgs2/jsony-1.1.5-6aeb83e7481ca8686396a568096054bc668294df/jsony.nim(881, 11) template/generic instantiation of `dumpHook` from here
/Users/dawid/.nimble/pkgs2/jsony-1.1.5-6aeb83e7481ca8686396a568096054bc668294df/jsony.nim(823, 6) template/generic instantiation of `dumpHook` from here
/Users/dawid/.nimble/pkgs2/jsony-1.1.5-6aeb83e7481ca8686396a568096054bc668294df/jsony.nim(801, 8) template/generic instantiation of `dumpKey` from here
/Users/dawid/.nimble/pkgs2/jsony-1.1.5-6aeb83e7481ca8686396a568096054bc668294df/jsony.nim(739, 15) Error: attempting to call undeclared routine: 'toJson'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant