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 when using Union{Something, Missing} as type parameter #29950

Closed
meggart opened this issue Nov 7, 2018 · 3 comments
Closed

Bug when using Union{Something, Missing} as type parameter #29950

meggart opened this issue Nov 7, 2018 · 3 comments

Comments

@meggart
Copy link
Contributor

meggart commented Nov 7, 2018

The following behavior seems to be a bug:

    struct S{T1, T2, T3}
    tair::T1
    country::T2
    lon::T3
end
s = S{Union{Float32,Missing},Union{Int32,Missing},Float64}(1.0,1,1.0)
s

returns:

S{Union{Missing, Float32},Union{Missing, Int32},Float64}(1.0f0, missing, 1.0)

and this even segfaults when accessing the second field:

using Dates
struct S2{T1, T2, T3,T4,T5}
                  tair::T1
                  country::T2
                  lon::T3
                  lat::T4
                  time::T5
end
s = S2{Union{Float32,Missing},Union{Int32,Missing},Float64,Float64,Date}(1.0,1,1.0,1.0,Date(2000))
s.country

I tried this on 0.7 as well as on JuliaBox 1.0. Is there a way to avoid this?

Versioninfo:

Julia Version 1.0.0
Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, broadwell)
Environment:
  JULIABOX = true
  JULIA_PKG_SERVER = https://pkg.juliacomputing.com
  JULIA = /opt/julia-0.6/bin/julia
  JULIA_KERNELS = ['julia-0.5', 'julia-0.6', 'julia-1.0']
  JULIABOX_ROLE = 
@tomaklutfu
Copy link
Contributor

Is it solved by PR #29722 ?

@meggart
Copy link
Contributor Author

meggart commented Nov 7, 2018

Yes, this works on nightly, sorry for the noise

@meggart meggart closed this as completed Nov 7, 2018
@StefanKarpinski
Copy link
Member

No worries, thanks for reporting!

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