From 5c64c21c3dc872829469726265e7fdd8530b0d62 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Wed, 9 Jun 2021 13:01:40 +0200 Subject: [PATCH] Test world age argument to code_typed. --- test/reflection.jl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/reflection.jl b/test/reflection.jl index 2e0ad68cf8aa1..4faa367817104 100644 --- a/test/reflection.jl +++ b/test/reflection.jl @@ -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