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

eval in __init__ causes incorrect precompilation warning #29059

Closed
fredrikekre opened this issue Sep 5, 2018 · 7 comments · Fixed by #29483
Closed

eval in __init__ causes incorrect precompilation warning #29059

fredrikekre opened this issue Sep 5, 2018 · 7 comments · Fixed by #29483
Assignees
Labels
compiler:precompilation Precompilation of modules modules

Comments

@fredrikekre
Copy link
Member

fredrikekre commented Sep 5, 2018

Noticed in a couple of packages since precompile is on by default. Setup:

using Pkg
A = joinpath(pwd(), "PackageA");
B = joinpath(pwd(), "PackageB");
Pkg.generate.(["PackageA", "PackageB"]);
Pkg.activate(A);
Pkg.develop(PackageSpec(path = B));
Pkg.activate();
Pkg.develop([PackageSpec(path = A), PackageSpec(path = B)]);
write(joinpath(A, "src", "PackageA.jl"), "module PackageA\nusing PackageB\nend");
write(joinpath(B, "src", "PackageB.jl"), "module PackageB\n__init__() = eval(:(b() = 1))\nend");

and then

julia> using PackageA
[ Info: Precompiling PackageA [578a9956-b149-11e8-3635-0b7267ab0bb3]
WARNING: eval from module PackageB to PackageA:    
Expr(:call, :b) = Expr(:block, #= Symbol("/home/fredrik/PackageB/src/PackageB.jl"):2 =#, 1)
  ** incremental compilation may be broken for this module **

See e.g. JuliaDocs/Documenter.jl#806

@fredrikekre fredrikekre added the compiler:precompilation Precompilation of modules label Sep 5, 2018
@JeffBezanson
Copy link
Member

I don't think it's actually evaluating in the wrong module; I suspect the error message is inaccurate. Could you confirm whether b() ends up defined in PackageA or PackageB?

@fredrikekre
Copy link
Member Author

It ends up in the correct module (PackageB)

@JeffBezanson JeffBezanson changed the title eval in __init__ causes evalutation into wrong module eval in __init__ causes incorrect precompilation warning Sep 10, 2018
@StefanKarpinski
Copy link
Member

StefanKarpinski commented Sep 10, 2018

IIRC, this error message has the modules swapped for some reason? @vtjnash, I think you mentioned that to me once but maybe I was misunderstanding.

@JeffBezanson
Copy link
Member

"eval from B to A" is supposed to mean that module B did an eval(A, ...), i.e. B "sent" some code to A. It makes sense to me but I can see how it may not be totally clear.

@vtjnash
Copy link
Member

vtjnash commented Sep 11, 2018

is supposed to mean

Yes, that's what the code looks like (some module A wants to inject an eval result into the file for B, but that will fail and emit a bad .ji cache for A), so that's probably why I ended up wording it this way. But even so, the wording does "feel" backwards to me.

@ma-laforge

This comment has been minimized.

@yuyichao
Copy link
Contributor

Those are not problems and are unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:precompilation Precompilation of modules modules
Projects
None yet
6 participants