@@ -980,7 +980,7 @@ function methods(@nospecialize(f), @nospecialize(t),
980
980
throw (ArgumentError (" argument is not a generic function" ))
981
981
end
982
982
t = to_tuple_type (t)
983
- world = typemax (UInt )
983
+ world = get_world_counter ( )
984
984
# Lack of specialization => a comprehension triggers too many invalidations via _collect, so collect the methods manually
985
985
ms = Method[]
986
986
for m in _methods (f, t, - 1 , world):: Vector
@@ -995,7 +995,7 @@ methods(f::Core.Builtin) = MethodList(Method[], typeof(f).name.mt)
995
995
996
996
function methods_including_ambiguous (@nospecialize (f), @nospecialize (t))
997
997
tt = signature_type (f, t)
998
- world = typemax (UInt )
998
+ world = get_world_counter ( )
999
999
min = RefValue {UInt} (typemin (UInt))
1000
1000
max = RefValue {UInt} (typemax (UInt))
1001
1001
ms = _methods_by_ftype (tt, nothing , - 1 , world, true , min, max, Ptr {Int32} (C_NULL ))
@@ -1069,7 +1069,7 @@ _uncompressed_ir(ci::Core.CodeInstance, s::Array{UInt8,1}) = ccall(:jl_uncompres
1069
1069
const uncompressed_ast = uncompressed_ir
1070
1070
const _uncompressed_ast = _uncompressed_ir
1071
1071
1072
- function method_instances (@nospecialize (f), @nospecialize (t), world:: UInt = typemax (UInt ))
1072
+ function method_instances (@nospecialize (f), @nospecialize (t), world:: UInt = get_world_counter ( ))
1073
1073
tt = signature_type (f, t)
1074
1074
results = Core. MethodInstance[]
1075
1075
for match in _methods_by_ftype (tt, - 1 , world):: Vector
@@ -1429,7 +1429,7 @@ function parentmodule(@nospecialize(f), @nospecialize(types))
1429
1429
end
1430
1430
1431
1431
"""
1432
- hasmethod(f, t::Type{<:Tuple}[, kwnames]; world=typemax(UInt )) -> Bool
1432
+ hasmethod(f, t::Type{<:Tuple}[, kwnames]; world=get_world_counter( )) -> Bool
1433
1433
1434
1434
Determine whether the given generic function has a method matching the given
1435
1435
`Tuple` of argument types with the upper bound of world age given by `world`.
@@ -1464,13 +1464,13 @@ julia> hasmethod(g, Tuple{}, (:a, :b, :c, :d)) # g accepts arbitrary kwargs
1464
1464
true
1465
1465
```
1466
1466
"""
1467
- function hasmethod (@nospecialize (f), @nospecialize (t); world= typemax (UInt ))
1467
+ function hasmethod (@nospecialize (f), @nospecialize (t); world:: UInt = get_world_counter ( ))
1468
1468
t = to_tuple_type (t)
1469
1469
t = signature_type (f, t)
1470
1470
return ccall (:jl_gf_invoke_lookup , Any, (Any, UInt), t, world) != = nothing
1471
1471
end
1472
1472
1473
- function hasmethod (@nospecialize (f), @nospecialize (t), kwnames:: Tuple{Vararg{Symbol}} ; world= typemax (UInt ))
1473
+ function hasmethod (@nospecialize (f), @nospecialize (t), kwnames:: Tuple{Vararg{Symbol}} ; world:: UInt = get_world_counter ( ))
1474
1474
# TODO : this appears to be doing the wrong queries
1475
1475
hasmethod (f, t, world= world) || return false
1476
1476
isempty (kwnames) && return true
@@ -1501,7 +1501,7 @@ function bodyfunction(basemethod::Method)
1501
1501
# %1 = mkw(kwvalues..., #self#, args...)
1502
1502
# return %1
1503
1503
# where `mkw` is the name of the "active" keyword body-function.
1504
- ast = Base . uncompressed_ast (basemethod)
1504
+ ast = uncompressed_ast (basemethod)
1505
1505
f = nothing
1506
1506
if isa (ast, Core. CodeInfo) && length (ast. code) >= 2
1507
1507
callexpr = ast. code[end - 1 ]
@@ -1570,10 +1570,11 @@ function isambiguous(m1::Method, m2::Method; ambiguous_bottom::Bool=false)
1570
1570
if ! ambiguous_bottom
1571
1571
has_bottom_parameter (ti) && return false
1572
1572
end
1573
+ world = get_world_counter ()
1573
1574
min = UInt[typemin (UInt)]
1574
1575
max = UInt[typemax (UInt)]
1575
1576
has_ambig = Int32[0 ]
1576
- ms = _methods_by_ftype (ti, nothing , - 1 , typemax (UInt) , true , min, max, has_ambig):: Vector
1577
+ ms = _methods_by_ftype (ti, nothing , - 1 , world , true , min, max, has_ambig):: Vector
1577
1578
has_ambig[] == 0 && return false
1578
1579
if ! ambiguous_bottom
1579
1580
filter! (ms) do m:: Core.MethodMatch
0 commit comments