@wizzardx is correct, this is normal Nim behaviour.
Nim generic proc is instantiated at _callsite_. The above example, Bar is instantiated at bug.nim not at lib.nim, and at that time, the scope where the Bar is instantiated have no information about Foo symbol.