Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise gives MethodError on "module" 2-argument includes #670

Closed
ianatol opened this issue Feb 9, 2022 · 2 comments · Fixed by #672
Closed

Revise gives MethodError on "module" 2-argument includes #670

ianatol opened this issue Feb 9, 2022 · 2 comments · Fixed by #672

Comments

@ianatol
Copy link
Contributor

ianatol commented Feb 9, 2022

The include(mapexpr, path) case is discussed at #634, but similarly, Revise can't handle include(m::Module, path) either.

See JuliaLang/julia#43800 (comment) for an example.

For the module case, I tried the naive fix of modifying methods_by_execution as follows:

elseif skip_include && (f === modinclude || f === Base.include || f === Core.include)
                    # include calls need to be managed carefully from several standpoints, including
                    # path management and parsing new expressions
                    mod_or_path = @lookup(frame, stmt.args[2])
                    if isa(mod_or_path, Module) # include(mod, pathname)
                        add_includes!(methodinfo, mod_or_path, @lookup(frame, stmt.args[3]))
                    else
                        add_includes!(methodinfo, mod, mod_or_path)
                    end
                    assign_this!(frame, nothing)  # FIXME: the file might return something different from `nothing`
                    pc = next_or_nothing!(frame)

This passes Revise tests but doesn't seem to correctly give Revise access to the names from the include, as we hit a UndefVarError in the EscapeAnalysis example above. Will update if I can fix later today!

@ianatol ianatol changed the title Revise gives MethodError on 2-argument includes Revise gives MethodError on "module" 2-argument includes Feb 9, 2022
@timholy
Copy link
Owner

timholy commented Feb 11, 2022

I'll get to this after the Julia 1.8 feature freeze. Bump this if I don't.

@ianatol
Copy link
Contributor Author

ianatol commented Feb 17, 2022

Bumping, and on second thought I think my solution might work. There were other problems in the EA case that led to the UndefVarError, so this naive approach might actually be correct..

If you can't get around to it, I'll try and figure out how to write a test and open a PR based on this solution tomorrow.

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 a pull request may close this issue.

2 participants