Given:
module foo;
import bar;
int foo() {
return bar.abc(1);
}
and:
module bar;
int abc()(int i) {
import std.stdio;
return i;
}
std.stdio should be added to foo's list of imported modules.
Just as a heads up, I'd expect having to deal with real-world breakage due to constructor cycles as a side effect of fixing this.
Comment #3 by razvan.nitu1305 — 2019-01-07T16:53:35Z
Does this bug have a visible manifestation? I can compile this code successfully. Can this be tested somehow? It's not obvious from the bug description what is the intended behavior.
Comment #4 by code — 2019-01-07T17:41:53Z
(In reply to RazvanN from comment #3)
> Does this bug have a visible manifestation?
If you check `ModuleInfo.importedModules` for `foo`, `std.stdio` wouldn't be there (or at least wasn't back then).
Comment #5 by razvan.nitu1305 — 2019-01-08T14:15:03Z
So, if I understand correctly, the idea here is that when a template is instantiated, the code generated for the template instantiation should be put in foo.o, right? Otherwise, why would it be in bar?
Comment #6 by razvan.nitu1305 — 2019-01-08T15:29:44Z