Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InteractiveUtils.jl: fixes issue where subtypes resolves bindings and causes deprecation warnings #56306

Merged
merged 1 commit into from
Oct 24, 2024
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
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