File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -3762,6 +3762,36 @@ do_test("includet with mod arg (issue #689)") && @testset "includet with mod arg
3762
3762
@test Driver. Codes. Common. foo == 2
3763
3763
end
3764
3764
3765
+ do_test (" Overlay Method Tables" ) && @testset " Overlay Method Tables" begin
3766
+ # Issue #646
3767
+ testdir = newtestdir ()
3768
+ file = joinpath (testdir, " overlaymt.jl" )
3769
+ write (file, """
3770
+ Base.Experimental.@MethodTable(method_table)
3771
+
3772
+ foo_mt() = 1
3773
+ Base.Experimental.@overlay Main.method_table foo_mt() = 2
3774
+ """ )
3775
+ sleep (mtimedelay)
3776
+ includet (file)
3777
+ @test foo_mt () == 1
3778
+ methods = Base. _methods_by_ftype (Tuple{typeof (foo_mt)}, method_table, 1 , Base. get_world_counter ())
3779
+ ci = Base. uncompressed_ir (methods[1 ]. method)
3780
+ @test ci. code[end ] == Core. ReturnNode (2 )
3781
+ sleep (mtimedelay)
3782
+ write (file, """
3783
+ Base.Experimental.@MethodTable(method_table)
3784
+
3785
+ foo_mt() = 1
3786
+ Base.Experimental.@overlay Main.method_table foo_mt() = 3
3787
+ """ )
3788
+ sleep (mtimedelay)
3789
+ @test foo_mt () == 1
3790
+ methods = Base. _methods_by_ftype (Tuple{typeof (foo_mt)}, method_table, 1 , Base. get_world_counter ())
3791
+ ci = Base. uncompressed_ir (methods[1 ]. method)
3792
+ @test_broken ci. code[end ] == Core. ReturnNode (3 )
3793
+ end
3794
+
3765
3795
do_test (" misc - coverage" ) && @testset " misc - coverage" begin
3766
3796
@test Revise. ReviseEvalException (" undef" , UndefVarError (:foo )). loc isa String
3767
3797
@test ! Revise. throwto_repl (UndefVarError (:foo ))
You can’t perform that action at this time.
0 commit comments