File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -926,9 +926,10 @@ function _require(pkg::PkgId)
926
926
- Run `Pkg.instantiate()` to install all recorded dependencies.
927
927
""" ))
928
928
end
929
+ needs_precompile = ! occursin (r" __precompile__\( false\) " , read (path, String))
929
930
930
931
# attempt to load the module file via the precompile cache locations
931
- if JLOptions (). use_compiled_modules != 0
932
+ if JLOptions (). use_compiled_modules != 0 && needs_precompile
932
933
m = _require_search_from_serialized (pkg, path)
933
934
if ! isa (m, Bool)
934
935
return
@@ -948,7 +949,7 @@ function _require(pkg::PkgId)
948
949
end
949
950
end
950
951
951
- if JLOptions (). use_compiled_modules != 0
952
+ if JLOptions (). use_compiled_modules != 0 && needs_precompile
952
953
if (0 == ccall (:jl_generating_output , Cint, ())) || (JLOptions (). incremental != 0 )
953
954
# spawn off a new incremental pre-compile task for recursive `require` calls
954
955
# or if the require search declared it was pre-compiled before (and therefore is expected to still be pre-compilable)
Original file line number Diff line number Diff line change 281
281
"""
282
282
__precompile__(false)
283
283
module Baz
284
+ baz() = 1
284
285
end
285
286
""" )
286
287
291
292
isa (exc, ErrorException) || rethrow (exc)
292
293
occursin (" __precompile__(false)" , exc. msg) && rethrow (exc)
293
294
end
295
+ @eval using Baz
296
+ @test Base. invokelatest (Baz. baz) == 1
294
297
295
298
# Issue #12720
296
299
FooBar1_file = joinpath (dir, " FooBar1.jl" )
You can’t perform that action at this time.
0 commit comments