I am getting incomplete package updates from Revise.jl 3.5.0 in Julia 1.8.2 Linux x64 (Docker on MacOS 13.1) which I managed to track to the following minimal example:
Example Package
src/Example.jl:
module Example
module A
include("a.jl")
end
module B
include("a.jl")
end
export A, B
end
src/a.jl:
f(x) = y
Manifest.toml:
name = "Example"
uuid = "1fcb2a49-e178-4b19-98f0-97e19ed5c4de"
authors = ["Some Authors"]
version = "0.1.0"
[deps]
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
and empty test folder
Example Session (launched via julia --project on the package’s dir):
julia> using Revise
julia> using Example
[ Info: Precompiling Example [1fcb2a49-e178-4b19-98f0-97e19ed5c4de]
julia> A.f(1)
ERROR: UndefVarError: y not defined
Stacktrace:
[1] f(x::Int64)
@ Example.A src/a.jl:1
[2] top-level scope
...
[Correct src/a.jl to be f(x) = x]
...
julia> A.f(1)
1
julia> B.f(1)
ERROR: UndefVarError: y not defined
Stacktrace:
[1] f(x::Int64)
@ Example.B src/a.jl:1
[2] top-level scope
In the example above B.f remains broken, even though a restart of the session would fix it!
Am I hitting a limitation of Revise.jl or is this a bug?
To be honest, there isn’t and I will change the original code so that it doesn’t.
However the issue remains in that I didn’t get any warning, and Revise.jl updated the package only partially.
As such I think this is a bug, affecting how much Revise.jl can be trusted (especially in an codebase that I am not the sole author) unless already documented as a limitation.
This issue, or one like it, happens to me very often in the early stages of writing a package. Essentially an error that is fixed is not picked up by Revise. Makes using it extremely annoying.
By the way, Revise also cannot check definition order for modified code. So if I add a function on a type that is defined somewhere later in code, I don’t get undefined error.