-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fix importall warning (for real this time) #5
Conversation
Ugh. Of course I was over-confident and forgot to test before opening the PR, hence the second commit. I can squash them before merging if you think this is a reasonable fix. |
When I run the code above, I don't see any warnings on either 0.4 or 0.5. Can you provide more details? |
Weird. I uninstalled
What do you get when you run the following? ## For the current release ##
using Reexport
macroexpand(:(@reexport using A)) Before the PR I get: :($(Expr(:toplevel, :(using A), :(eval(Expr(:export,setdiff(names(A),[mod])...)))))) Afterwards I get something that (I think) makes more sense: :($(Expr(:toplevel, :(using A), :(eval(Expr(:export,setdiff(names(A),[Symbol(string(A))])...)))))) |
I also have the wouldn't I shall investigate |
Oh, now I see what your PR is solving. The |
regardless, @ahwillia if you add this diff, then diff --git a/src/Reexport.jl b/src/Reexport.jl
index b14d0ca..543af53 100644
--- a/src/Reexport.jl
+++ b/src/Reexport.jl
@@ -5,6 +5,7 @@ module Reexport
macro reexport(ex)
isa(ex, Expr) && (ex.head == :module ||
ex.head == :using ||
+ ex.head == :importall ||
(ex.head == :toplevel &&
all(e->isa(e, Expr) && e.head == :using, ex.args))) ||
error("@reexport: syntax error")
@@ -12,7 +13,7 @@ macro reexport(ex)
if ex.head == :module
modules = Any[ex.args[2]]
ex = Expr(:toplevel, ex, Expr(:using, :., ex.args[2]))
- elseif ex.head == :using
+ elseif ex.head == :using || ex.head == :importall
modules = Any[ex.args[end]]
else
modules = Any[e.args[end] for e in ex.args] |
Implemented @Evizero's solution and removed the It's still arguable that we shouldn't be reexporting the module itself, and only the symbols it exports. If we wanted to skip the module, then the correct symbol to be excluded is |
Also, can someone confirm that using |
Just tested it. The reexport part works for me now, thanks! The warning still exists. Not sure if that does harm or not
EDIT: don't think it does though, since all tests pass |
I can confirm @Evizero's experience. I still get the warning. I see the potential problem if packages are depending on the current behavior, but to me it seems the following two should reexport the same thing (i.e. without the module): @reexport using A importall A
@reexport using A And if you want, this could export a binding to the module itself: @reexport importall A |
|
I'm not sure if this issue (#1) was actually resolved. The warning was persisting for me, I think the issue was that
mod
needed to be interpolated and turned into a symbol.This PR fixes the problem for me.