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

convert to UnionAll types #41717

Open
goretkin opened this issue Jul 27, 2021 · 0 comments
Open

convert to UnionAll types #41717

goretkin opened this issue Jul 27, 2021 · 0 comments

Comments

@goretkin
Copy link
Contributor

I expected

julia> convert(Vector{T} where T <: AbstractFloat, [1, 2])
ERROR: MethodError: no method matching (Vector{A} where A<:AbstractFloat)(::Vector{Int64})

to work, computing e.g. convert.(AbstractFloat, [1, 2])

On zulip another case was brought up

julia> convert(Complex{AbstractFloat}, 1+im)
1.0 + 1.0im

julia> convert(Complex{T} where T <: AbstractFloat, 1+im)
ERROR: MethodError: no method matching (Complex{T} where T<:AbstractFloat)(::Complex{Int64})

I understand that it is tricky to support UnionAll, but the need arises in my own packages and it would be nice to fall back on some examples in Base.

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

1 participant