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 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3762,6 +3762,36 @@ do_test("includet with mod arg (issue #689)") && @testset "includet with mod arg
@test Driver.Codes.Common.foo == 2
end

do_test("Overlay Method Tables") && @testset "Overlay Method Tables" begin
# Issue #646
testdir = newtestdir()
file = joinpath(testdir, "overlaymt.jl")
write(file, """
Base.Experimental.@MethodTable(method_table)

foo_mt() = 1
Base.Experimental.@overlay Main.method_table foo_mt() = 2
""")
sleep(mtimedelay)
includet(file)
@test foo_mt() == 1
methods = Base._methods_by_ftype(Tuple{typeof(foo_mt)}, method_table, 1, Base.get_world_counter())
ci = Base.uncompressed_ir(methods[1].method)
@test ci.code[end] == Core.ReturnNode(2)
sleep(mtimedelay)
write(file, """
Base.Experimental.@MethodTable(method_table)

foo_mt() = 1
Base.Experimental.@overlay Main.method_table foo_mt() = 3
""")
sleep(mtimedelay)
@test foo_mt() == 1
methods = Base._methods_by_ftype(Tuple{typeof(foo_mt)}, method_table, 1, Base.get_world_counter())
ci = Base.uncompressed_ir(methods[1].method)
@test_broken ci.code[end] == Core.ReturnNode(3)
end

do_test("misc - coverage") && @testset "misc - coverage" begin
@test Revise.ReviseEvalException("undef", UndefVarError(:foo)).loc isa String
@test !Revise.throwto_repl(UndefVarError(:foo))
Expand Down
Loading