Skip to content

Commit ca50706

Browse files
authored
fix regression in methods lookup (#49416)
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
1 parent bb118c9 commit ca50706

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/typemap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static int jl_typemap_intersection_array_visitor(jl_array_t *a, jl_value_t *ty,
425425
if (tydt == jl_any_type || // easy case: Any always matches
426426
tname_intersection(tydt, (jl_typename_t*)t, height)) {
427427
if (jl_is_array(ml)) {
428-
if (!jl_typemap_intersection_array_visitor((jl_array_t*)ml, ty, 1, offs, closure))
428+
if (!jl_typemap_intersection_array_visitor((jl_array_t*)ml, ty, tparam & ~2, offs, closure))
429429
goto exit;
430430
}
431431
else {

test/reflection.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,10 @@ ambig_effects_test(a, b) = 1
10381038
end
10391039

10401040
@test Base._methods_by_ftype(Tuple{}, -1, Base.get_world_counter()) == Any[]
1041+
@test length(methods(Base.Broadcast.broadcasted, Tuple{Any, Any, Vararg})) >
1042+
length(methods(Base.Broadcast.broadcasted, Tuple{Base.Broadcast.BroadcastStyle, Any, Vararg})) >=
1043+
length(methods(Base.Broadcast.broadcasted, Tuple{Base.Broadcast.DefaultArrayStyle{1}, Any, Vararg})) >=
1044+
10
10411045

10421046
@testset "specializations" begin
10431047
f(x) = 1

0 commit comments

Comments
 (0)