<p dir="auto">I've just noticed that a specific type-unstable broadcast fails on master, while it works fine on julia 1.5</p>
<p dir="auto">MWE:</p>
<p dir="auto">on julia 1.5</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; broadcast((args...) -&gt; NamedTuple{(:a, :b)}(args), [sin, cos], [1, 2])
2-element Array{NamedTuple{(:a, :b),T} where T&lt;:Tuple,1}:
 (a = sin, b = 1)
 (a = cos, b = 2)"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-c1">broadcast</span>((args<span class="pl-k">...</span>) <span class="pl-k">-&gt;</span> <span class="pl-c1">NamedTuple</span><span class="pl-c1">{(:a, :b)}</span>(args), [sin, cos], [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>])
<span class="pl-c1">2</span><span class="pl-k">-</span>element Array{NamedTuple{(<span class="pl-c1">:a</span>, <span class="pl-c1">:b</span>),T} <span class="pl-k">where</span> T<span class="pl-k">&lt;:</span><span class="pl-c1">Tuple</span>,<span class="pl-c1">1</span>}<span class="pl-k">:</span>
 (a <span class="pl-k">=</span> sin, b <span class="pl-k">=</span> <span class="pl-c1">1</span>)
 (a <span class="pl-k">=</span> cos, b <span class="pl-k">=</span> <span class="pl-c1">2</span>)</pre></div>
<p dir="auto">on nightly build</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; broadcast((args...) -&gt; NamedTuple{(:a, :b)}(args), [sin, cos], [1, 2])
ERROR: TypeError: in typeassert, expected AbstractVector{var&quot;#s825&quot;} where var&quot;#s825&quot;&lt;:(NamedTuple{(:a, :b), _A} where _A&lt;:Tuple{Function, Int64}), got a value of type Vector{NamedTuple{(:a, :b), T} where T&lt;:Tuple}
Stacktrace:
 [1] copy
   @ ./broadcast.jl:928 [inlined]
 [2] materialize
   @ ./broadcast.jl:881 [inlined]
 [3] broadcast(::var&quot;#1#2&quot;, ::Vector{Function}, ::Vector{Int64})
   @ Base.Broadcast ./broadcast.jl:819
 [4] top-level scope
   @ REPL[1]:1"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-c1">broadcast</span>((args<span class="pl-k">...</span>) <span class="pl-k">-&gt;</span> <span class="pl-c1">NamedTuple</span><span class="pl-c1">{(:a, :b)}</span>(args), [sin, cos], [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>])
ERROR<span class="pl-k">:</span> TypeError<span class="pl-k">:</span> <span class="pl-k">in</span> typeassert, expected AbstractVector{<span class="pl-c1">var"#s825"</span>} <span class="pl-k">where</span> <span class="pl-c1">var"#s825"</span><span class="pl-k">&lt;:</span><span class="pl-c1">(NamedTuple{(:a, :b)</span>, _A} <span class="pl-k">where</span> _A<span class="pl-k">&lt;:</span><span class="pl-c1">Tuple{Function, Int64}</span>), got a value of type Vector{NamedTuple{(<span class="pl-c1">:a</span>, <span class="pl-c1">:b</span>), T} <span class="pl-k">where</span> T<span class="pl-k">&lt;:</span><span class="pl-c1">Tuple</span>}
Stacktrace<span class="pl-k">:</span>
 [<span class="pl-c1">1</span>] copy
   @ <span class="pl-k">./</span>broadcast<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">928</span> [inlined]
 [<span class="pl-c1">2</span>] materialize
   @ <span class="pl-k">./</span>broadcast<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">881</span> [inlined]
 [<span class="pl-c1">3</span>] <span class="pl-c1">broadcast</span>(<span class="pl-k">::</span><span class="pl-c1">var"#1#2"</span>, <span class="pl-k">::</span><span class="pl-c1">Vector{Function}</span>, <span class="pl-k">::</span><span class="pl-c1">Vector{Int64}</span>)
   @ Base<span class="pl-k">.</span>Broadcast <span class="pl-k">./</span>broadcast<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">819</span>
 [<span class="pl-c1">4</span>] top<span class="pl-k">-</span>level scope
   @ REPL[<span class="pl-c1">1</span>]<span class="pl-k">:</span><span class="pl-c1">1</span></pre></div>
<p dir="auto">Here's my versioninfo</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; versioninfo()
Julia Version 1.6.0-DEV.1493
Commit f3252bf505 (2020-11-14 16:56 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.0 (ORCJIT, skylake)"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-c1">versioninfo</span>()
Julia Version <span class="pl-c1">1.6</span>.<span class="pl-c1">0</span><span class="pl-k">-</span>DEV.<span class="pl-c1">1493</span>
Commit f3252bf505 (<span class="pl-c1">2020</span><span class="pl-k">-</span><span class="pl-c1">11</span><span class="pl-k">-</span><span class="pl-c1">14</span> <span class="pl-c1">16</span><span class="pl-k">:</span><span class="pl-c1">56</span> UTC)
Platform Info<span class="pl-k">:</span>
  OS<span class="pl-k">:</span> Linux (x86_64<span class="pl-k">-</span>pc<span class="pl-k">-</span>linux<span class="pl-k">-</span>gnu)
  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">7700</span>HQ CPU @ <span class="pl-c1">2.80</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">11.0</span>.<span class="pl-c1">0</span> (ORCJIT, skylake)</pre></div>
<p dir="auto">(I've just redownloaded the nightly build, banner says 2 days old master.)</p>
<p dir="auto">Running the tests for AutomotiveSimulator errors on nightly (<a href="https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_hash/c3bb6df_vs_788b2c7/AutomotiveSimulator.1.6.0-DEV-a896693d33.log" rel="nofollow">https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_hash/c3bb6df_vs_788b2c7/AutomotiveSimulator.1.6.0-DEV-a896693d33.log</a>) due to a type assert error in broadcasting.</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="feature extraction: Error During Test at /home/kc/PkgEval16/dev/AutomotiveSimulator/test/test_features.jl:119
  Got exception outside of a @test
  TypeError: in typeassert, expected AbstractVector{var&quot;#s825&quot;} where var&quot;#s825&quot;&lt;:(AbstractVector{var&quot;#s825&quot;} where var&quot;#s825&quot;&lt;:Union{Missing, Float64}), got a value of type Vector{Vector{T} where T}
  Stacktrace:
    [1] copy(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, AutomotiveSimulator.var&quot;#25#26&quot;{typeof(dist_to_front_neighbor), Roadway{Float64}, Vector{EntityScene{VehicleState, VehicleDef, Int64}}}, Tuple{Vector{Int64}}})
      @ Base.Broadcast ./broadcast.jl:928
    [2] materialize
      @ ./broadcast.jl:881 [inlined]
    [3] broadcast(f::AutomotiveSimulator.var&quot;#25#26&quot;{typeof(dist_to_front_neighbor), Roadway{Float64}, Vector{EntityScene{VehicleState, VehicleDef, Int64}}}, As::Vector{Int64})
      @ Base.Broadcast ./broadcast.jl:819
    [4] extract_feature(ft::SceneFeature, feature::Function, roadway::Roadway{Float64}, scenes::Vector{EntityScene{VehicleState, VehicleDef, Int64}}, ids::Vector{Int64})
      @ AutomotiveSimulator ~/PkgEval16/dev/AutomotiveSimulator/src/feature-extraction/features.jl:96
...."><pre class="notranslate">feature extraction<span class="pl-k">:</span> Error During Test at <span class="pl-k">/</span>home<span class="pl-k">/</span>kc<span class="pl-k">/</span>PkgEval16<span class="pl-k">/</span>dev<span class="pl-k">/</span>AutomotiveSimulator<span class="pl-k">/</span>test<span class="pl-k">/</span>test_features<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">119</span>
  Got exception outside of a <span class="pl-c1">@test</span>
  TypeError<span class="pl-k">:</span> <span class="pl-k">in</span> typeassert, expected AbstractVector{<span class="pl-c1">var"#s825"</span>} <span class="pl-k">where</span> <span class="pl-c1">var"#s825"</span><span class="pl-k">&lt;:</span><span class="pl-c1">(AbstractVector{var"#s825"} where var"#s825"&lt;:Union{Missing, Float64})</span>, got a value of type Vector{Vector{T} <span class="pl-k">where</span> T}
  Stacktrace<span class="pl-k">:</span>
    [<span class="pl-c1">1</span>] <span class="pl-c1">copy</span>(bc<span class="pl-k">::</span><span class="pl-c1">Base.Broadcast.Broadcasted</span>{Base<span class="pl-k">.</span>Broadcast<span class="pl-k">.</span>DefaultArrayStyle{<span class="pl-c1">1</span>}, Tuple{Base<span class="pl-k">.</span>OneTo{Int64}}, AutomotiveSimulator<span class="pl-k">.</span><span class="pl-c1">var"#25#26"</span>{<span class="pl-c1">typeof</span>(dist_to_front_neighbor), Roadway{Float64}, Vector{EntityScene{VehicleState, VehicleDef, Int64}}}, Tuple{Vector{Int64}}})
      @ Base<span class="pl-k">.</span>Broadcast <span class="pl-k">./</span>broadcast<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">928</span>
    [<span class="pl-c1">2</span>] materialize
      @ <span class="pl-k">./</span>broadcast<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">881</span> [inlined]
    [<span class="pl-c1">3</span>] <span class="pl-c1">broadcast</span>(f<span class="pl-k">::</span><span class="pl-c1">AutomotiveSimulator.var"#25#26"</span>{<span class="pl-c1">typeof</span>(dist_to_front_neighbor), Roadway{Float64}, Vector{EntityScene{VehicleState, VehicleDef, Int64}}}, As<span class="pl-k">::</span><span class="pl-c1">Vector{Int64}</span>)
      @ Base<span class="pl-k">.</span>Broadcast <span class="pl-k">./</span>broadcast<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">819</span>
    [<span class="pl-c1">4</span>] <span class="pl-c1">extract_feature</span>(ft<span class="pl-k">::</span><span class="pl-c1">SceneFeature</span>, feature<span class="pl-k">::</span><span class="pl-c1">Function</span>, roadway<span class="pl-k">::</span><span class="pl-c1">Roadway{Float64}</span>, scenes<span class="pl-k">::</span><span class="pl-c1">Vector{EntityScene{VehicleState, VehicleDef, Int64}}</span>, ids<span class="pl-k">::</span><span class="pl-c1">Vector{Int64}</span>)
      @ AutomotiveSimulator <span class="pl-k">~</span><span class="pl-k">/</span>PkgEval16<span class="pl-k">/</span>dev<span class="pl-k">/</span>AutomotiveSimulator<span class="pl-k">/</span>src<span class="pl-k">/</span>feature<span class="pl-k">-</span>extraction<span class="pl-k">/</span>features<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">96</span>
<span class="pl-k">....</span></pre></div>
<p dir="auto">This type assert comes from:</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/JuliaLang/julia/blob/3dc54a23ac93109399357c68c9fc998815f25cdc/base/broadcast.jl#L924-L928">julia/base/broadcast.jl</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 924 to 928
      in
      <a data-pjax="true" class="commit-tease-sha" href="/JuliaLang/julia/commit/3dc54a23ac93109399357c68c9fc998815f25cdc">3dc54a2</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L924" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="924"></td>
          <td id="LC924" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> The typeassert gives inference a helping hand on the element type and dimensionality</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L925" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="925"></td>
          <td id="LC925" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> (work-around for #28382)</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L926" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="926"></td>
          <td id="LC926" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> ElType′ <span class="pl-k">=</span> ElType <span class="pl-k">&lt;:</span> <span class="pl-c1">Type</span> <span class="pl-k">?</span> Type <span class="pl-k">:</span> ElType </td>
        </tr>

        <tr class="border-0">
          <td id="L927" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="927"></td>
          <td id="LC927" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> RT <span class="pl-k">=</span> dest <span class="pl-k">isa</span> AbstractArray <span class="pl-k">?</span> AbstractArray{<span class="pl-k">&lt;:</span><span class="pl-c1">ElType′</span>, <span class="pl-c1">ndims</span>(dest)} <span class="pl-k">:</span> Any </td>
        </tr>

        <tr class="border-0">
          <td id="L928" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="928"></td>
          <td id="LC928" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">return</span> <span class="pl-c1">copyto_nonleaf!</span>(dest, bc′, iter, state, <span class="pl-c1">1</span>)<span class="pl-k">::</span><span class="pl-c1">RT</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">and was introduced in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="393598175" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/30485" data-hovercard-type="pull_request" data-hovercard-url="/JuliaLang/julia/pull/30485/hovercard" href="https://github.com/JuliaLang/julia/pull/30485">#30485</a>.</p>
<p dir="auto">Is the package doing something wrong or is this type assert a bit too strict?</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/nalimilan/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/nalimilan">@nalimilan</a></p>