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

Operations on Array{Union{T,Missing},N} return Array{Any,N} #74

Open
tbeason opened this issue Jan 19, 2018 · 4 comments
Open

Operations on Array{Union{T,Missing},N} return Array{Any,N} #74

tbeason opened this issue Jan 19, 2018 · 4 comments

Comments

@tbeason
Copy link

tbeason commented Jan 19, 2018

Example is pretty self explanatory I think. Output of @code_warntype says something isn't being inferred correctly.

julia> a=[1,missing,2]
3-element Array{Union{Int64, Missings.Missing},1}:
 1
  missing
 2

julia> a+2
3-element Array{Any,1}:
 3
  missing
 4

julia> a=[1 missing 2; 3 4 missing]
2×3 Array{Union{Int64, Missings.Missing},2}:
 1   missing  2
 3  4          missing

julia> a+2
2×3 Array{Any,2}:
 3   missing  4
 5  6          missing

I'm Julia 0.6.2 and Missings 0.2.4.

@ararslan
Copy link
Member

ararslan commented Jan 19, 2018

Is it inferred correctly on 0.7? I'm not sure what we can do about inference on 0.6.

@tbeason
Copy link
Author

tbeason commented Jan 19, 2018

Unfortunately, I haven't been able to get 0.7 running at all on my machine. Someone else would have to test

@nalimilan
Copy link
Member

It's not an inference issue, it's due to calling typejoin to choose the element type. JuliaLang/julia#25553 should fix this.

@ararslan
Copy link
Member

Oh, sorry to hear that. If you're having specific troubles I recommend asking on Discourse.

I just checked on 0.7 and it does indeed get inferred as Any there too.

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

3 participants