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

Bug in dispatching on a union containing a UnionAll type #37793

Closed
MasonProtter opened this issue Sep 29, 2020 · 2 comments
Closed

Bug in dispatching on a union containing a UnionAll type #37793

MasonProtter opened this issue Sep 29, 2020 · 2 comments

Comments

@MasonProtter
Copy link
Contributor

MasonProtter commented Sep 29, 2020

MWE:

julia> g(::Ref{Union{Int, Other}}) where {Other} = Other
g (generic function with 1 method)

julia> g(Ref{Union{Int, Float64}}(1))
Float64

julia> g(Ref{Union{Int, Array}}(1))
ERROR: MethodError: no method matching g(::Base.RefValue{Union{Int64, Array}})
Closest candidates are:
  g(::Ref{Union{Int64, Other}}) where Other at REPL[3]:1
Stacktrace:
 [1] top-level scope at REPL[5]:1

julia> versioninfo()
Julia Version 1.5.2
Commit 539f3ce943* (2020-09-23 23:17 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 5 2600 Six-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, znver1)
Environment:
  JULIA_NUM_THREADS = 6

Seems like a bug with UnionAll to me.

Originally posted by @MasonProtter in #37790 (comment)

@MasonProtter
Copy link
Contributor Author

In #37790 (comment), @vtjnash says that it's desirable to make it so that concrete types behave like UnionAll types here rather than the other way around. To me, this sounds bad, but can you explain a bit about why?

@JeffBezanson
Copy link
Member

Duplicate of #26135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants