<p dir="auto">This is possibly a method dispatch error, where it computes that <code class="notranslate">TypeVar(:N,Any) === 1</code></p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; begin
         f{t,n}(::Type{Array{t}}, ::Array{t,n}) = (t,n,1)
         f{t,n}(::Type{Array{t,n}}, ::Array{t,n}) = (t,n,2)
       end
julia&gt; methods(f)
#2 methods for generic function &quot;f&quot;:
f{t,n}(::Type{Array{t,n}},::Array{t,n}) at none:3
f{t,n}(::Type{Array{t,N}},::Array{t,n}) at none:2

julia&gt; f(Array{Int,1}, [1,2,3])
(Int32,1,2)

julia&gt; f(Array{Int}, [1,2,3])
(Int32,1,2)  # I was expecting (Int32,1,1) !"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-k">begin</span>
         <span class="pl-en">f</span><span class="pl-c1">{t,n}</span>(<span class="pl-k">::</span><span class="pl-c1">Type{Array{t}}</span>, <span class="pl-k">::</span><span class="pl-c1">Array{t,n}</span>) <span class="pl-k">=</span> (t,n,<span class="pl-c1">1</span>)
         <span class="pl-en">f</span><span class="pl-c1">{t,n}</span>(<span class="pl-k">::</span><span class="pl-c1">Type{Array{t,n}}</span>, <span class="pl-k">::</span><span class="pl-c1">Array{t,n}</span>) <span class="pl-k">=</span> (t,n,<span class="pl-c1">2</span>)
       <span class="pl-k">end</span>
julia<span class="pl-k">&gt;</span> <span class="pl-c1">methods</span>(f)
<span class="pl-c"><span class="pl-c">#</span>2 methods for generic function "f":</span>
<span class="pl-c1">f</span><span class="pl-c1">{t,n}</span>(<span class="pl-k">::</span><span class="pl-c1">Type{Array{t,n}}</span>,<span class="pl-k">::</span><span class="pl-c1">Array{t,n}</span>) at none<span class="pl-k">:</span><span class="pl-c1">3</span>
<span class="pl-c1">f</span><span class="pl-c1">{t,n}</span>(<span class="pl-k">::</span><span class="pl-c1">Type{Array{t,N}}</span>,<span class="pl-k">::</span><span class="pl-c1">Array{t,n}</span>) at none<span class="pl-k">:</span><span class="pl-c1">2</span>

julia<span class="pl-k">&gt;</span> <span class="pl-c1">f</span>(Array{Int,<span class="pl-c1">1</span>}, [<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>])
(Int32,<span class="pl-c1">1</span>,<span class="pl-c1">2</span>)

julia<span class="pl-k">&gt;</span> <span class="pl-c1">f</span>(Array{Int}, [<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>])
(Int32,<span class="pl-c1">1</span>,<span class="pl-c1">2</span>)  <span class="pl-c"><span class="pl-c">#</span> I was expecting (Int32,1,1) !</span></pre></div>
<p dir="auto"><a href="https://groups.google.com/d/msg/julia-users/FkwQ7Uo8lmg/oV6EXSCgV1AJ" rel="nofollow">https://groups.google.com/d/msg/julia-users/FkwQ7Uo8lmg/oV6EXSCgV1AJ</a></p>
<p dir="auto">unlike DataTypes, the Array type template is incomplete, which leads to unexpected dispatch:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="julia&gt; z{T&lt;:Base.BLAS.BlasFloat}(A::StridedMatrix{T}) = T

julia&gt; let
                  dim=2
                  S=zeros(Complex,dim,dim)
                  @show typeof(S)
                  z(S)
              end
typeof(S) =&gt; Array{Complex{T&lt;:Real},2}
Union(Complex{Float64},Complex{Float32})"><pre class="notranslate"><code class="notranslate">julia&gt; z{T&lt;:Base.BLAS.BlasFloat}(A::StridedMatrix{T}) = T

julia&gt; let
                  dim=2
                  S=zeros(Complex,dim,dim)
                  @show typeof(S)
                  z(S)
              end
typeof(S) =&gt; Array{Complex{T&lt;:Real},2}
Union(Complex{Float64},Complex{Float32})
</code></pre></div>
<p dir="auto">(code from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="22587024" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/4796" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/4796/hovercard" href="https://github.com/JuliaLang/julia/issues/4796">#4796</a>)</p>
<p dir="auto">note that we can obtain a similar failure from BitsTypes:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="julia&gt; bitstype 64 A{T} &lt;: Real

julia&gt; reinterpret(A{Int}, 1)
A{Int64}(0x0000000000000001)

julia&gt; reinterpret(A{Real}, 1)
A{Real}(0x0000000000000001)

julia&gt; reinterpret(A, 1)
Segmentation fault (core dumped)"><pre class="notranslate"><code class="notranslate">julia&gt; bitstype 64 A{T} &lt;: Real

julia&gt; reinterpret(A{Int}, 1)
A{Int64}(0x0000000000000001)

julia&gt; reinterpret(A{Real}, 1)
A{Real}(0x0000000000000001)

julia&gt; reinterpret(A, 1)
Segmentation fault (core dumped)
</code></pre></div>