Skip to content

Commit 05f2e31

Browse files
committed
fix #15760, bad warning for type with same name as deprecated binding
The cause was `is_exported_from_stdlib` attempting to look up the name from the top level (Main), even if it never could have resolved to Base.
1 parent 0dcb477 commit 05f2e31

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

base/show.jl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,16 @@ end
127127

128128
# Check if a particular symbol is exported from a standard library module
129129
function is_exported_from_stdlib(name::Symbol, mod::Module)
130-
if (mod === Base || mod === Core) && isexported(mod, name)
131-
return true
132-
end
133-
parent = module_parent(mod)
134-
if parent !== mod && isdefined(mod, name) && isdefined(parent, name) &&
135-
getfield(mod, name) === getfield(parent, name)
136-
return is_exported_from_stdlib(name, parent)
130+
!isdefined(mod, name) && return false
131+
orig = getfield(mod, name)
132+
while !(mod === Base || mod === Core)
133+
parent = module_parent(mod)
134+
if mod === Main || mod === parent || parent === Main
135+
return false
136+
end
137+
mod = parent
137138
end
138-
return false
139+
return isexported(mod, name) && isdefined(mod, name) && getfield(mod, name) === orig
139140
end
140141

141142
function show(io::IO, f::Function)

0 commit comments

Comments
 (0)