Skip to content

Commit d97dd8e

Browse files
authored
handle empty Tuple{} in _methods_by_ftype (#46685)
This is silly, but some packages try very hard to precompile everything including this, even though this is invalid. Fix #46295
1 parent 70bfa3f commit d97dd8e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/gf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2004,7 +2004,7 @@ JL_DLLEXPORT jl_value_t *jl_matching_methods(jl_tupletype_t *types, jl_value_t *
20042004
if (ambig != NULL)
20052005
*ambig = 0;
20062006
jl_value_t *unw = jl_unwrap_unionall((jl_value_t*)types);
2007-
if (jl_is_tuple_type(unw) && jl_tparam0(unw) == jl_bottom_type)
2007+
if (jl_is_tuple_type(unw) && (unw == (jl_value_t*)jl_emptytuple_type || jl_tparam0(unw) == jl_bottom_type))
20082008
return (jl_value_t*)jl_an_empty_vec_any;
20092009
if (mt == jl_nothing)
20102010
mt = (jl_value_t*)jl_method_table_for(unw);

test/reflection.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,3 +1010,5 @@ ambig_effects_test(a, b) = 1
10101010
@test (Base.infer_effects(setfield!, ()); true) # `builtin_effects` shouldn't throw on empty `argtypes`
10111011
@test (Base.infer_effects(Core.Intrinsics.arraylen, ()); true) # `intrinsic_effects` shouldn't throw on empty `argtypes`
10121012
end
1013+
1014+
@test Base._methods_by_ftype(Tuple{}, -1, Base.get_world_counter()) == Any[]

0 commit comments

Comments
 (0)