Skip to content

Commit 39d7483

Browse files
authored
inference: allow specialization of scan_specified_partitions (#58165)
Changed the `::Function` signature to the `::F where F` pattern to allow specialization of `scan_specified_partitions`. The changes in `scan_leaf_partitions` and `scan_partitions` are not actually necessary because those methods are simple and are basically inlined and optimized down to calling `scan_specified_partitions`. However, considering the possibility of other code being added in the future and also for consistency, the same changes were applied.
1 parent 334c316 commit 39d7483

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Compiler/src/abstractinterpretation.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3609,7 +3609,8 @@ function abstract_eval_partition_load(interp::Union{AbstractInterpreter,Nothing}
36093609
return RTEffects(rt, exct, effects)
36103610
end
36113611

3612-
function scan_specified_partitions(query::Function, walk_binding_partition::Function, interp::Union{AbstractInterpreter,Nothing}, g::GlobalRef, wwr::WorldWithRange)
3612+
function scan_specified_partitions(query::F1, walk_binding_partition::F2,
3613+
interp::Union{AbstractInterpreter,Nothing}, g::GlobalRef, wwr::WorldWithRange) where {F1,F2}
36133614
local total_validity, rte, binding_partition
36143615
binding = convert(Core.Binding, g)
36153616
lookup_world = max_world(wwr.valid_worlds)
@@ -3642,12 +3643,12 @@ function scan_specified_partitions(query::Function, walk_binding_partition::Func
36423643
return Pair{WorldRange, typeof(rte)}(total_validity, rte)
36433644
end
36443645

3645-
scan_leaf_partitions(query::Function, ::Nothing, g::GlobalRef, wwr::WorldWithRange) =
3646+
scan_leaf_partitions(query::F, ::Nothing, g::GlobalRef, wwr::WorldWithRange) where F =
36463647
scan_specified_partitions(query, walk_binding_partition, nothing, g, wwr)
3647-
scan_leaf_partitions(query::Function, interp::AbstractInterpreter, g::GlobalRef, wwr::WorldWithRange) =
3648+
scan_leaf_partitions(query::F, interp::AbstractInterpreter, g::GlobalRef, wwr::WorldWithRange) where F =
36483649
scan_specified_partitions(query, walk_binding_partition, interp, g, wwr)
36493650

3650-
function scan_partitions(query::Function, interp::AbstractInterpreter, g::GlobalRef, wwr::WorldWithRange)
3651+
function scan_partitions(query::F, interp::AbstractInterpreter, g::GlobalRef, wwr::WorldWithRange) where F
36513652
walk_binding_partition = function (b::Core.Binding, partition::Core.BindingPartition, world::UInt)
36523653
Pair{WorldRange, Pair{Core.Binding, Core.BindingPartition}}(
36533654
WorldRange(partition.min_world, partition.max_world), b=>partition)

0 commit comments

Comments
 (0)