Skip to content

Commit

Permalink
fix code_warntype on OpaqueClosures (JuliaLang#54378)
Browse files Browse the repository at this point in the history
Fixes JuliaLang#54375

---------

Co-authored-by: Shuhei Kadowaki <[email protected]>
  • Loading branch information
2 people authored and xlxs4 committed May 9, 2024
1 parent 43fafd9 commit 479987b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/InteractiveUtils/src/codeview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function code_warntype(io::IO, @nospecialize(f), @nospecialize(tt=Base.default_t
lineprinter = Base.IRShow.__debuginfo[debuginfo]
nargs::Int = 0
if isa(f, Core.OpaqueClosure)
isa(f.source, Method) && (nargs = f.nargs)
isa(f.source, Method) && (nargs = f.source.nargs)
print_warntype_codeinfo(io, Base.code_typed_opaque_closure(f, tt)[1]..., nargs; lineprinter)
return nothing
end
Expand Down
5 changes: 5 additions & 0 deletions stdlib/InteractiveUtils/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ tag = "ANY"
@test !warntype_hastag(ImportIntrinsics15819.sqrt15819, Tuple{Float64}, tag)
@test !warntype_hastag(ImportIntrinsics15819.sqrt15819, Tuple{Float32}, tag)

@testset "code_warntype OpaqueClosure" begin
g = Base.Experimental.@opaque Tuple{Float64} x -> 0.0
@test warntype_hastag(g, Tuple{Float64}, "::Float64")
end

end # module WarnType

# Adds test for PR #17636
Expand Down

0 comments on commit 479987b

Please sign in to comment.