Skip to content

Commit

Permalink
fix regression in methods lookup
Browse files Browse the repository at this point in the history
Certain queries were searching for Type{T} instead of T due to a
mistaken tparam setting, resulting in missing methods in lookup.

Fix #49408
Ref #48925
  • Loading branch information
vtjnash committed Apr 19, 2023
1 parent b664693 commit 68bbfd7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/typemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static int jl_typemap_intersection_array_visitor(jl_array_t *a, jl_value_t *ty,
if (tydt == jl_any_type || // easy case: Any always matches
tname_intersection(tydt, (jl_typename_t*)t, height)) {
if (jl_is_array(ml)) {
if (!jl_typemap_intersection_array_visitor((jl_array_t*)ml, ty, 1, offs, closure))
if (!jl_typemap_intersection_array_visitor((jl_array_t*)ml, ty, tparam & ~2, offs, closure))
goto exit;
}
else {
Expand Down
4 changes: 4 additions & 0 deletions test/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,10 @@ ambig_effects_test(a, b) = 1
end

@test Base._methods_by_ftype(Tuple{}, -1, Base.get_world_counter()) == Any[]
@test length(methods(Base.Broadcast.broadcasted, Tuple{Any, Any, Vararg})) >
length(methods(Base.Broadcast.broadcasted, Tuple{Base.Broadcast.BroadcastStyle, Any, Vararg})) >=
length(methods(Base.Broadcast.broadcasted, Tuple{Base.Broadcast.DefaultArrayStyle{1}, Any, Vararg})) >=
10

@testset "specializations" begin
f(x) = 1
Expand Down

0 comments on commit 68bbfd7

Please sign in to comment.