Skip to content

Commit 910d24e

Browse files
author
hhaensel
committed
fix remaining defintion of M after using @using
1 parent bf01923 commit 910d24e

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/Loader.jl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -477,17 +477,18 @@ macro _using(package, mode = QuoteNode(:using), src_file = nothing, context = no
477477
f = normpath(f)
478478
out_include = quote
479479
@debug("using $($package_name) (from '$($package)') per 'include()'")
480-
M = $context.include($f)
481-
# file was included without error, let's check whether it was really a module, in that case use it
482-
if M isa Module
483-
if nameof(M) == Symbol($package_name)
484-
$mode == :using && (using .$(package_symbol))
480+
let M = $context.include($f)
481+
# file was included without error, let's check whether it was really a module, in that case use it
482+
if M isa Module
483+
if nameof(M) == Symbol($package_name)
484+
$mode == :using && (using .$(package_symbol))
485+
else
486+
@warn("Module's name doesn't match the filename, expected '$($package_name)', got '$(nameof(M))'")
487+
eval(Expr($mode, Expr(:., :., nameof(M))))
488+
end
485489
else
486-
@warn("Module's name doesn't match the filename, expected '$($package_name)', got '$(nameof(M))'")
487-
eval(Expr($mode, Expr(:., :., nameof(M))))
490+
@warn("'$($package_name)' could not be loaded from '$(joinpath($f))' or is not a module.")
488491
end
489-
else
490-
@warn("'$($package_name)' could not be loaded from '$(joinpath($f))' or is not a module.")
491492
end
492493
end
493494

0 commit comments

Comments
 (0)