Skip to content

Commit

Permalink
Test world age argument to code_typed.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Jun 9, 2021
1 parent 3bd6b3e commit 5c64c21
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -936,3 +936,19 @@ end
@test f !== Core._apply
@test occursin("f2#", String(nameof(f)))
end


@testset "code_typed(; world)" begin
mod = @eval module $(gensym()) end

@eval mod foo() = 1
world1 = Base.get_world_counter()
@test only(code_typed(mod.foo, ())).second == Int
@test only(code_typed(mod.foo, (); world=world1)).second == Int

@eval mod foo() = 2.
world2 = Base.get_world_counter()
@test only(code_typed(mod.foo, ())).second == Float64
@test only(code_typed(mod.foo, (); world=world1)).second == Int
@test only(code_typed(mod.foo, (); world=world2)).second == Float64
end

0 comments on commit 5c64c21

Please sign in to comment.