Skip to content

Commit

Permalink
fix exct for mismatched opaque closure call
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Sep 3, 2024
1 parent 04d6d5f commit bfeaa27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2339,7 +2339,7 @@ function abstract_call_opaque_closure(interp::AbstractInterpreter,
ocargsig′ = unwrap_unionall(ocargsig)
ocargsig′ isa DataType || return CallMeta(Any, Any, Effects(), NoCallInfo())
ocsig = rewrap_unionall(Tuple{Tuple, ocargsig′.parameters...}, ocargsig)
hasintersect(sig, ocsig) || return CallMeta(Union{}, TypeError, EFFECTS_THROWS, NoCallInfo())
hasintersect(sig, ocsig) || return CallMeta(Union{}, Union{MethodError,TypeError}, EFFECTS_THROWS, NoCallInfo())
ocmethod = closure.source::Method
result = abstract_call_method(interp, ocmethod, sig, Core.svec(), false, si, sv)
(; rt, edge, effects, volatile_inf_result) = result
Expand Down
8 changes: 8 additions & 0 deletions test/compiler/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6089,3 +6089,11 @@ end == Union{}
f = issue55627_make_oc()
return f(1), f(xs...)
end == Tuple{Int,Int}
@test Base.infer_exception_type() do
f = issue55627_make_oc()
return f(1), f()
end >: MethodError
@test Base.infer_exception_type() do
f = issue55627_make_oc()
return f(1), f('1')
end >: TypeError

0 comments on commit bfeaa27

Please sign in to comment.