<p dir="auto">The following crashes in 0.7 and 1.0. I cannot reproduce this without parametric types or without at least two Unions in the struct.</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="struct Test{T}
    A::Array{Union{Missing, T},1}
    x::Union{Nothing, Int}
end

Base.map(f, t::Test) = Test(map(f, t.A), 1)

t = Test([missing, 1], 1)

Test(map(x-&gt;x, t.A), 1)  # works
map(x-&gt;x, t)  # crash"><pre class="notranslate"><span class="pl-k">struct</span> Test{T}
    A<span class="pl-k">::</span><span class="pl-c1">Array{Union{Missing, T},1}</span>
    x<span class="pl-k">::</span><span class="pl-c1">Union{Nothing, Int}</span>
<span class="pl-k">end</span>

Base<span class="pl-k">.</span><span class="pl-en">map</span>(f, t<span class="pl-k">::</span><span class="pl-c1">Test</span>) <span class="pl-k">=</span> <span class="pl-c1">Test</span>(<span class="pl-c1">map</span>(f, t<span class="pl-k">.</span>A), <span class="pl-c1">1</span>)

t <span class="pl-k">=</span> <span class="pl-c1">Test</span>([<span class="pl-c1">missing</span>, <span class="pl-c1">1</span>], <span class="pl-c1">1</span>)

<span class="pl-c1">Test</span>(<span class="pl-c1">map</span>(x<span class="pl-k">-&gt;</span>x, t<span class="pl-k">.</span>A), <span class="pl-c1">1</span>)  <span class="pl-c"><span class="pl-c">#</span> works</span>
<span class="pl-c1">map</span>(x<span class="pl-k">-&gt;</span>x, t)  <span class="pl-c"><span class="pl-c">#</span> crash</span></pre></div>
<p dir="auto">Versioninfo:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="versioninfo()
Julia Version 1.0.0
Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, haswell)"><pre class="notranslate"><span class="pl-c1">versioninfo</span>()
Julia Version <span class="pl-c1">1.0</span>.<span class="pl-c1">0</span>
Commit <span class="pl-c1">5</span>d4eaca0c9 (<span class="pl-c1">2018</span><span class="pl-k">-</span><span class="pl-c1">08</span><span class="pl-k">-</span><span class="pl-c1">08</span> <span class="pl-c1">20</span><span class="pl-k">:</span><span class="pl-c1">58</span> UTC)
Platform Info<span class="pl-k">:</span>
  OS<span class="pl-k">:</span> macOS (x86_64<span class="pl-k">-</span>apple<span class="pl-k">-</span>darwin14.<span class="pl-c1">5.0</span>)
  CPU<span class="pl-k">:</span> <span class="pl-c1">Intel</span>(R) <span class="pl-c1">Core</span>(TM) i7<span class="pl-k">-</span><span class="pl-c1">4870</span>HQ CPU @ <span class="pl-c1">2.50</span>GHz
  WORD_SIZE<span class="pl-k">:</span> <span class="pl-c1">64</span>
  LIBM<span class="pl-k">:</span> libopenlibm
  LLVM<span class="pl-k">:</span> libLLVM<span class="pl-k">-</span><span class="pl-c1">6.0</span>.<span class="pl-c1">0</span> (ORCJIT, haswell)</pre></div>
<p dir="auto">The crash message:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Unreachable reached at 0x11ad423a4

signal (4): Illegal instruction: 4
in expression starting at /Users/epta/.julia/v0.7/GeoRaster/crash.jl:12
map at /Users/epta/.julia/v0.7/GeoRaster/crash.jl:7
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1829
do_call at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:324
eval_stmt_value at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:363 [inlined]
eval_body at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:686
jl_interpret_toplevel_thunk_callback at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:799
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x11492a85f)
unknown function (ip: 0x6)
jl_interpret_toplevel_thunk at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:808
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:831
jl_parse_eval_all at /Users/osx/buildbot/slave/package_osx64/build/src/ast.c:841
jl_load at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:865 [inlined]
jl_load_ at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:872
include at ./boot.jl:317 [inlined]
include_relative at ./loading.jl:1038
include at ./sysimg.jl:29
exec_options at ./client.jl:239
_start at ./client.jl:432
true_main at /Applications/Julia-0.7.app/Contents/Resources/julia/bin/julia (unknown line)
main at /Applications/Julia-0.7.app/Contents/Resources/julia/bin/julia (unknown line)
Allocations: 581374 (Pool: 581270; Big: 104); GC: 0
[1]    18287 illegal hardware instruction  /Applications/Julia-0.7.app/Contents/Resources/julia/bin/julia crash.jl"><pre class="notranslate">Unreachable reached at <span class="pl-c1">0x11ad423a4</span>

signal (<span class="pl-c1">4</span>)<span class="pl-k">:</span> Illegal instruction<span class="pl-k">:</span> <span class="pl-c1">4</span>
in expression starting at <span class="pl-k">/</span>Users<span class="pl-k">/</span>epta<span class="pl-k">/</span><span class="pl-k">.</span>julia<span class="pl-k">/</span>v0.<span class="pl-c1">7</span><span class="pl-k">/</span>GeoRaster<span class="pl-k">/</span>crash<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">12</span>
map at <span class="pl-k">/</span>Users<span class="pl-k">/</span>epta<span class="pl-k">/</span><span class="pl-k">.</span>julia<span class="pl-k">/</span>v0.<span class="pl-c1">7</span><span class="pl-k">/</span>GeoRaster<span class="pl-k">/</span>crash<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">7</span>
jl_fptr_trampoline at <span class="pl-k">/</span>Users<span class="pl-k">/</span>osx<span class="pl-k">/</span>buildbot<span class="pl-k">/</span>slave<span class="pl-k">/</span>package_osx64<span class="pl-k">/</span>build<span class="pl-k">/</span>src<span class="pl-k">/</span>gf<span class="pl-k">.</span>c<span class="pl-k">:</span><span class="pl-c1">1829</span>
do_call at <span class="pl-k">/</span>Users<span class="pl-k">/</span>osx<span class="pl-k">/</span>buildbot<span class="pl-k">/</span>slave<span class="pl-k">/</span>package_osx64<span class="pl-k">/</span>build<span class="pl-k">/</span>src<span class="pl-k">/</span>interpreter<span class="pl-k">.</span>c<span class="pl-k">:</span><span class="pl-c1">324</span>
eval_stmt_value at <span class="pl-k">/</span>Users<span class="pl-k">/</span>osx<span class="pl-k">/</span>buildbot<span class="pl-k">/</span>slave<span class="pl-k">/</span>package_osx64<span class="pl-k">/</span>build<span class="pl-k">/</span>src<span class="pl-k">/</span>interpreter<span class="pl-k">.</span>c<span class="pl-k">:</span><span class="pl-c1">363</span> [inlined]
eval_body at <span class="pl-k">/</span>Users<span class="pl-k">/</span>osx<span class="pl-k">/</span>buildbot<span class="pl-k">/</span>slave<span class="pl-k">/</span>package_osx64<span class="pl-k">/</span>build<span class="pl-k">/</span>src<span class="pl-k">/</span>interpreter<span class="pl-k">.</span>c<span class="pl-k">:</span><span class="pl-c1">686</span>
jl_interpret_toplevel_thunk_callback at <span class="pl-k">/</span>Users<span class="pl-k">/</span>osx<span class="pl-k">/</span>buildbot<span class="pl-k">/</span>slave<span class="pl-k">/</span>package_osx64<span class="pl-k">/</span>build<span class="pl-k">/</span>src<span class="pl-k">/</span>interpreter<span class="pl-k">.</span>c<span class="pl-k">:</span><span class="pl-c1">799</span>
unknown <span class="pl-k">function</span> (ip<span class="pl-k">:</span> <span class="pl-c1">0xfffffffffffffffe</span>)
unknown <span class="pl-k">function</span> (ip<span class="pl-k">:</span> <span class="pl-c1">0x11492a85f</span>)
unknown <span class="pl-k">function</span> (ip<span class="pl-k">:</span> <span class="pl-c1">0x6</span>)
jl_interpret_toplevel_thunk at <span class="pl-k">/</span>Users<span class="pl-k">/</span>osx<span class="pl-k">/</span>buildbot<span class="pl-k">/</span>slave<span class="pl-k">/</span>package_osx64<span class="pl-k">/</span>build<span class="pl-k">/</span>src<span class="pl-k">/</span>interpreter<span class="pl-k">.</span>c<span class="pl-k">:</span><span class="pl-c1">808</span>
jl_toplevel_eval_flex at <span class="pl-k">/</span>Users<span class="pl-k">/</span>osx<span class="pl-k">/</span>buildbot<span class="pl-k">/</span>slave<span class="pl-k">/</span>package_osx64<span class="pl-k">/</span>build<span class="pl-k">/</span>src<span class="pl-k">/</span>toplevel<span class="pl-k">.</span>c<span class="pl-k">:</span><span class="pl-c1">831</span>
jl_parse_eval_all at <span class="pl-k">/</span>Users<span class="pl-k">/</span>osx<span class="pl-k">/</span>buildbot<span class="pl-k">/</span>slave<span class="pl-k">/</span>package_osx64<span class="pl-k">/</span>build<span class="pl-k">/</span>src<span class="pl-k">/</span>ast<span class="pl-k">.</span>c<span class="pl-k">:</span><span class="pl-c1">841</span>
jl_load at <span class="pl-k">/</span>Users<span class="pl-k">/</span>osx<span class="pl-k">/</span>buildbot<span class="pl-k">/</span>slave<span class="pl-k">/</span>package_osx64<span class="pl-k">/</span>build<span class="pl-k">/</span>src<span class="pl-k">/</span>toplevel<span class="pl-k">.</span>c<span class="pl-k">:</span><span class="pl-c1">865</span> [inlined]
jl_load_ at <span class="pl-k">/</span>Users<span class="pl-k">/</span>osx<span class="pl-k">/</span>buildbot<span class="pl-k">/</span>slave<span class="pl-k">/</span>package_osx64<span class="pl-k">/</span>build<span class="pl-k">/</span>src<span class="pl-k">/</span>toplevel<span class="pl-k">.</span>c<span class="pl-k">:</span><span class="pl-c1">872</span>
include at <span class="pl-k">./</span>boot<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">317</span> [inlined]
include_relative at <span class="pl-k">./</span>loading<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">1038</span>
include at <span class="pl-k">./</span>sysimg<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">29</span>
exec_options at <span class="pl-k">./</span>client<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">239</span>
_start at <span class="pl-k">./</span>client<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">432</span>
true_main at <span class="pl-k">/</span>Applications<span class="pl-k">/</span>Julia<span class="pl-k">-</span><span class="pl-c1">0.7</span><span class="pl-k">.</span>app<span class="pl-k">/</span>Contents<span class="pl-k">/</span>Resources<span class="pl-k">/</span>julia<span class="pl-k">/</span>bin<span class="pl-k">/</span>julia (unknown line)
main at <span class="pl-k">/</span>Applications<span class="pl-k">/</span>Julia<span class="pl-k">-</span><span class="pl-c1">0.7</span><span class="pl-k">.</span>app<span class="pl-k">/</span>Contents<span class="pl-k">/</span>Resources<span class="pl-k">/</span>julia<span class="pl-k">/</span>bin<span class="pl-k">/</span>julia (unknown line)
Allocations<span class="pl-k">:</span> <span class="pl-c1">581374</span> (Pool<span class="pl-k">:</span> <span class="pl-c1">581270</span>; Big<span class="pl-k">:</span> <span class="pl-c1">104</span>); GC<span class="pl-k">:</span> <span class="pl-c1">0</span>
[<span class="pl-c1">1</span>]    <span class="pl-c1">18287</span> illegal hardware instruction  <span class="pl-k">/</span>Applications<span class="pl-k">/</span>Julia<span class="pl-k">-</span><span class="pl-c1">0.7</span><span class="pl-k">.</span>app<span class="pl-k">/</span>Contents<span class="pl-k">/</span>Resources<span class="pl-k">/</span>julia<span class="pl-k">/</span>bin<span class="pl-k">/</span>julia crash<span class="pl-k">.</span>jl</pre></div>
<p dir="auto">Code_typed:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="print(@code_typed map(x-&gt;x, t))
CodeInfo(
7 1 ─ %1 = (Base.getfield)(t, :A)::Array{Union{Missing, Int64},1}
  │   %2 = %new(Generator{Array{Union{Missing, Int64},1},##5#6}, ##5#6(), %1)::Generator{Array{Union{Missing, Int64},1},##5#6}
  │   %3 = invoke Base._collect(%1::Array{Union{Missing, Int64},1}, %2::Base.Generator{Array{Union{Missing, Int64},1},getfield(Main, Symbol(&quot;##5#6&quot;))}, $(QuoteNode(Base.EltypeUnknown()))::Base.EltypeUnknown, $(QuoteNode(Base.HasShape{1}()))::Base.HasShape{1})::Array
  │        (Main.Test)(%3, 1)::Union{}
  │        $(Expr(:unreachable))::Union{}
  └──      $(Expr(:unreachable))::Union{}
) =&gt; Union{}%"><pre class="notranslate"><span class="pl-c1">print</span>(<span class="pl-c1">@code_typed</span> <span class="pl-c1">map</span>(x<span class="pl-k">-&gt;</span>x, t))
<span class="pl-c1">CodeInfo</span>(
<span class="pl-c1">7</span> <span class="pl-c1">1</span> ─ <span class="pl-k">%</span><span class="pl-c1">1</span> <span class="pl-k">=</span> (Base<span class="pl-k">.</span>getfield)(t, <span class="pl-c1">:A</span>)<span class="pl-k">::</span><span class="pl-c1">Array{Union{Missing, Int64},1}</span>
  │   <span class="pl-k">%</span><span class="pl-c1">2</span> <span class="pl-k">=</span> <span class="pl-k">%</span><span class="pl-c1">new</span>(Generator{Array{Union{Missing, Int64},<span class="pl-c1">1</span>},<span class="pl-c"><span class="pl-c">#</span>#5#6}, ##5#6(), %1)::Generator{Array{Union{Missing, Int64},1},##5#6}</span>
  │   <span class="pl-k">%</span><span class="pl-c1">3</span> <span class="pl-k">=</span> invoke Base<span class="pl-k">.</span><span class="pl-c1">_collect</span>(<span class="pl-k">%</span><span class="pl-c1">1</span><span class="pl-k">::</span><span class="pl-c1">Array{Union{Missing, Int64},1}</span>, <span class="pl-k">%</span><span class="pl-c1">2</span><span class="pl-k">::</span><span class="pl-c1">Base.Generator{Array{Union{Missing, Int64},1},getfield(Main, Symbol("##5#6"))}</span>, <span class="pl-k">$</span>(<span class="pl-c1">QuoteNode</span>(Base<span class="pl-k">.</span><span class="pl-c1">EltypeUnknown</span>()))<span class="pl-k">::</span><span class="pl-c1">Base.EltypeUnknown</span>, <span class="pl-k">$</span>(<span class="pl-c1">QuoteNode</span>(Base<span class="pl-k">.</span><span class="pl-c1">HasShape</span><span class="pl-c1">{1}</span>()))<span class="pl-k">::</span><span class="pl-c1">Base.HasShape{1}</span>)<span class="pl-k">::</span><span class="pl-c1">Array</span>
  │        (Main<span class="pl-k">.</span>Test)(<span class="pl-k">%</span><span class="pl-c1">3</span>, <span class="pl-c1">1</span>)<span class="pl-k">::</span><span class="pl-c1">Union{}</span>
  │        <span class="pl-k">$</span>(<span class="pl-c1">Expr</span>(<span class="pl-c1">:unreachable</span>))<span class="pl-k">::</span><span class="pl-c1">Union{}</span>
  └──      <span class="pl-k">$</span>(<span class="pl-c1">Expr</span>(<span class="pl-c1">:unreachable</span>))<span class="pl-k">::</span><span class="pl-c1">Union{}</span>
) <span class="pl-k">=&gt;</span> Union{}<span class="pl-k">%</span></pre></div>
<p dir="auto">Difficult to tell if this is a duplicate of some existing subtyping issue, but it's important:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="julia&gt; typeintersect(Base.RefValue, Ref{Union{Int,T}} where T)
Union{}"><pre class="notranslate"><code class="notranslate">julia&gt; typeintersect(Base.RefValue, Ref{Union{Int,T}} where T)
Union{}
</code></pre></div>
<p dir="auto">The answer should be (ideally) <code class="notranslate">RefValue{Union{Int,T}} where T</code>.</p>