Skip to content

Commit 7eecb73

Browse files
authored
Small bug fix: Put back check for malformed invoke (#36772)
This was accidentally lost in #36743 while I was shuffling aroudn what these methods actually return. However, we also didn't have a test to catch that, so this adds such a test as well.
1 parent b3e9ac6 commit 7eecb73

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/gf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2348,6 +2348,8 @@ JL_DLLEXPORT jl_value_t *jl_gf_invoke_lookup(jl_value_t *types, size_t world)
23482348
JL_DLLEXPORT jl_value_t *jl_gf_invoke_lookup_worlds(jl_value_t *types, size_t world, size_t *min_world, size_t *max_world)
23492349
{
23502350
jl_method_match_t *matc = _gf_invoke_lookup(types, world, min_world, max_world);
2351+
if (matc == NULL)
2352+
return jl_nothing;
23512353
return (jl_value_t*)matc->method;
23522354
}
23532355

test/core.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7266,3 +7266,7 @@ struct X36104; x::Int; end
72667266
@test fieldtypes(X36104) == (Int,)
72677267
primitive type P36104 8 end
72687268
@test_throws ErrorException("invalid redefinition of constant P36104") @eval(primitive type P36104 16 end)
7269+
7270+
# Malformed invoke
7271+
f_bad_invoke(x::Int) = invoke(x, (Any,), x)
7272+
@test_throws TypeError f_bad_invoke(1)

0 commit comments

Comments
 (0)