Skip to content

Commit

Permalink
Merge pull request #795 from timholy/teh/test_718
Browse files Browse the repository at this point in the history
Groundwork for a fix for #718
  • Loading branch information
timholy authored Jan 6, 2024
2 parents 9272cba + 815209e commit 1058a3e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lowered.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function categorize_stmt(@nospecialize(stmt))
return ismeth, haseval, isinclude, isnamespace, istoplevel
end
# Check for thunks that define functions (fixes #792)
function defines_function(ci)
function defines_function(@nospecialize(ci))
isa(ci, CodeInfo) || return false
if length(ci.code) == 1
stmt = ci.code[1]
Expand Down
2 changes: 1 addition & 1 deletion src/parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function process_source!(mod_exprs_sigs::ModuleExprsSigs, ex, filename, mod::Mod
if isa(a, LineNumberNode)
lnn = a
else
pushex!(exprs_sigs, Expr(:block, lnn, a))
pushex!(exprs_sigs, Expr(:toplevel, lnn, a))
end
end
else
Expand Down
39 changes: 39 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,45 @@ const issue639report = []
pop!(LOAD_PATH)
end

do_test("Submodule in same file (#718)") && @testset "Submodule in same file (#718)" begin
testdir = newtestdir()
dn = joinpath(testdir, "TestPkg718", "src")
mkpath(dn)
write(joinpath(dn, "TestPkg718.jl"), """
module TestPkg718
module TestModule718
export _VARIABLE_UNASSIGNED
global _VARIABLE_UNASSIGNED = -84.0
end
using .TestModule718
end
""")
sleep(mtimedelay)
@eval using TestPkg718
sleep(mtimedelay)
@test TestPkg718._VARIABLE_UNASSIGNED == -84.0
write(joinpath(dn, "TestPkg718.jl"), """
module TestPkg718
module TestModule718
export _VARIABLE_UNASSIGNED
global _VARIABLE_UNASSIGNED = -83.0
end
using .TestModule718
end
""")
yry()
@test TestPkg718._VARIABLE_UNASSIGNED == -83.0

rm_precompile("TestPkg718")
pop!(LOAD_PATH)
end

do_test("Timing (issue #341)") && @testset "Timing (issue #341)" begin
testdir = newtestdir()
dn = joinpath(testdir, "Timing", "src")
Expand Down

0 comments on commit 1058a3e

Please sign in to comment.