diff --git a/stdlib/InteractiveUtils/src/codeview.jl b/stdlib/InteractiveUtils/src/codeview.jl index 4fb7610d4ad0d..015269d4d8dc0 100644 --- a/stdlib/InteractiveUtils/src/codeview.jl +++ b/stdlib/InteractiveUtils/src/codeview.jl @@ -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 diff --git a/stdlib/InteractiveUtils/test/runtests.jl b/stdlib/InteractiveUtils/test/runtests.jl index 22789be2c5495..dbae46e1c902a 100644 --- a/stdlib/InteractiveUtils/test/runtests.jl +++ b/stdlib/InteractiveUtils/test/runtests.jl @@ -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