File tree 2 files changed +37
-1
lines changed
2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -54,8 +54,10 @@ JL_DLLEXPORT jl_module_t *jl_new_main_module(void)
54
54
55
55
jl_main_module = jl_new_module (jl_symbol ("Main" ));
56
56
jl_main_module -> parent = jl_main_module ;
57
- if (old_main ) // don't block continued loading of incremental caches
57
+ if (old_main ) { // don't block continued loading of incremental caches
58
+ jl_main_module -> primary_world = old_main -> primary_world ;
58
59
jl_main_module -> uuid = old_main -> uuid ;
60
+ }
59
61
ptls -> current_module = jl_main_module ;
60
62
61
63
jl_core_module -> parent = jl_main_module ;
Original file line number Diff line number Diff line change 1
1
# This file is a part of Julia. License is MIT: https://julialang.org/license
2
2
3
+ using Base. Test
4
+
3
5
script = """
4
6
# Issue #11948
5
7
f(x) = x+1
@@ -24,3 +26,35 @@ mutable struct Foo end
24
26
@assert Tuple{Type{LastMain.Foo}} !== Tuple{Type{Main.Foo}}
25
27
"""
26
28
run (` $exename --startup-file=no -e $script2 ` )
29
+
30
+ # Issue #22101
31
+ mktempdir () do dir
32
+ withenv (" JULIA_DEBUG_LOADING" => nothing ) do
33
+ # We need to ensure that the module does a nontrivial amount of work during precompilation
34
+ write (joinpath (dir, " Test22101.jl" ), """
35
+ __precompile__()
36
+ module Test22101
37
+ export f22101
38
+ f22101() = collect(1:10)
39
+ f22101()
40
+ end
41
+ """ )
42
+ write (joinpath (dir, " testdriver.jl" ), """
43
+ insert!(LOAD_PATH, 1, $(repr (dir)) )
44
+ insert!(Base.LOAD_CACHE_PATH, 1, $(repr (dir)) )
45
+ try
46
+ using Test22101
47
+ f22101()
48
+ workspace()
49
+ using Test22101
50
+ finally
51
+ splice!(LOAD_PATH, 1)
52
+ splice!(Base.LOAD_CACHE_PATH, 1)
53
+ end
54
+ exit(isdefined(Main, :f22101) ? 0 : 1)
55
+ """ )
56
+ # Ensure that STDIO doesn't get swallowed (helps with debugging)
57
+ cmd = ` $(Base. julia_cmd ()) --startup-file=no --precompiled=yes --compilecache=yes $(joinpath (dir, " testdriver.jl" )) `
58
+ @test success (pipeline (cmd, stdout = STDOUT, stderr = STDERR))
59
+ end
60
+ end
You can’t perform that action at this time.
0 commit comments