-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
compiler:precompilationPrecompilation of modulesPrecompilation of modules
Description
(This is copied over from #43990 (comment))
When a method is called via invoke, the specialization might appear to be one that should be superseded, but this is not always the case. To demonstrate this, create two packages:
module PkgA
f(::Int) = 1
f(::Any) = 2
g() = invoke(f, Tuple{Any}, 0)
g()
end # moduleand
module PkgB
using PkgA
PkgA.f(::Real) = 3
end # moduleWe incorrectly invalidate g when we load PkgB:
julia> using PkgA
julia> PkgA.g()
2
julia> m = which(PkgA.g, ())
g() in PkgA at /tmp/pkgv/PkgA/src/PkgA.jl:6
julia> mi = m.specializations[1]
MethodInstance for PkgA.g()
julia> mi.cache.max_world
0xffffffffffffffff
julia> using PkgB
julia> mi.cache.max_world
0x0000000000007a61
julia> PkgA.g()
2This is incorrect because the code that should run is unchanged by loading PkgB.
Metadata
Metadata
Assignees
Labels
compiler:precompilationPrecompilation of modulesPrecompilation of modules