<p dir="auto">Domain Errors and Bounds Errors provide incorrect tracebacks when called within loops. For example, if a file contains</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="while true
10^(-1)
end"><pre class="notranslate"><code class="notranslate">while true
10^(-1)
end
</code></pre></div>
<p dir="auto">then the domain error is traced back to line 1, instead of line 2. Bounds errors provide incorrect tracebacks in the following example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function do_something()
foo = rand(4)
foo[5]
end

while true
do_something()
end"><pre class="notranslate"><code class="notranslate">function do_something()
foo = rand(4)
foo[5]
end

while true
do_something()
end
</code></pre></div>
<p dir="auto">In this case, the error is traced back to the do_something() line, instead of where the error actually occurs at the foo[5] line.</p>
<p dir="auto">I'm running Julia commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/JuliaLang/julia/commit/74a41d2523e823e956cbf9fca288a75b58734cad/hovercard" href="https://github.com/JuliaLang/julia/commit/74a41d2523e823e956cbf9fca288a75b58734cad"><tt>74a41d2</tt></a> on Windows.</p>
<p dir="auto">Should this test not succeed?</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="using Test
 function becareful()
       @warn &quot;attention&quot;
 end

@test_warn r&quot;.*attention.*&quot; becareful()"><pre class="notranslate"><code class="notranslate">using Test
 function becareful()
       @warn "attention"
 end

@test_warn r".*attention.*" becareful()
</code></pre></div>
<p dir="auto">I get this error message on Julia 0.7.0 and 1.0.0 (official Linux build).</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="┌ Warning: attention
└ @ Main REPL[2]:2
Test Failed at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v0.7/Test/src/Test.jl:605
  Expression: contains_warn(read(fname, String), $(Expr(:escape, :(#= REPL[3]:1 =# @r_str &quot;.*attention.*&quot;))))
ERROR: There was an error during testing"><pre class="notranslate"><code class="notranslate">┌ Warning: attention
└ @ Main REPL[2]:2
Test Failed at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v0.7/Test/src/Test.jl:605
  Expression: contains_warn(read(fname, String), $(Expr(:escape, :(#= REPL[3]:1 =# @r_str ".*attention.*"))))
ERROR: There was an error during testing
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Julia Version 0.7.0
Commit a4cb80f3ed (2018-08-08 06:46 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i3-3120M CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, ivybridge)"><pre class="notranslate"><code class="notranslate">Julia Version 0.7.0
Commit a4cb80f3ed (2018-08-08 06:46 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i3-3120M CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, ivybridge)
</code></pre></div>