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
10 changes: 5 additions & 5 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ function active_module()
return invokelatest(active_module, active_repl)::Module
end

module UsesCoreAndBaseOnly
module UsesBaseOnly
end

function show_function(io::IO, f::Function, compact::Bool, fallback::Function)
Expand All @@ -550,8 +550,8 @@ function show_function(io::IO, f::Function, compact::Bool, fallback::Function)
elseif isdefined(fname, :module) && isdefinedglobal(fname.module, fname.singletonname) && isconst(fname.module, fname.singletonname) &&
getglobal(fname.module, fname.singletonname) === f
# this used to call the removed internal function `is_exported_from_stdlib`, which effectively
# just checked for exports from Core and Base.
mod = get(io, :module, UsesCoreAndBaseOnly)
# just checked for exports from Base.
mod = get(io, :module, UsesBaseOnly)
if !(isvisible(fname.singletonname, fname.module, mod) || fname.module === mod)
print(io, fname.module, ".")
end
Expand Down Expand Up @@ -825,7 +825,7 @@ function make_typealiases(@nospecialize(x::Type))
Any === x && return aliases, Union{}
x <: Tuple && return aliases, Union{}
mods = modulesof!(Set{Module}(), x)
Core in mods && push!(mods, Base)
replace!(mods, Core=>Base)
vars = Dict{Symbol,TypeVar}()
xenv = UnionAll[]
each = Any[]
Expand All @@ -843,7 +843,7 @@ function make_typealiases(@nospecialize(x::Type))
ti === Union{} && continue
# make sure this alias wasn't from an unrelated part of the Union
mod2 = modulesof!(Set{Module}(), alias)
mod in mod2 || (mod === Base && Core in mods) || continue
mod in mod2 || (mod === Base && Core in mod2) || continue
env = env::SimpleVector
applied = alias
if !isempty(env)
Expand Down
1 change: 1 addition & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2488,6 +2488,7 @@ end
@test string(Union{M37012.SimpleU, Nothing, T} where T) == "Union{Nothing, $(curmod_prefix)M37012.SimpleU, T} where T"
@test string(Union{AbstractVector{T}, T} where T) == "Union{AbstractVector{T}, T} where T"
@test string(Union{AbstractVector, T} where T) == "Union{AbstractVector, T} where T"
@test string(Union{Array, Memory}) == "Union{Array, Memory}"

@test sprint(show, :(./)) == ":((./))"
@test sprint(show, :((.|).(.&, b))) == ":((.|).((.&), b))"
Expand Down