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
function mask(flag::Bool)::Vector{Bool}
return Bool[flag, false]
end
function oops(flag::Bool)::Nothing
values = Int[1, 2]
used = mask(flag)
if length(used) == length(values) && any(used)
values[used]
end
return nothing
end
oops(true)
oops(false)
Will fail with an error pointing to the innards of Base.LogicalIndex. I'm not 100% sure whether the problem is that the system thinks used may be the wrong length, or that it may be all-false, or something else, but either way, it is a false positive.
I actually like it that JET emits an error here, forcing one to think about this (though the actual error is extremely opaque).
The problem is, there's currently no way to tell JET "kindly shut up about this, I know what I'm doing" (#515, #346, #148, ...).
Is there a workaround?
The text was updated successfully, but these errors were encountered:
orenbenkiki
changed the title
Indexing by nnonn-empty mask
Indexing by non-empty mask
Jul 27, 2023
Synthetic example:
Will fail with an error pointing to the innards of
Base.LogicalIndex
. I'm not 100% sure whether the problem is that the system thinksused
may be the wrong length, or that it may be all-false
, or something else, but either way, it is a false positive.I actually like it that JET emits an error here, forcing one to think about this (though the actual error is extremely opaque).
The problem is, there's currently no way to tell JET "kindly shut up about this, I know what I'm doing" (#515, #346, #148, ...).
Is there a workaround?
The text was updated successfully, but these errors were encountered: