Skip to content

Commit 1058a3e

Browse files
authored
Merge pull request #795 from timholy/teh/test_718
Groundwork for a fix for #718
2 parents 9272cba + 815209e commit 1058a3e

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

src/lowered.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function categorize_stmt(@nospecialize(stmt))
6262
return ismeth, haseval, isinclude, isnamespace, istoplevel
6363
end
6464
# Check for thunks that define functions (fixes #792)
65-
function defines_function(ci)
65+
function defines_function(@nospecialize(ci))
6666
isa(ci, CodeInfo) || return false
6767
if length(ci.code) == 1
6868
stmt = ci.code[1]

src/parsing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function process_source!(mod_exprs_sigs::ModuleExprsSigs, ex, filename, mod::Mod
7272
if isa(a, LineNumberNode)
7373
lnn = a
7474
else
75-
pushex!(exprs_sigs, Expr(:block, lnn, a))
75+
pushex!(exprs_sigs, Expr(:toplevel, lnn, a))
7676
end
7777
end
7878
else

test/runtests.jl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,6 +1635,45 @@ const issue639report = []
16351635
pop!(LOAD_PATH)
16361636
end
16371637

1638+
do_test("Submodule in same file (#718)") && @testset "Submodule in same file (#718)" begin
1639+
testdir = newtestdir()
1640+
dn = joinpath(testdir, "TestPkg718", "src")
1641+
mkpath(dn)
1642+
write(joinpath(dn, "TestPkg718.jl"), """
1643+
module TestPkg718
1644+
1645+
module TestModule718
1646+
export _VARIABLE_UNASSIGNED
1647+
global _VARIABLE_UNASSIGNED = -84.0
1648+
end
1649+
1650+
using .TestModule718
1651+
1652+
end
1653+
""")
1654+
sleep(mtimedelay)
1655+
@eval using TestPkg718
1656+
sleep(mtimedelay)
1657+
@test TestPkg718._VARIABLE_UNASSIGNED == -84.0
1658+
write(joinpath(dn, "TestPkg718.jl"), """
1659+
module TestPkg718
1660+
1661+
module TestModule718
1662+
export _VARIABLE_UNASSIGNED
1663+
global _VARIABLE_UNASSIGNED = -83.0
1664+
end
1665+
1666+
using .TestModule718
1667+
1668+
end
1669+
""")
1670+
yry()
1671+
@test TestPkg718._VARIABLE_UNASSIGNED == -83.0
1672+
1673+
rm_precompile("TestPkg718")
1674+
pop!(LOAD_PATH)
1675+
end
1676+
16381677
do_test("Timing (issue #341)") && @testset "Timing (issue #341)" begin
16391678
testdir = newtestdir()
16401679
dn = joinpath(testdir, "Timing", "src")

0 commit comments

Comments
 (0)