Skip to content

Commit

Permalink
fixes issue where subtypes resolves bindings and causes deprecation w…
Browse files Browse the repository at this point in the history
…arnings
  • Loading branch information
dgleich committed Oct 23, 2024
1 parent 73b85cf commit 3b7a12c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/InteractiveUtils/src/InteractiveUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export apropos, edit, less, code_warntype, code_llvm, code_native, methodswith,
import Base.Docs.apropos

using Base: unwrap_unionall, rewrap_unionall, isdeprecated, Bottom, summarysize,
signature_type, format_bytes
signature_type, format_bytes, isbindingresolved
using Base.Libc
using Markdown

Expand Down Expand Up @@ -262,7 +262,7 @@ function _subtypes_in!(mods::Array, x::Type)
m = pop!(mods)
xt = xt::DataType
for s in names(m, all = true)
if isdefined(m, s) && !isdeprecated(m, s)
if isbindingresolved(m, s) && !isdeprecated(m, s) && isdefined(m, s)
t = getfield(m, s)
dt = isa(t, UnionAll) ? unwrap_unionall(t) : t
if isa(dt, DataType)
Expand Down
19 changes: 19 additions & 0 deletions stdlib/InteractiveUtils/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -823,3 +823,22 @@ end
@testset "Docstrings" begin
@test isempty(Docs.undocumented_names(InteractiveUtils))
end

# issue https://github.com/JuliaIO/ImageMagick.jl/issues/235
module OuterModule
module InternalModule
struct MyType
x::Int
end

Base.@deprecate_binding MyOldType MyType

export MyType
end
using .InternalModule
export MyType, MyOldType
end # module
@testset "Subtypes and deprecations" begin
using .OuterModule
@test_nowarn subtypes(Integer);
end

0 comments on commit 3b7a12c

Please sign in to comment.