Skip to content

Commit 00ca50b

Browse files
authored
Merge branch 'master' into strings_search_restrict_IteratorSize_eltype
2 parents a6a8bd2 + 4d40c64 commit 00ca50b

File tree

12 files changed

+30
-30
lines changed

12 files changed

+30
-30
lines changed

Compiler/src/ssair/verify.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3-
irshow_was_loaded() = invokelatest(isdefined, Compiler.IRShow, :debuginfo_firstline)
3+
irshow_was_loaded() = invokelatest(isdefinedglobal, Compiler.IRShow, :debuginfo_firstline)
44
function maybe_show_ir(ir::IRCode)
55
if irshow_was_loaded()
66
# ensure we use I/O that does not yield, as this gets called during compilation

base/docs/bindings.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ end
1616

1717
bindingexpr(x) = Expr(:call, Binding, splitexpr(x)...)
1818

19-
defined(b::Binding) = invokelatest(isdefined, b.mod, b.var)
20-
resolve(b::Binding) = invokelatest(getfield, b.mod, b.var)
19+
defined(b::Binding) = invokelatest(isdefinedglobal, b.mod, b.var)
20+
resolve(b::Binding) = invokelatest(getglobal, b.mod, b.var)
2121

2222
function splitexpr(x::Expr)
2323
isexpr(x, :macrocall) ? splitexpr(x.args[1]) :

base/errorshow.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ function showerror(io::IO, ex::MethodError)
339339
# Check all modules (sorted for consistency)
340340
sorted_modules = sort!(collect(modules_to_check), by=nameof)
341341
for mod in sorted_modules
342-
if isdefined(mod, name)
343-
candidate = getfield(mod, name)
342+
if isdefinedglobal(mod, name)
343+
candidate = getglobal(mod, name)
344344
if candidate !== f && hasmethod(candidate, arg_types; world=ex.world)
345345
if mod === Base
346346
print(io, "\nYou may have intended to import ")

base/show.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -632,8 +632,8 @@ function make_typealias(@nospecialize(x::Type))
632632
x isa UnionAll && push!(xenv, x)
633633
for mod in mods
634634
for name in unsorted_names(mod)
635-
if isdefined(mod, name) && !isdeprecated(mod, name) && isconst(mod, name)
636-
alias = getfield(mod, name)
635+
if isdefinedglobal(mod, name) && !isdeprecated(mod, name) && isconst(mod, name)
636+
alias = getglobal(mod, name)
637637
if alias isa Type && !has_free_typevars(alias) && !print_without_params(alias) && x <: alias
638638
if alias isa UnionAll
639639
(ti, env) = ccall(:jl_type_intersection_with_env, Any, (Any, Any), x, alias)::SimpleVector
@@ -836,8 +836,8 @@ function make_typealiases(@nospecialize(x::Type))
836836
x isa UnionAll && push!(xenv, x)
837837
for mod in mods
838838
for name in unsorted_names(mod)
839-
if isdefined(mod, name) && !isdeprecated(mod, name) && isconst(mod, name)
840-
alias = getfield(mod, name)
839+
if isdefinedglobal(mod, name) && !isdeprecated(mod, name) && isconst(mod, name)
840+
alias = getglobal(mod, name)
841841
if alias isa Type && !has_free_typevars(alias) && !print_without_params(alias) && !(alias <: Tuple)
842842
(ti, env) = ccall(:jl_type_intersection_with_env, Any, (Any, Any), x, alias)::SimpleVector
843843
ti === Union{} && continue

src/gen_sysimg_symtab.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import Base.Iterators: take, drop
1111
function _eachmethod(f, m::Module, visited, vmt)
1212
push!(visited, m)
1313
for nm in names(m, all=true)
14-
if isdefined(m, nm)
15-
x = getfield(m, nm)
14+
if isdefinedglobal(m, nm)
15+
x = getglobal(m, nm)
1616
if isa(x, Module) && !in(x, visited)
1717
_eachmethod(f, x, visited, vmt)
1818
elseif isa(x, Type)

stdlib/InteractiveUtils/src/InteractiveUtils.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function varinfo(m::Module=Base.active_module(), pattern::Regex=r""; all::Bool =
5353
if !isdefined(m2, v) || !occursin(pattern, string(v))
5454
continue
5555
end
56-
value = getfield(m2, v)
56+
value = getglobal(m2, v)
5757
isbuiltin = value === Base || value === Base.active_module() || value === Core
5858
if recursive && !isbuiltin && isa(value, Module) && value !== m2 && nameof(value) === v && parentmodule(value) === m2
5959
push!(workqueue, (value, "$prep$v."))
@@ -232,8 +232,8 @@ end
232232
function _methodswith(@nospecialize(t::Type), m::Module, supertypes::Bool)
233233
meths = Method[]
234234
for nm in names(m)
235-
if isdefined(m, nm)
236-
f = getfield(m, nm)
235+
if isdefinedglobal(m, nm)
236+
f = getglobal(m, nm)
237237
if isa(f, Base.Callable)
238238
methodswith(t, f, meths; supertypes = supertypes)
239239
end
@@ -264,8 +264,8 @@ function _subtypes_in!(mods::Array, x::Type)
264264
m = pop!(mods)
265265
xt = xt::DataType
266266
for s in names(m, all = true)
267-
if !isdeprecated(m, s) && isdefined(m, s)
268-
t = getfield(m, s)
267+
if !isdeprecated(m, s) && isdefinedglobal(m, s)
268+
t = getglobal(m, s)
269269
dt = isa(t, UnionAll) ? unwrap_unionall(t) : t
270270
if isa(dt, DataType)
271271
if dt.name.name === s && dt.name.module == m && supertype(dt).name == xt.name

test/core.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,8 +1206,8 @@ end
12061206
# Module() constructor
12071207
@test names(Module(:anonymous), all = true, imported = true) == [:anonymous]
12081208
@test names(Module(:anonymous, false), all = true, imported = true) == [:anonymous]
1209-
@test invokelatest(getfield, Module(:anonymous, false, true), :Core) == Core
1210-
@test_throws UndefVarError invokelatest(getfield, Module(:anonymous, false, false), :Core)
1209+
@test invokelatest(getglobal, Module(:anonymous, false, true), :Core) == Core
1210+
@test_throws UndefVarError invokelatest(getglobal, Module(:anonymous, false, false), :Core)
12111211

12121212
# exception from __init__()
12131213
let didthrow =

test/docs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ end
119119
# issue #38819
120120

121121
module NoDocStrings end
122-
@test meta(NoDocStrings) === invokelatest(getfield, NoDocStrings, Base.Docs.META)
122+
@test meta(NoDocStrings) === invokelatest(getglobal, NoDocStrings, Base.Docs.META)
123123

124124
# General tests for docstrings.
125125

test/error.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ end
109109
if mod visited
110110
push!(visited, mod)
111111
for name in names(mod, all=true)
112-
isdefined(mod, name) || continue
113-
value = getfield(mod, name)
112+
isdefinedglobal(mod, name) || continue
113+
value = getglobal(mod, name)
114114
if value isa Module
115115
value === Main && continue
116116
test_exceptions(value, visited)

test/numbers.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,8 +2420,8 @@ end
24202420

24212421
function allsubtypes!(m::Module, x::DataType, sts::Set)
24222422
for s in names(m, all = true)
2423-
if isdefined(m, s) && !Base.isdeprecated(m, s)
2424-
t = getfield(m, s)
2423+
if isdefinedglobal(m, s) && !Base.isdeprecated(m, s)
2424+
t = getglobal(m, s)
24252425
if isa(t, Type) && t <: x && t != Union{}
24262426
push!(sts, t)
24272427
elseif isa(t, Module) && t !== m && nameof(t) === s && parentmodule(t) === m

0 commit comments

Comments
 (0)