<p dir="auto">The following MWE shows a @test_throws regression. The throw is not anymore detected (this occurs also with Julia 1.6):</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; import ParallelStencil.ParallelKernel.parallel_indices

julia&gt; using ParallelStencil.ParallelKernel.Exceptions

julia&gt; using Test

julia&gt; @test_throws ArgumentError parallel_indices(:((ix,iy,iz)), :(f()=(99; if x return y end; return))) 
Test Failed at none:1
  Expression: parallel_indices(:((ix, iy, iz)), :(f() = begin
              99
              if x
                  return y
              end
              return
          end))
    Expected: ArgumentError
      Thrown: UndefVarError
ERROR: There was an error during testing"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-k">import</span> ParallelStencil<span class="pl-k">.</span>ParallelKernel<span class="pl-k">.</span>parallel_indices

julia<span class="pl-k">&gt;</span> <span class="pl-k">using</span> ParallelStencil<span class="pl-k">.</span>ParallelKernel<span class="pl-k">.</span>Exceptions

julia<span class="pl-k">&gt;</span> <span class="pl-k">using</span> Test

julia<span class="pl-k">&gt;</span> <span class="pl-c1">@test_throws</span> ArgumentError <span class="pl-en">parallel_indices</span>(:((ix,iy,iz)), :(<span class="pl-en">f</span>()<span class="pl-k">=</span>(<span class="pl-c1">99</span>; <span class="pl-k">if</span> x <span class="pl-k">return</span> y <span class="pl-k">end</span>; <span class="pl-k">return</span>))) 
Test Failed at none<span class="pl-k">:</span><span class="pl-c1">1</span>
  Expression<span class="pl-k">:</span> <span class="pl-en">parallel_indices</span>(:((ix, iy, iz)), :(<span class="pl-en">f</span>() <span class="pl-k">=</span> <span class="pl-k">begin</span>
              <span class="pl-c1">99</span>
              <span class="pl-k">if</span> x
                  <span class="pl-k">return</span> y
              <span class="pl-k">end</span>
              <span class="pl-k">return</span>
          <span class="pl-k">end</span>))
    Expected<span class="pl-k">:</span> ArgumentError
      Thrown<span class="pl-k">:</span> UndefVarError
ERROR<span class="pl-k">:</span> There was an error during testing</pre></div>
<p dir="auto">If we call the function directly with these arguments, we see that it does throw an ArgumentError:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; parallel_indices(:((ix,iy,iz)), :(f()=(99; if x return y end; return)))
ERROR: ArgumentError: invalid kernel in @parallel kernel definition: only one return statement is allowed in the kernel and it must return nothing and be the last statement (required to ensure equal behaviour with different packages for parallellization).
Stacktrace:
 [1] remove_return(body::Expr)
   @ ParallelStencil.ParallelKernel ~/.julia/dev/ParallelStencil/src/ParallelKernel/shared.jl:80
 [2] parallel_kernel(package::Symbol, numbertype::DataType, indices::Expr, kernel::Expr)
   @ ParallelStencil.ParallelKernel ~/.julia/dev/ParallelStencil/src/ParallelKernel/parallel.jl:130
 [3] parallel_indices(::Expr, ::Vararg{Expr, N} where N; package::Symbol, async::Bool)
   @ ParallelStencil.ParallelKernel ~/.julia/dev/ParallelStencil/src/ParallelKernel/parallel.jl:113
 [4] parallel_indices(::Expr, ::Vararg{Expr, N} where N)
   @ ParallelStencil.ParallelKernel ~/.julia/dev/ParallelStencil/src/ParallelKernel/parallel.jl:112
 [5] top-level scope
   @ none:1"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-en">parallel_indices</span>(:((ix,iy,iz)), :(<span class="pl-en">f</span>()<span class="pl-k">=</span>(<span class="pl-c1">99</span>; <span class="pl-k">if</span> x <span class="pl-k">return</span> y <span class="pl-k">end</span>; <span class="pl-k">return</span>)))
ERROR<span class="pl-k">:</span> ArgumentError<span class="pl-k">:</span> invalid kernel <span class="pl-k">in</span> <span class="pl-c1">@parallel</span> kernel definition<span class="pl-k">:</span> only one <span class="pl-k">return</span> statement is allowed <span class="pl-k">in</span> the kernel and it must <span class="pl-k">return</span> <span class="pl-c1">nothing</span> and be the last statement (required to ensure equal behaviour with different packages <span class="pl-k">for</span> parallellization).
Stacktrace<span class="pl-k">:</span>
 [<span class="pl-c1">1</span>] <span class="pl-c1">remove_return</span>(body<span class="pl-k">::</span><span class="pl-c1">Expr</span>)
   @ ParallelStencil<span class="pl-k">.</span>ParallelKernel <span class="pl-k">~</span><span class="pl-k">/</span><span class="pl-k">.</span>julia<span class="pl-k">/</span>dev<span class="pl-k">/</span>ParallelStencil<span class="pl-k">/</span>src<span class="pl-k">/</span>ParallelKernel<span class="pl-k">/</span>shared<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">80</span>
 [<span class="pl-c1">2</span>] <span class="pl-c1">parallel_kernel</span>(package<span class="pl-k">::</span><span class="pl-c1">Symbol</span>, numbertype<span class="pl-k">::</span><span class="pl-c1">DataType</span>, indices<span class="pl-k">::</span><span class="pl-c1">Expr</span>, kernel<span class="pl-k">::</span><span class="pl-c1">Expr</span>)
   @ ParallelStencil<span class="pl-k">.</span>ParallelKernel <span class="pl-k">~</span><span class="pl-k">/</span><span class="pl-k">.</span>julia<span class="pl-k">/</span>dev<span class="pl-k">/</span>ParallelStencil<span class="pl-k">/</span>src<span class="pl-k">/</span>ParallelKernel<span class="pl-k">/</span>parallel<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">130</span>
 [<span class="pl-c1">3</span>] <span class="pl-c1">parallel_indices</span>(<span class="pl-k">::</span><span class="pl-c1">Expr</span>, <span class="pl-k">::</span><span class="pl-c1">Vararg{Expr, N}</span> <span class="pl-k">where</span> N; package<span class="pl-k">::</span><span class="pl-c1">Symbol</span>, async<span class="pl-k">::</span><span class="pl-c1">Bool</span>)
   @ ParallelStencil<span class="pl-k">.</span>ParallelKernel <span class="pl-k">~</span><span class="pl-k">/</span><span class="pl-k">.</span>julia<span class="pl-k">/</span>dev<span class="pl-k">/</span>ParallelStencil<span class="pl-k">/</span>src<span class="pl-k">/</span>ParallelKernel<span class="pl-k">/</span>parallel<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">113</span>
 [<span class="pl-c1">4</span>] <span class="pl-c1">parallel_indices</span>(<span class="pl-k">::</span><span class="pl-c1">Expr</span>, <span class="pl-k">::</span><span class="pl-c1">Vararg{Expr, N}</span> <span class="pl-k">where</span> N)
   @ ParallelStencil<span class="pl-k">.</span>ParallelKernel <span class="pl-k">~</span><span class="pl-k">/</span><span class="pl-k">.</span>julia<span class="pl-k">/</span>dev<span class="pl-k">/</span>ParallelStencil<span class="pl-k">/</span>src<span class="pl-k">/</span>ParallelKernel<span class="pl-k">/</span>parallel<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">112</span>
 [<span class="pl-c1">5</span>] top<span class="pl-k">-</span>level scope
   @ none<span class="pl-k">:</span><span class="pl-c1">1</span></pre></div>
<p dir="auto">Note that the other similar tests in the testsuite, it still works fine, e.g.:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; @test_throws ArgumentError parallel_indices(:((ix,iy,iz)), :(f()=(99; return something)))
Test Passed
      Thrown: ArgumentError

julia&gt; parallel_indices(:((ix,iy,iz)), :(f()=(99; return something)))
ERROR: ArgumentError: invalid kernel in @parallel kernel definition: the last statement must be a `return nothing` statement ('return' or 'return nothing' or 'nothing') as required for any CUDA kernels.
Stacktrace:
 [1] remove_return(body::Expr)
   @ ParallelStencil.ParallelKernel ~/.julia/dev/ParallelStencil/src/ParallelKernel/shared.jl:76
 [2] parallel_kernel(package::Symbol, numbertype::DataType, indices::Expr, kernel::Expr)
   @ ParallelStencil.ParallelKernel ~/.julia/dev/ParallelStencil/src/ParallelKernel/parallel.jl:130
 [3] parallel_indices(::Expr, ::Vararg{Expr, N} where N; package::Symbol, async::Bool)
   @ ParallelStencil.ParallelKernel ~/.julia/dev/ParallelStencil/src/ParallelKernel/parallel.jl:113
 [4] parallel_indices(::Expr, ::Vararg{Expr, N} where N)
   @ ParallelStencil.ParallelKernel ~/.julia/dev/ParallelStencil/src/ParallelKernel/parallel.jl:112
 [5] top-level scope
   @ none:1"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-c1">@test_throws</span> ArgumentError <span class="pl-en">parallel_indices</span>(:((ix,iy,iz)), :(<span class="pl-en">f</span>()<span class="pl-k">=</span>(<span class="pl-c1">99</span>; <span class="pl-k">return</span> something)))
Test Passed
      Thrown<span class="pl-k">:</span> ArgumentError

julia<span class="pl-k">&gt;</span> <span class="pl-en">parallel_indices</span>(:((ix,iy,iz)), :(<span class="pl-en">f</span>()<span class="pl-k">=</span>(<span class="pl-c1">99</span>; <span class="pl-k">return</span> something)))
ERROR<span class="pl-k">:</span> ArgumentError<span class="pl-k">:</span> invalid kernel <span class="pl-k">in</span> <span class="pl-c1">@parallel</span> kernel definition<span class="pl-k">:</span> the last statement must be a <span class="pl-s"><span class="pl-pds">`</span>return nothing<span class="pl-pds">`</span></span> statement (<span class="pl-s"><span class="pl-pds">'</span>return<span class="pl-pds">'</span></span> or <span class="pl-s"><span class="pl-pds">'</span>return nothing<span class="pl-pds">'</span></span> or <span class="pl-s"><span class="pl-pds">'</span>nothing<span class="pl-pds">'</span></span>) as required <span class="pl-k">for</span> any CUDA kernels.
Stacktrace<span class="pl-k">:</span>
 [<span class="pl-c1">1</span>] <span class="pl-c1">remove_return</span>(body<span class="pl-k">::</span><span class="pl-c1">Expr</span>)
   @ ParallelStencil<span class="pl-k">.</span>ParallelKernel <span class="pl-k">~</span><span class="pl-k">/</span><span class="pl-k">.</span>julia<span class="pl-k">/</span>dev<span class="pl-k">/</span>ParallelStencil<span class="pl-k">/</span>src<span class="pl-k">/</span>ParallelKernel<span class="pl-k">/</span>shared<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">76</span>
 [<span class="pl-c1">2</span>] <span class="pl-c1">parallel_kernel</span>(package<span class="pl-k">::</span><span class="pl-c1">Symbol</span>, numbertype<span class="pl-k">::</span><span class="pl-c1">DataType</span>, indices<span class="pl-k">::</span><span class="pl-c1">Expr</span>, kernel<span class="pl-k">::</span><span class="pl-c1">Expr</span>)
   @ ParallelStencil<span class="pl-k">.</span>ParallelKernel <span class="pl-k">~</span><span class="pl-k">/</span><span class="pl-k">.</span>julia<span class="pl-k">/</span>dev<span class="pl-k">/</span>ParallelStencil<span class="pl-k">/</span>src<span class="pl-k">/</span>ParallelKernel<span class="pl-k">/</span>parallel<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">130</span>
 [<span class="pl-c1">3</span>] <span class="pl-c1">parallel_indices</span>(<span class="pl-k">::</span><span class="pl-c1">Expr</span>, <span class="pl-k">::</span><span class="pl-c1">Vararg{Expr, N}</span> <span class="pl-k">where</span> N; package<span class="pl-k">::</span><span class="pl-c1">Symbol</span>, async<span class="pl-k">::</span><span class="pl-c1">Bool</span>)
   @ ParallelStencil<span class="pl-k">.</span>ParallelKernel <span class="pl-k">~</span><span class="pl-k">/</span><span class="pl-k">.</span>julia<span class="pl-k">/</span>dev<span class="pl-k">/</span>ParallelStencil<span class="pl-k">/</span>src<span class="pl-k">/</span>ParallelKernel<span class="pl-k">/</span>parallel<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">113</span>
 [<span class="pl-c1">4</span>] <span class="pl-c1">parallel_indices</span>(<span class="pl-k">::</span><span class="pl-c1">Expr</span>, <span class="pl-k">::</span><span class="pl-c1">Vararg{Expr, N}</span> <span class="pl-k">where</span> N)
   @ ParallelStencil<span class="pl-k">.</span>ParallelKernel <span class="pl-k">~</span><span class="pl-k">/</span><span class="pl-k">.</span>julia<span class="pl-k">/</span>dev<span class="pl-k">/</span>ParallelStencil<span class="pl-k">/</span>src<span class="pl-k">/</span>ParallelKernel<span class="pl-k">/</span>parallel<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">112</span>
 [<span class="pl-c1">5</span>] top<span class="pl-k">-</span>level scope
   @ none<span class="pl-k">:</span><span class="pl-c1">1</span></pre></div>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> core.jl (setfield on an immutable throws a different error message)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> checked.jl (runtime-intrinsic implementation problems?)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> ~errorshow.jl (dispatch or type-system mistake? shows up as recursive StackOverflow)~~ moving to separate issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="371280115" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/29695" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/29695/hovercard" href="https://github.com/JuliaLang/julia/issues/29695">#29695</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> <del>math.jl (incorrect answers in sinh/cosh)</del> duplicate of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="364623018" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/29400" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/29400/hovercard" href="https://github.com/JuliaLang/julia/issues/29400">#29400</a> / fixed by <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="364650394" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/29401" data-hovercard-type="pull_request" data-hovercard-url="/JuliaLang/julia/pull/29401/hovercard" href="https://github.com/JuliaLang/julia/pull/29401">#29401</a>.</li>
</ul>