Skip to content

Conversation

@t-bltg
Copy link
Collaborator

@t-bltg t-bltg commented Jun 26, 2022

Fix #689.

Shouldn't all PkgId(mod) be mapped to PkgId(mod, string(mod) (else PkgId(mod) maps to PkgId(mod, "Main")) ?

@t-bltg
Copy link
Collaborator Author

t-bltg commented Jun 26, 2022

Weird errors on 1: LoadError: UndefVarError: Base_Docs_4352b6d8 not defined.
They seem unrelated to this PR (same errors occur when running ] test Revise against #master).

Xref:
#505
#520
#561

The error on 1.6 & windows (of course, damn *** :/) looks related to the added test :

   in expression starting at C:\Users\RUNNER~1\AppData\Local\Temp\ML0Fd83oSC\driver.jl:3
caused by: LoadError: "invalid escape sequence"

==> Edit: fixed

@timholy
Copy link
Owner

timholy commented Jul 23, 2022

Shouldn't all PkgId(mod) be mapped to PkgId(mod, string(mod) (else PkgId(mod) maps to PkgId(mod, "Main")) ?

Base uses moduleroot to get the top-level module. In this case the root really is Main, because you're not loading a package.

I think this change would break for a submodule of Base (or any package submodule):

julia> Revise.track(Base)

julia> id = Base.PkgId(Base.Filesystem)
Base [top-level]

julia> pkgdata = Revise.pkgdatas[id];   # works

julia> id = Base.PkgId(Base.Filesystem, string(Base.Filesystem))
Base.Filesystem [top-level]

julia> pkgdata = Revise.pkgdatas[id]
ERROR: KeyError: key Base.Filesystem [top-level] not found
Stacktrace:
 [1] getindex(h::Dict{Base.PkgId, Revise.PkgData}, key::Base.PkgId)
   @ Base ./dict.jl:498
 [2] top-level scope
   @ REPL[10]:1

Would it be worth first trying the version that's already in the code, and then if haskey(pkgdatas, id) fails, maybe try your version? Perhaps specifically in the case where moduleroot(mod) == Main?

Thanks very much for the test!

@t-bltg
Copy link
Collaborator Author

t-bltg commented Jul 23, 2022

In this case the root really is Main, because you're not loading a package.

I see, good point.

Would it be worth first trying the version that's already in the code, and then if haskey(pkgdatas, id) fails, maybe try your version

Thanks for the hint. This is a good idea, I'll try to work something out now.

@t-bltg
Copy link
Collaborator Author

t-bltg commented Jul 23, 2022

Tests on 1.6 are ✔, so I think that this PR is ready.

@timholy timholy merged commit c6a8b87 into timholy:master Jul 23, 2022
@timholy
Copy link
Owner

timholy commented Jul 23, 2022

Thanks!

@t-bltg t-bltg deleted the bug branch July 23, 2022 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failing includet

2 participants