Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions stdlib/InteractiveUtils/src/codeview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ Keyword argument `debuginfo` may be one of `:source` or `:none` (default), to sp

See [`@code_warntype`](@ref man-code-warntype) for more information.
"""
function code_warntype(io::IO, @nospecialize(f), @nospecialize(t); debuginfo::Symbol=:default, optimize::Bool=false)
function code_warntype(io::IO, @nospecialize(f), @nospecialize(t);
debuginfo::Symbol=:default, optimize::Bool=false, kwargs...)
debuginfo = Base.IRShow.debuginfo(debuginfo)
lineprinter = Base.IRShow.__debuginfo[debuginfo]
for (src, rettype) in code_typed(f, t, optimize=optimize)
for (src, rettype) in code_typed(f, t; optimize, kwargs...)
lambda_io::IOContext = io
p = src.parent
nargs::Int = 0
Expand Down
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