Skip to content

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

Description

@dawdmaow

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'

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions