You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a strange issue with @report_opt. It throws an error on the first run but passes on the subsequent run. I suspect this might be a false positive. By following the steps below in the REPL, this behavior can be reproduced.
run the following code
julia>VERSIONv"1.11.1"
define some functions
each_edge(pts::AbstractVector) =@viewszip(pts[begin:end-1], pts[begin+1:end])
distance(p1, p2) =√(sum((p1 .- p2) .^2))
perimeter3(v::AbstractVector{NTuple{2,T}}) where {T} =mapfoldl(((p1, p2),) ->distance(p1, p2), +, each_edge(v); init=zero(T))
functionperimeter2(v::AbstractVector{NTuple{2,T}}) where {T}
l =zero(T)
for (p1,p2) ineach_edge(v)
l +=distance(p1, p2)
endreturn l
end
import JET.jl
julia>using JET
define a polyline and call @report_opt the first time on perimeter3
julia> line = [(-0.5, 1.5), (1.0, 1.0), (3.0, 1.0), (4.5, 1.5)];
julia>@report_optperimeter3(line)
═════ 18 possible errors found ═════
call @report_opt a second time on perimeter2
julia>@report_optperimeter2(line)
No errors detected
now, call @report_opt a third time on perimeter3 again
julia>@report_optperimeter3(line)
No errors detected
Note that in step 6, the error is gone, which is quite strange. If step 5 is removed, the error will still persist. Furthermore, if step 4 is skipped, after running step 5, step 6 will also not report any error.
The text was updated successfully, but these errors were encountered:
I encountered a strange issue with
@report_opt
. It throws an error on the first run but passes on the subsequent run. I suspect this might be a false positive. By following the steps below in the REPL, this behavior can be reproduced.JET.jl
@report_opt
the first time onperimeter3
@report_opt
a second time onperimeter2
@report_opt
a third time onperimeter3
againNote that in step 6, the error is gone, which is quite strange. If step 5 is removed, the error will still persist. Furthermore, if step 4 is skipped, after running step 5, step 6 will also not report any error.
The text was updated successfully, but these errors were encountered: