<p dir="auto">Per <a href="https://stackoverflow.com/questions/37107133/how-to-show-all-output-in-julia" rel="nofollow">this</a>, there is currently no way to use the pretty printing <code class="notranslate">display</code> to show all the output. As this is a fairly common usecase, adding it is a low-hanging fruit.</p>
<p dir="auto">I see the following type instability in current Julia v1.4 and master (commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/JuliaLang/julia/commit/cebd4fa959b6f9835a3abe70e705136b5e914e4a/hovercard" href="https://github.com/JuliaLang/julia/commit/cebd4fa959b6f9835a3abe70e705136b5e914e4a"><tt>cebd4fa</tt></a>).</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; using StaticArrays
[ Info: Precompiling StaticArrays [90137ffa-7385-5640-81b9-e52037218182]

julia&gt; struct Foo{N} end

julia&gt; foo = Foo{4}()
Foo{4}()

julia&gt; bar(::Foo{N}) where N = N
bar (generic function with 1 method)

julia&gt; function baz1(foo)
           MVector{bar(foo), Float64}(undef)
       end
baz1 (generic function with 1 method)

julia&gt; @code_warntype baz1(foo)
Variables
  #self#::Core.Compiler.Const(baz1, false)
  foo::Core.Compiler.Const(Foo{4}(), false)

Body::MArray{Tuple{4},Float64,1,4}
1 ─ %1 = Main.bar(foo)::Core.Compiler.Const(4, false)
│   %2 = Core.apply_type(Main.MVector, %1, Main.Float64)::Core.Compiler.Const(MArray{Tuple{4},Float64,1,4}, false)
│   %3 = (%2)(Main.undef)::MArray{Tuple{4},Float64,1,4}
└──      return %3

julia&gt; function baz2(foo)
           tmp = MVector{bar(foo), Float64}
           tmp(undef)
       end
baz2 (generic function with 1 method)

julia&gt; @code_warntype baz2(foo)
Variables
  #self#::Core.Compiler.Const(baz2, false)
  foo::Core.Compiler.Const(Foo{4}(), false)
  tmp::Type{MArray{Tuple{4},Float64,1,4}}

Body::MArray{Tuple{4},Float64,1,4}
1 ─ %1 = Main.bar(foo)::Core.Compiler.Const(4, false)
│        (tmp = Core.apply_type(Main.MVector, %1, Main.Float64))
│   %3 = (tmp::Core.Compiler.Const(MArray{Tuple{4},Float64,1,4}, false))(Main.undef)::MArray{Tuple{4},Float64,1,4}
└──      return %3

julia&gt; function baz3(foo)
           tmp = MVector{bar(foo), Float64}
           [tmp(undef) for _ in 1:bar(foo)]
       end
baz3 (generic function with 1 method)

julia&gt; @code_warntype baz3(foo)
Variables
  #self#::Core.Compiler.Const(baz3, false)
  foo::Core.Compiler.Const(Foo{4}(), false)
  #1::var&quot;#1#2&quot;{DataType}
  tmp::Type{MArray{Tuple{4},Float64,1,4}}

Body::Array{_A,1} where _A
1 ─ %1  = Main.bar(foo)::Core.Compiler.Const(4, false)
│         (tmp = Core.apply_type(Main.MVector, %1, Main.Float64))
│   %3  = Main.:(var&quot;#1#2&quot;)::Core.Compiler.Const(var&quot;#1#2&quot;, false)
│   %4  = Core.typeof(tmp::Core.Compiler.Const(MArray{Tuple{4},Float64,1,4}, false))::Core.Compiler.Const(DataType, false)
│   %5  = Core.apply_type(%3, %4)::Core.Compiler.Const(var&quot;#1#2&quot;{DataType}, false)
│         (#1 = %new(%5, tmp::Core.Compiler.Const(MArray{Tuple{4},Float64,1,4}, false)))
│   %7  = #1::Core.Compiler.Const(var&quot;#1#2&quot;{DataType}(MArray{Tuple{4},Float64,1,4}), false)::Core.Compiler.Const(var&quot;#1#2&quot;{DataType}(MArray{Tuple{4},Float64,1,4}), false)
│   %8  = Main.bar(foo)::Core.Compiler.Const(4, false)
│   %9  = (1:%8)::Core.Compiler.Const(1:4, false)
│   %10 = Base.Generator(%7, %9)::Core.Compiler.Const(Base.Generator{UnitRange{Int64},var&quot;#1#2&quot;{DataType}}(var&quot;#1#2&quot;{DataType}(MArray{Tuple{4},Float64,1,4}), 1:4), false)
│   %11 = Base.collect(%10)::Array{_A,1} where _A
└──       return %11"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-k">using</span> StaticArrays
[ Info<span class="pl-k">:</span> Precompiling StaticArrays [<span class="pl-c1">90137</span>ffa<span class="pl-k">-</span><span class="pl-c1">7385</span><span class="pl-k">-</span><span class="pl-c1">5640</span><span class="pl-k">-</span><span class="pl-c1">81</span>b9<span class="pl-k">-</span>e52037218182]

julia<span class="pl-k">&gt;</span> <span class="pl-k">struct</span> Foo{N} <span class="pl-c1">end</span>

julia<span class="pl-k">&gt;</span> foo <span class="pl-k">=</span> <span class="pl-c1">Foo</span><span class="pl-c1">{4}</span>()
<span class="pl-c1">Foo</span><span class="pl-c1">{4}</span>()

julia<span class="pl-k">&gt;</span> <span class="pl-en">bar</span>(<span class="pl-k">::</span><span class="pl-c1">Foo{N}</span>) <span class="pl-k">where</span> N <span class="pl-k">=</span> N
bar (generic <span class="pl-k">function</span> with <span class="pl-c1">1</span> method)

julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">baz1</span>(foo)
           <span class="pl-c1">MVector</span><span class="pl-c1">{bar(foo), Float64}</span>(undef)
       <span class="pl-c1">end</span>
baz1 (generic <span class="pl-k">function</span> with <span class="pl-c1">1</span> method)

julia<span class="pl-k">&gt;</span> <span class="pl-c1">@code_warntype</span> <span class="pl-c1">baz1</span>(foo)
Variables
  <span class="pl-c"><span class="pl-c">#</span>self#::Core.Compiler.Const(baz1, false)</span>
  foo<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">Foo</span><span class="pl-c1">{4}</span>(), <span class="pl-c1">false</span>)

Body<span class="pl-k">::</span><span class="pl-c1">MArray{Tuple{4},Float64,1,4}</span>
<span class="pl-c1">1</span> ─ <span class="pl-k">%</span><span class="pl-c1">1</span> <span class="pl-k">=</span> Main<span class="pl-k">.</span><span class="pl-c1">bar</span>(foo)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">4</span>, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">2</span> <span class="pl-k">=</span> Core<span class="pl-k">.</span><span class="pl-c1">apply_type</span>(Main<span class="pl-k">.</span>MVector, <span class="pl-k">%</span><span class="pl-c1">1</span>, Main<span class="pl-k">.</span>Float64)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(MArray{Tuple{<span class="pl-c1">4</span>},Float64,<span class="pl-c1">1</span>,<span class="pl-c1">4</span>}, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">3</span> <span class="pl-k">=</span> (<span class="pl-k">%</span><span class="pl-c1">2</span>)(Main<span class="pl-k">.</span>undef)<span class="pl-k">::</span><span class="pl-c1">MArray{Tuple{4},Float64,1,4}</span>
└──      <span class="pl-k">return</span> <span class="pl-k">%</span><span class="pl-c1">3</span>

julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">baz2</span>(foo)
           tmp <span class="pl-k">=</span> MVector{<span class="pl-c1">bar</span>(foo), Float64}
           <span class="pl-c1">tmp</span>(undef)
       <span class="pl-c1">end</span>
baz2 (generic <span class="pl-k">function</span> with <span class="pl-c1">1</span> method)

julia<span class="pl-k">&gt;</span> <span class="pl-c1">@code_warntype</span> <span class="pl-c1">baz2</span>(foo)
Variables
  <span class="pl-c"><span class="pl-c">#</span>self#::Core.Compiler.Const(baz2, false)</span>
  foo<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">Foo</span><span class="pl-c1">{4}</span>(), <span class="pl-c1">false</span>)
  tmp<span class="pl-k">::</span><span class="pl-c1">Type{MArray{Tuple{4},Float64,1,4}}</span>

Body<span class="pl-k">::</span><span class="pl-c1">MArray{Tuple{4},Float64,1,4}</span>
<span class="pl-c1">1</span> ─ <span class="pl-k">%</span><span class="pl-c1">1</span> <span class="pl-k">=</span> Main<span class="pl-k">.</span><span class="pl-c1">bar</span>(foo)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">4</span>, <span class="pl-c1">false</span>)
│        (tmp <span class="pl-k">=</span> Core<span class="pl-k">.</span><span class="pl-c1">apply_type</span>(Main<span class="pl-k">.</span>MVector, <span class="pl-k">%</span><span class="pl-c1">1</span>, Main<span class="pl-k">.</span>Float64))
│   <span class="pl-k">%</span><span class="pl-c1">3</span> <span class="pl-k">=</span> (tmp<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(MArray{Tuple{<span class="pl-c1">4</span>},Float64,<span class="pl-c1">1</span>,<span class="pl-c1">4</span>}, <span class="pl-c1">false</span>))(Main<span class="pl-k">.</span>undef)<span class="pl-k">::</span><span class="pl-c1">MArray{Tuple{4},Float64,1,4}</span>
└──      <span class="pl-k">return</span> <span class="pl-k">%</span><span class="pl-c1">3</span>

julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">baz3</span>(foo)
           tmp <span class="pl-k">=</span> MVector{<span class="pl-c1">bar</span>(foo), Float64}
           [<span class="pl-c1">tmp</span>(undef) <span class="pl-k">for</span> _ <span class="pl-k">in</span> <span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">bar</span>(foo)]
       <span class="pl-c1">end</span>
baz3 (generic <span class="pl-k">function</span> with <span class="pl-c1">1</span> method)

julia<span class="pl-k">&gt;</span> <span class="pl-c1">@code_warntype</span> <span class="pl-c1">baz3</span>(foo)
Variables
  <span class="pl-c"><span class="pl-c">#</span>self#::Core.Compiler.Const(baz3, false)</span>
  foo<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">Foo</span><span class="pl-c1">{4}</span>(), <span class="pl-c1">false</span>)
  <span class="pl-c"><span class="pl-c">#</span>1::var"#1#2"{DataType}</span>
  tmp<span class="pl-k">::</span><span class="pl-c1">Type{MArray{Tuple{4},Float64,1,4}}</span>

Body<span class="pl-k">::</span><span class="pl-c1">Array{_A,1}</span> <span class="pl-k">where</span> _A
<span class="pl-c1">1</span> ─ <span class="pl-k">%</span><span class="pl-c1">1</span>  <span class="pl-k">=</span> Main<span class="pl-k">.</span><span class="pl-c1">bar</span>(foo)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">4</span>, <span class="pl-c1">false</span>)
│         (tmp <span class="pl-k">=</span> Core<span class="pl-k">.</span><span class="pl-c1">apply_type</span>(Main<span class="pl-k">.</span>MVector, <span class="pl-k">%</span><span class="pl-c1">1</span>, Main<span class="pl-k">.</span>Float64))
│   <span class="pl-k">%</span><span class="pl-c1">3</span>  <span class="pl-k">=</span> Main.:(<span class="pl-c1">var"#1#2"</span>)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">var"#1#2"</span>, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">4</span>  <span class="pl-k">=</span> Core<span class="pl-k">.</span><span class="pl-c1">typeof</span>(tmp<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(MArray{Tuple{<span class="pl-c1">4</span>},Float64,<span class="pl-c1">1</span>,<span class="pl-c1">4</span>}, <span class="pl-c1">false</span>))<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(DataType, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">5</span>  <span class="pl-k">=</span> Core<span class="pl-k">.</span><span class="pl-c1">apply_type</span>(<span class="pl-k">%</span><span class="pl-c1">3</span>, <span class="pl-k">%</span><span class="pl-c1">4</span>)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">var"#1#2"</span>{DataType}, <span class="pl-c1">false</span>)
│         (<span class="pl-c"><span class="pl-c">#</span>1 = %new(%5, tmp::Core.Compiler.Const(MArray{Tuple{4},Float64,1,4}, false)))</span>
│   <span class="pl-k">%</span><span class="pl-c1">7</span>  <span class="pl-k">=</span> <span class="pl-c"><span class="pl-c">#</span>1::Core.Compiler.Const(var"#1#2"{DataType}(MArray{Tuple{4},Float64,1,4}), false)::Core.Compiler.Const(var"#1#2"{DataType}(MArray{Tuple{4},Float64,1,4}), false)</span>
│   <span class="pl-k">%</span><span class="pl-c1">8</span>  <span class="pl-k">=</span> Main<span class="pl-k">.</span><span class="pl-c1">bar</span>(foo)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">4</span>, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">9</span>  <span class="pl-k">=</span> (<span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-k">%</span><span class="pl-c1">8</span>)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">4</span>, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">10</span> <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">Generator</span>(<span class="pl-k">%</span><span class="pl-c1">7</span>, <span class="pl-k">%</span><span class="pl-c1">9</span>)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(Base<span class="pl-k">.</span><span class="pl-c1">Generator</span><span class="pl-c1">{UnitRange{Int64},var"#1#2"{DataType}}</span>(<span class="pl-c1">var"#1#2"</span>{DataType}(MArray{Tuple{<span class="pl-c1">4</span>},Float64,<span class="pl-c1">1</span>,<span class="pl-c1">4</span>}), <span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">4</span>), <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">11</span> <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">collect</span>(<span class="pl-k">%</span><span class="pl-c1">10</span>)<span class="pl-k">::</span><span class="pl-c1">Array{_A,1}</span> <span class="pl-k">where</span> _A
└──       <span class="pl-k">return</span> <span class="pl-k">%</span><span class="pl-c1">11</span></pre></div>
<p dir="auto"><code class="notranslate">baz1</code> and <code class="notranslate">baz2</code> are just fine but <code class="notranslate">baz3</code> results in a type instability that I didn’t expect. I can fix that by not using the “type alias” <code class="notranslate">tmp = MVector{bar(foo), Float64}</code> or adding <code class="notranslate">tmp</code> in front of the arrays</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; function baz4(foo)
           [MVector{bar(foo), Float64}(undef) for _ in 1:bar(foo)]
       end
baz4 (generic function with 1 method)

julia&gt; @code_warntype baz4(foo)
Variables
  #self#::Core.Compiler.Const(baz4, false)
  foo::Core.Compiler.Const(Foo{4}(), false)
  #3::var&quot;#3#4&quot;{Foo{4}}

Body::Array{MArray{Tuple{4},Float64,1,4},1}
1 ─ %1 = Main.:(var&quot;#3#4&quot;)::Core.Compiler.Const(var&quot;#3#4&quot;, false)
│   %2 = Core.typeof(foo)::Core.Compiler.Const(Foo{4}, false)
│   %3 = Core.apply_type(%1, %2)::Core.Compiler.Const(var&quot;#3#4&quot;{Foo{4}}, false)
│        (#3 = %new(%3, foo))
│   %5 = #3::Core.Compiler.Const(var&quot;#3#4&quot;{Foo{4}}(Foo{4}()), false)
│   %6 = Main.bar(foo)::Core.Compiler.Const(4, false)
│   %7 = (1:%6)::Core.Compiler.Const(1:4, false)
│   %8 = Base.Generator(%5, %7)::Core.Compiler.Const(Base.Generator{UnitRange{Int64},var&quot;#3#4&quot;{Foo{4}}}(var&quot;#3#4&quot;{Foo{4}}(Foo{4}()), 1:4), false)
│   %9 = Base.collect(%8)::Array{MArray{Tuple{4},Float64,1,4},1}
└──      return %9

julia&gt; function baz5(foo)
           tmp = MVector{bar(foo), Float64}
           tmp[tmp(undef) for _ in 1:bar(foo)]
       end
baz5 (generic function with 1 method)

julia&gt; @code_warntype baz5(foo)
Variables
  #self#::Core.Compiler.Const(baz5, false)
  foo::Core.Compiler.Const(Foo{4}(), false)
  tmp::Type{MArray{Tuple{4},Float64,1,4}}
  @_4::Array{MArray{Tuple{4},Float64,1,4},1}
  @_5::Int64
  @_6::Union{Nothing, Tuple{Int64,Int64}}

Body::Array{MArray{Tuple{4},Float64,1,4},1}
1 ─ %1  = Main.bar(foo)::Core.Compiler.Const(4, false)
│         (tmp = Core.apply_type(Main.MVector, %1, Main.Float64))
│         Core.NewvarNode(:(@_4))
│         Core.NewvarNode(:(@_5))
│         Core.NewvarNode(:(@_6))
│   %6  = Main.bar(foo)::Core.Compiler.Const(4, false)
│   %7  = (1:%6)::Core.Compiler.Const(1:4, false)
│   %8  = Base.IteratorSize(%7)::Core.Compiler.Const(Base.HasShape{1}(), false)
│   %9  = (%8 isa Base.SizeUnknown)::Core.Compiler.Const(false, false)
└──       goto #3 if not %9
2 ─       Core.Compiler.Const(:(Core.apply_type(Core.Array, tmp, 1)), false)
│         Core.Compiler.Const(:(@_4 = (%11)(Core.undef, 0)), false)
└──       Core.Compiler.Const(:(goto %15), false)
3 ┄       (@_4 = Base._array_for(tmp::Core.Compiler.Const(MArray{Tuple{4},Float64,1,4}, false), %7, %8))
│   %15 = Base.LinearIndices(@_4)::LinearIndices{1,Tuple{Base.OneTo{Int64}}}
│         (@_5 = Base.first(%15))
│   %17 = %7::Core.Compiler.Const(1:4, false)
│         (@_6 = Base.iterate(%17))
│   %19 = (@_6::Core.Compiler.Const((1, 1), false) === nothing)::Core.Compiler.Const(false, false)
│   %20 = Base.not_int(%19)::Core.Compiler.Const(true, false)
└──       goto #8 if not %20
4 ┄ %22 = @_6::Tuple{Int64,Int64}::Tuple{Int64,Int64}
│         Core.getfield(%22, 1)
│   %24 = Core.getfield(%22, 2)::Int64
│   %25 = (tmp::Core.Compiler.Const(MArray{Tuple{4},Float64,1,4}, false))(Main.undef)::MArray{Tuple{4},Float64,1,4}
│         $(Expr(:inbounds, true))
└──       goto #6 if not %9
5 ─       Core.Compiler.Const(:(Base.push!(@_4, %25)), false)
└──       Core.Compiler.Const(:(goto %31), false)
6 ┄       Base.setindex!(@_4, %25, @_5)
│         $(Expr(:inbounds, :pop))
│         (@_5 = Base.add_int(@_5, 1))
│         (@_6 = Base.iterate(%17, %24))
│   %34 = (@_6 === nothing)::Bool
│   %35 = Base.not_int(%34)::Bool
└──       goto #8 if not %35
7 ─       goto #4
8 ┄       return @_4"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">baz4</span>(foo)
           [<span class="pl-c1">MVector</span><span class="pl-c1">{bar(foo), Float64}</span>(undef) <span class="pl-k">for</span> _ <span class="pl-k">in</span> <span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">bar</span>(foo)]
       <span class="pl-k">end</span>
baz4 (generic <span class="pl-k">function</span> with <span class="pl-c1">1</span> method)

julia<span class="pl-k">&gt;</span> <span class="pl-c1">@code_warntype</span> <span class="pl-c1">baz4</span>(foo)
Variables
  <span class="pl-c"><span class="pl-c">#</span>self#::Core.Compiler.Const(baz4, false)</span>
  foo<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">Foo</span><span class="pl-c1">{4}</span>(), <span class="pl-c1">false</span>)
  <span class="pl-c"><span class="pl-c">#</span>3::var"#3#4"{Foo{4}}</span>

Body<span class="pl-k">::</span><span class="pl-c1">Array{MArray{Tuple{4},Float64,1,4},1}</span>
<span class="pl-c1">1</span> ─ <span class="pl-k">%</span><span class="pl-c1">1</span> <span class="pl-k">=</span> Main.:(<span class="pl-c1">var"#3#4"</span>)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">var"#3#4"</span>, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">2</span> <span class="pl-k">=</span> Core<span class="pl-k">.</span><span class="pl-c1">typeof</span>(foo)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(Foo{<span class="pl-c1">4</span>}, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">3</span> <span class="pl-k">=</span> Core<span class="pl-k">.</span><span class="pl-c1">apply_type</span>(<span class="pl-k">%</span><span class="pl-c1">1</span>, <span class="pl-k">%</span><span class="pl-c1">2</span>)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">var"#3#4"</span>{Foo{<span class="pl-c1">4</span>}}, <span class="pl-c1">false</span>)
│        (<span class="pl-c"><span class="pl-c">#</span>3 = %new(%3, foo))</span>
│   <span class="pl-k">%</span><span class="pl-c1">5</span> <span class="pl-k">=</span> <span class="pl-c"><span class="pl-c">#</span>3::Core.Compiler.Const(var"#3#4"{Foo{4}}(Foo{4}()), false)</span>
│   <span class="pl-k">%</span><span class="pl-c1">6</span> <span class="pl-k">=</span> Main<span class="pl-k">.</span><span class="pl-c1">bar</span>(foo)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">4</span>, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">7</span> <span class="pl-k">=</span> (<span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-k">%</span><span class="pl-c1">6</span>)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">4</span>, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">8</span> <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">Generator</span>(<span class="pl-k">%</span><span class="pl-c1">5</span>, <span class="pl-k">%</span><span class="pl-c1">7</span>)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(Base<span class="pl-k">.</span><span class="pl-c1">Generator</span><span class="pl-c1">{UnitRange{Int64},var"#3#4"{Foo{4}}}</span>(<span class="pl-c1">var"#3#4"</span>{Foo{<span class="pl-c1">4</span>}}(<span class="pl-c1">Foo</span><span class="pl-c1">{4}</span>()), <span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">4</span>), <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">9</span> <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">collect</span>(<span class="pl-k">%</span><span class="pl-c1">8</span>)<span class="pl-k">::</span><span class="pl-c1">Array{MArray{Tuple{4},Float64,1,4},1}</span>
└──      <span class="pl-k">return</span> <span class="pl-k">%</span><span class="pl-c1">9</span>

julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">baz5</span>(foo)
           tmp <span class="pl-k">=</span> MVector{<span class="pl-c1">bar</span>(foo), Float64}
           tmp[<span class="pl-c1">tmp</span>(undef) <span class="pl-k">for</span> _ <span class="pl-k">in</span> <span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">bar</span>(foo)]
       <span class="pl-k">end</span>
baz5 (generic <span class="pl-k">function</span> with <span class="pl-c1">1</span> method)

julia<span class="pl-k">&gt;</span> <span class="pl-c1">@code_warntype</span> <span class="pl-c1">baz5</span>(foo)
Variables
  <span class="pl-c"><span class="pl-c">#</span>self#::Core.Compiler.Const(baz5, false)</span>
  foo<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">Foo</span><span class="pl-c1">{4}</span>(), <span class="pl-c1">false</span>)
  tmp<span class="pl-k">::</span><span class="pl-c1">Type{MArray{Tuple{4},Float64,1,4}}</span>
  <span class="pl-c1">@_4</span><span class="pl-k">::</span><span class="pl-c1">Array{MArray{Tuple{4},Float64,1,4},1}</span>
  <span class="pl-c1">@_5</span><span class="pl-k">::</span><span class="pl-c1">Int64</span>
  <span class="pl-c1">@_6</span><span class="pl-k">::</span><span class="pl-c1">Union{Nothing, Tuple{Int64,Int64}}</span>

Body<span class="pl-k">::</span><span class="pl-c1">Array{MArray{Tuple{4},Float64,1,4},1}</span>
<span class="pl-c1">1</span> ─ <span class="pl-k">%</span><span class="pl-c1">1</span>  <span class="pl-k">=</span> Main<span class="pl-k">.</span><span class="pl-c1">bar</span>(foo)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">4</span>, <span class="pl-c1">false</span>)
│         (tmp <span class="pl-k">=</span> Core<span class="pl-k">.</span><span class="pl-c1">apply_type</span>(Main<span class="pl-k">.</span>MVector, <span class="pl-k">%</span><span class="pl-c1">1</span>, Main<span class="pl-k">.</span>Float64))
│         Core<span class="pl-k">.</span><span class="pl-c1">NewvarNode</span>(:(<span class="pl-c1">@_4</span>))
│         Core<span class="pl-k">.</span><span class="pl-c1">NewvarNode</span>(:(<span class="pl-c1">@_5</span>))
│         Core<span class="pl-k">.</span><span class="pl-c1">NewvarNode</span>(:(<span class="pl-c1">@_6</span>))
│   <span class="pl-k">%</span><span class="pl-c1">6</span>  <span class="pl-k">=</span> Main<span class="pl-k">.</span><span class="pl-c1">bar</span>(foo)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">4</span>, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">7</span>  <span class="pl-k">=</span> (<span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-k">%</span><span class="pl-c1">6</span>)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">4</span>, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">8</span>  <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">IteratorSize</span>(<span class="pl-k">%</span><span class="pl-c1">7</span>)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(Base<span class="pl-k">.</span><span class="pl-c1">HasShape</span><span class="pl-c1">{1}</span>(), <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">9</span>  <span class="pl-k">=</span> (<span class="pl-k">%</span><span class="pl-c1">8</span> <span class="pl-k">isa</span> Base<span class="pl-k">.</span>SizeUnknown)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">false</span>, <span class="pl-c1">false</span>)
└──       goto <span class="pl-c"><span class="pl-c">#</span>3 if not %9</span>
<span class="pl-c1">2</span> ─       Core<span class="pl-k">.</span>Compiler<span class="pl-k">.</span><span class="pl-c1">Const</span>(:(Core<span class="pl-k">.</span><span class="pl-c1">apply_type</span>(Core<span class="pl-k">.</span>Array, tmp, <span class="pl-c1">1</span>)), <span class="pl-c1">false</span>)
│         Core<span class="pl-k">.</span>Compiler<span class="pl-k">.</span><span class="pl-c1">Const</span>(:(<span class="pl-c1">@_4</span> <span class="pl-k">=</span> (<span class="pl-k">%</span><span class="pl-c1">11</span>)(Core<span class="pl-k">.</span>undef, <span class="pl-c1">0</span>)), <span class="pl-c1">false</span>)
└──       Core<span class="pl-k">.</span>Compiler<span class="pl-k">.</span><span class="pl-c1">Const</span>(:(goto <span class="pl-k">%</span><span class="pl-c1">15</span>), <span class="pl-c1">false</span>)
<span class="pl-c1">3</span> ┄       (<span class="pl-c1">@_4</span> <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">_array_for</span>(tmp<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(MArray{Tuple{<span class="pl-c1">4</span>},Float64,<span class="pl-c1">1</span>,<span class="pl-c1">4</span>}, <span class="pl-c1">false</span>), <span class="pl-k">%</span><span class="pl-c1">7</span>, <span class="pl-k">%</span><span class="pl-c1">8</span>))
│   <span class="pl-k">%</span><span class="pl-c1">15</span> <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">LinearIndices</span>(<span class="pl-c1">@_4</span>)<span class="pl-k">::</span><span class="pl-c1">LinearIndices{1,Tuple{Base.OneTo{Int64}}}</span>
│         (<span class="pl-c1">@_5</span> <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">first</span>(<span class="pl-k">%</span><span class="pl-c1">15</span>))
│   <span class="pl-k">%</span><span class="pl-c1">17</span> <span class="pl-k">=</span> <span class="pl-k">%</span><span class="pl-c1">7</span><span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">4</span>, <span class="pl-c1">false</span>)
│         (<span class="pl-c1">@_6</span> <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">iterate</span>(<span class="pl-k">%</span><span class="pl-c1">17</span>))
│   <span class="pl-k">%</span><span class="pl-c1">19</span> <span class="pl-k">=</span> (<span class="pl-c1">@_6</span><span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>((<span class="pl-c1">1</span>, <span class="pl-c1">1</span>), <span class="pl-c1">false</span>) <span class="pl-k">===</span> <span class="pl-c1">nothing</span>)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">false</span>, <span class="pl-c1">false</span>)
│   <span class="pl-k">%</span><span class="pl-c1">20</span> <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">not_int</span>(<span class="pl-k">%</span><span class="pl-c1">19</span>)<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(<span class="pl-c1">true</span>, <span class="pl-c1">false</span>)
└──       goto <span class="pl-c"><span class="pl-c">#</span>8 if not %20</span>
<span class="pl-c1">4</span> ┄ <span class="pl-k">%</span><span class="pl-c1">22</span> <span class="pl-k">=</span> <span class="pl-c1">@_6</span><span class="pl-k">::</span><span class="pl-c1">Tuple{Int64,Int64}</span><span class="pl-k">::</span><span class="pl-c1">Tuple{Int64,Int64}</span>
│         Core<span class="pl-k">.</span><span class="pl-c1">getfield</span>(<span class="pl-k">%</span><span class="pl-c1">22</span>, <span class="pl-c1">1</span>)
│   <span class="pl-k">%</span><span class="pl-c1">24</span> <span class="pl-k">=</span> Core<span class="pl-k">.</span><span class="pl-c1">getfield</span>(<span class="pl-k">%</span><span class="pl-c1">22</span>, <span class="pl-c1">2</span>)<span class="pl-k">::</span><span class="pl-c1">Int64</span>
│   <span class="pl-k">%</span><span class="pl-c1">25</span> <span class="pl-k">=</span> (tmp<span class="pl-k">::</span><span class="pl-c1">Core.Compiler.Const</span>(MArray{Tuple{<span class="pl-c1">4</span>},Float64,<span class="pl-c1">1</span>,<span class="pl-c1">4</span>}, <span class="pl-c1">false</span>))(Main<span class="pl-k">.</span>undef)<span class="pl-k">::</span><span class="pl-c1">MArray{Tuple{4},Float64,1,4}</span>
│         <span class="pl-k">$</span>(<span class="pl-c1">Expr</span>(<span class="pl-c1">:inbounds</span>, <span class="pl-c1">true</span>))
└──       goto <span class="pl-c"><span class="pl-c">#</span>6 if not %9</span>
<span class="pl-c1">5</span> ─       Core<span class="pl-k">.</span>Compiler<span class="pl-k">.</span><span class="pl-c1">Const</span>(:(Base<span class="pl-k">.</span><span class="pl-c1">push!</span>(<span class="pl-c1">@_4</span>, <span class="pl-k">%</span><span class="pl-c1">25</span>)), <span class="pl-c1">false</span>)
└──       Core<span class="pl-k">.</span>Compiler<span class="pl-k">.</span><span class="pl-c1">Const</span>(:(goto <span class="pl-k">%</span><span class="pl-c1">31</span>), <span class="pl-c1">false</span>)
<span class="pl-c1">6</span> ┄       Base<span class="pl-k">.</span><span class="pl-c1">setindex!</span>(<span class="pl-c1">@_4</span>, <span class="pl-k">%</span><span class="pl-c1">25</span>, <span class="pl-c1">@_5</span>)
│         <span class="pl-k">$</span>(<span class="pl-c1">Expr</span>(<span class="pl-c1">:inbounds</span>, <span class="pl-c1">:pop</span>))
│         (<span class="pl-c1">@_5</span> <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">add_int</span>(<span class="pl-c1">@_5</span>, <span class="pl-c1">1</span>))
│         (<span class="pl-c1">@_6</span> <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">iterate</span>(<span class="pl-k">%</span><span class="pl-c1">17</span>, <span class="pl-k">%</span><span class="pl-c1">24</span>))
│   <span class="pl-k">%</span><span class="pl-c1">34</span> <span class="pl-k">=</span> (<span class="pl-c1">@_6</span> <span class="pl-k">===</span> <span class="pl-c1">nothing</span>)<span class="pl-k">::</span><span class="pl-c1">Bool</span>
│   <span class="pl-k">%</span><span class="pl-c1">35</span> <span class="pl-k">=</span> Base<span class="pl-k">.</span><span class="pl-c1">not_int</span>(<span class="pl-k">%</span><span class="pl-c1">34</span>)<span class="pl-k">::</span><span class="pl-c1">Bool</span>
└──       goto <span class="pl-c"><span class="pl-c">#</span>8 if not %35</span>
<span class="pl-c1">7</span> ─       goto <span class="pl-c"><span class="pl-c">#</span>4</span>
<span class="pl-c1">8</span> ┄       <span class="pl-k">return</span> <span class="pl-c1">@_4</span></pre></div>
<p dir="auto">Quoting <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/rdeits/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/rdeits">@rdeits</a> in <a href="https://discourse.julialang.org/t/type-instability-with-staticarrays-jl-and-type-alias/39763" rel="nofollow">https://discourse.julialang.org/t/type-instability-with-staticarrays-jl-and-type-alias/39763</a></p>
<blockquote>
<p dir="auto">Yeah, that’s interesting. It looks like <code class="notranslate">tmp</code> is being handled as <code class="notranslate">::DataType</code> rather than <code class="notranslate">::Type{MArray{...}}</code>. That seems like something that would need to be handled in Julia itself, rather than StaticArrays.</p>
</blockquote>