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

Add test for Overlay Method Tables #815

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vchuravy
Copy link

Adds the test for #646 (still broken).

Of note is that in the REPL this works fine:

julia> Base.Experimental.@MethodTable(method_table)
# 0 methods for callable object

julia> foo() = 1
foo (generic function with 1 method)

julia> Base.Experimental.@overlay Main.method_table foo() = 2

julia> methods = Base._methods_by_ftype(Tuple{typeof(foo)}, method_table, 1, Base.get_world_counter())
1-element Vector{Any}:
 Core.MethodMatch(Tuple{typeof(foo)}, svec(), foo() @ Main REPL[3]:1, true)

julia> display(Base.uncompressed_ir(methods[1].method))
CodeInfo(
1 ─     return 2
)

julia> Base.Experimental.@overlay Main.method_table foo() = 3

julia> methods = Base._methods_by_ftype(Tuple{typeof(foo)}, method_table, 1, Base.get_world_counter())
1-element Vector{Any}:
 Core.MethodMatch(Tuple{typeof(foo)}, svec(), foo() @ Main REPL[6]:1, true)

julia> display(Base.uncompressed_ir(methods[1].method))
CodeInfo(
1 ─     return 3
)

@timholy
Copy link
Owner

timholy commented Sep 26, 2024

Thanks very much for the test. Among new features for Revise, this is now top priority. I won't have time for "deep" work on Revise until late October, but if this isn't completed by the end of 2024, please bug me.

test/runtests.jl Outdated Show resolved Hide resolved
test/runtests.jl Outdated Show resolved Hide resolved
Base.Experimental.@MethodTable(method_table)

foo_mt() = 1
Base.Experimental.@overlay method_table foo_mt() = 2
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail if it is Main.method_table since LoweredCodeUtils can't handle the generated expression.

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.

2 participants