Skip to content

Commit c3f7a07

Browse files
committed
Fixes for nightly
1 parent bca4b2c commit c3f7a07

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/utilities.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,10 @@ kws = keywords(f, first(methods(f)))
452452
```
453453
"""
454454
function keywords(func, m::Method)
455-
table = methods(func).mt
456-
# table is a MethodTable object. For some reason, the :kwsorter field is not always
457-
# defined. An undefined kwsorter seems to imply that there are no methods in the
458-
# MethodTable with keyword arguments.
455+
table::Core.MethodTable = VERSION v"1.13.0-DEV.647" ? Core.GlobalMethods : methods(func).mt
456+
# For some reason, the :kwsorter field is not always defined.
457+
# An undefined kwsorter seems to imply that there are no methods
458+
# in the MethodTable with keyword arguments.
459459
if !(Base.fieldindex(Core.MethodTable, :kwsorter, false) > 0) || isdefined(table, :kwsorter)
460460
# Fetching method keywords stolen from base/replutil.jl:572-576 (commit 3b45cdc9aab0):
461461
kwargs = VERSION < v"1.4.0-DEV.215" ? Base.kwarg_decl(m, typeof(table.kwsorter)) : Base.kwarg_decl(m)

test/tests.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ end
4040
# Its signature is kwarg_decl(m::Method, kwtype::DataType). The second argument
4141
# should be the type of the kwsorter from the corresponding MethodTable.
4242
@test isa(methods(M.j_1), Base.MethodList)
43-
@test isdefined(methods(M.j_1), :mt)
44-
local mt = methods(M.j_1).mt
43+
get_mt(func) = VERSION v"1.13.0-DEV.647" ? Core.GlobalMethods : methods(func).mt
44+
local mt = get_mt(M.j_1)
4545
@test isa(mt, Core.MethodTable)
4646
if Base.fieldindex(Core.MethodTable, :kwsorter, false) > 0
4747
@test isdefined(mt, :kwsorter)
4848
end
4949
# .kwsorter is not always defined -- namely, it seems when none of the methods
5050
# have keyword arguments:
51-
@test isdefined(methods(M.f).mt, :kwsorter) === false
51+
@test isdefined(get_mt(M.f), :kwsorter) === false
5252
# M.j_1 has two methods. Fetch the single argument one..
5353
local m = which(M.j_1, (Any,))
5454
@test isa(m, Method)
@@ -61,7 +61,7 @@ end
6161
# that does not have any arguments
6262
m = which(M.j_1, (Any,Any)) # fetch the no-keyword method
6363
if VERSION < v"1.4.0-DEV.215"
64-
@test Base.kwarg_decl(m, typeof(methods(M.j_1).mt.kwsorter)) == Tuple{}()
64+
@test Base.kwarg_decl(m, typeof(get_mt(M.j_1).kwsorter)) == Tuple{}()
6565
else
6666
@test Base.kwarg_decl(m) == []
6767
end
@@ -83,7 +83,9 @@ end
8383
DSE.format(IMPORTS, buf, doc)
8484
str = String(take!(buf))
8585
@test occursin("\n - `Base`\n", str)
86-
@test occursin("\n - `Core`\n", str)
86+
if VERSION < v"1.13-DEV"
87+
@test occursin("\n - `Core`\n", str)
88+
end
8789

8890
# Module exports.
8991
DSE.format(EXPORTS, buf, doc)

0 commit comments

Comments
 (0)