Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect method lookup for Union{} type dispatch #55187

Closed
vtjnash opened this issue Jul 20, 2024 · 0 comments · Fixed by #55188
Closed

incorrect method lookup for Union{} type dispatch #55187

vtjnash opened this issue Jul 20, 2024 · 0 comments · Fixed by #55188
Labels
correctness bug ⚠ Bugs that are likely to lead to incorrect results in user code without throwing types and dispatch Types, subtyping and method dispatch

Comments

@vtjnash
Copy link
Member

vtjnash commented Jul 20, 2024

julia> Base._methods_by_ftype(Tuple{Core.TypeofBottom, Vararg}, 5, Base.get_world_counter())
Any[]

julia> Type{Core.Union{}} == Core.TypeofBottom
true

julia> Base._methods_by_ftype(Tuple{Type{Core.Union{}}, Int}, 5, Base.get_world_counter())
1-element Vector{Any}:
 Core.MethodMatch(Tuple{Type{Union{}}, Int64}, svec(), Union{}(a...) @ Core boot.jl:321, true)

The Core.TypeofBottom probably often gets normalized to Type{Core.Union{}} so this doesn't get observed often, but I was noticing it leading to incorrect method invalidations during reloading.

@vtjnash vtjnash added types and dispatch Types, subtyping and method dispatch correctness bug ⚠ Bugs that are likely to lead to incorrect results in user code without throwing labels Jul 20, 2024
vtjnash added a commit that referenced this issue Jul 20, 2024
Ensures that adding or examining the methods of Type{Union{}} in the
method table returns the correct results.

Fixes #55187
vtjnash added a commit that referenced this issue Jul 22, 2024
Ensures that adding or examining the methods of Type{Union{}} in the
method table returns the correct results.

Fixes #55187
KristofferC pushed a commit that referenced this issue Jul 23, 2024
Ensures that adding or examining the methods of Type{Union{}} in the
method table returns the correct results.

Fixes #55187

(cherry picked from commit d68befd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
correctness bug ⚠ Bugs that are likely to lead to incorrect results in user code without throwing types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant