Skip to content

Commit 2d4ac2d

Browse files
committed
inference: move magic parameter value to the inference params block
1 parent 658a73b commit 2d4ac2d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

base/inference.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ struct InferenceParams
1515
inlining::Bool
1616

1717
# parameters limiting potentially-infinite types (configurable)
18+
MAX_METHODS::Int
1819
MAX_TUPLETYPE_LEN::Int
1920
MAX_TUPLE_DEPTH::Int
2021
MAX_TUPLE_SPLAT::Int
@@ -24,12 +25,13 @@ struct InferenceParams
2425
# reasonable defaults
2526
function InferenceParams(world::UInt;
2627
inlining::Bool = inlining_enabled(),
28+
max_methods::Int = 4,
2729
tupletype_len::Int = 15,
2830
tuple_depth::Int = 4,
2931
tuple_splat::Int = 16,
3032
union_splitting::Int = 4,
3133
apply_union_enum::Int = 8)
32-
return new(world, inlining, tupletype_len,
34+
return new(world, inlining, max_methods, tupletype_len,
3335
tuple_depth, tuple_splat, union_splitting, apply_union_enum)
3436
end
3537
end
@@ -1280,7 +1282,7 @@ function abstract_call_gf_by_type(f::ANY, atype::ANY, sv::InferenceState)
12801282
end
12811283
min_valid = UInt[typemin(UInt)]
12821284
max_valid = UInt[typemax(UInt)]
1283-
applicable = _methods_by_ftype(argtype, 4, sv.params.world, min_valid, max_valid)
1285+
applicable = _methods_by_ftype(argtype, sv.params.MAX_METHODS, sv.params.world, min_valid, max_valid)
12841286
rettype = Bottom
12851287
if applicable === false
12861288
# this means too many methods matched

0 commit comments

Comments
 (0)