You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to incorporate chronicles into my library and found a weird compilation-time error.
After stripping all the nonrelevant parts, this is what I've got:
import asyncdispatch
import a
let d =newWut[int](@[1])
asyncCheck d.runForever()
runForever()
when running nim c main.nim, I'm getting the following error:
main.nim(6, 13) template/generic instantiation from here
a.nim(18, 19) template/generic instantiation from here
a.nim(13, 10) template/generic instantiation from here
/home/user/.nimble/pkgs/chronicles-0.5.1/chronicles.nim(344, 5) Error: undeclared identifier: 'log'
If I replace error "ERROR" with echo("ERROR"), everything compiles successfully.
My nim version is:
This is a known Nim issue related to the fact that the functions proc runForever*(d: Wut) and proc action(d: Wut) are generic. Nim has some issues with generic symbol look-ups inside modules that are "sandwiched" between the outermost instantiation scope (main.nim) and the innermost non-generic resolved call (chronicles.nim). I'm sorry if this explanation is a bit vague and hard to follow, but the short version of the story is that you can fix the problem by importing chronicles in main.nim:
import asyncdispatch, chronicles
import a
let d =newWut[int](@[1])
asyncCheck d.runForever()
runForever()
Hey guys,
I'm trying to incorporate chronicles into my library and found a weird compilation-time error.
After stripping all the nonrelevant parts, this is what I've got:
file a.nim:
and file main.nim:
when running
nim c main.nim
, I'm getting the following error:If I replace
error "ERROR"
withecho("ERROR")
, everything compiles successfully.My nim version is:
The text was updated successfully, but these errors were encountered: