Skip to content

Commit ea25e2a

Browse files
aviateskKristofferC
authored andcommitted
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. (cherry picked from commit 39d7483)
1 parent f1517b4 commit ea25e2a

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
@@ -3562,7 +3562,8 @@ function abstract_eval_partition_load(interp::Union{AbstractInterpreter,Nothing}
35623562
return RTEffects(rt, exct, effects)
35633563
end
35643564

3565-
function scan_specified_partitions(query::Function, walk_binding_partition::Function, interp::Union{AbstractInterpreter,Nothing}, g::GlobalRef, wwr::WorldWithRange)
3565+
function scan_specified_partitions(query::F1, walk_binding_partition::F2,
3566+
interp::Union{AbstractInterpreter,Nothing}, g::GlobalRef, wwr::WorldWithRange) where {F1,F2}
35663567
local total_validity, rte, binding_partition
35673568
binding = convert(Core.Binding, g)
35683569
lookup_world = max_world(wwr.valid_worlds)
@@ -3595,12 +3596,12 @@ function scan_specified_partitions(query::Function, walk_binding_partition::Func
35953596
return Pair{WorldRange, typeof(rte)}(total_validity, rte)
35963597
end
35973598

3598-
scan_leaf_partitions(query::Function, ::Nothing, g::GlobalRef, wwr::WorldWithRange) =
3599+
scan_leaf_partitions(query::F, ::Nothing, g::GlobalRef, wwr::WorldWithRange) where F =
35993600
scan_specified_partitions(query, walk_binding_partition, nothing, g, wwr)
3600-
scan_leaf_partitions(query::Function, interp::AbstractInterpreter, g::GlobalRef, wwr::WorldWithRange) =
3601+
scan_leaf_partitions(query::F, interp::AbstractInterpreter, g::GlobalRef, wwr::WorldWithRange) where F =
36013602
scan_specified_partitions(query, walk_binding_partition, interp, g, wwr)
36023603

3603-
function scan_partitions(query::Function, interp::AbstractInterpreter, g::GlobalRef, wwr::WorldWithRange)
3604+
function scan_partitions(query::F, interp::AbstractInterpreter, g::GlobalRef, wwr::WorldWithRange) where F
36043605
walk_binding_partition = function (b::Core.Binding, partition::Core.BindingPartition, world::UInt)
36053606
Pair{WorldRange, Pair{Core.Binding, Core.BindingPartition}}(
36063607
WorldRange(partition.min_world, partition.max_world), b=>partition)

0 commit comments

Comments
 (0)