-
-
Couldn't load subscription status.
- Fork 5.7k
fix invalidations of isinf from Static.jl
#46493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
While it is documented to return a julia> isnan(missing)
missingin Base. We could assert it is julia> isequal(missing, missing)
true
julia> isequal(missing, 'a')
falsebut it's a little less safe here. |
|
But we have julia> missing isa Real
falseso julia> @which isinf(missing)
isinf(::Missing) in Base at missing.jl:101does not use the method I changed here. |
|
I also checked ForwardDiff.jl, which has julia> using ForwardDiff
julia> x = ForwardDiff.Dual{Float64}(1.0, (0.0, 0.0))
Dual{Float64}(1.0,0.0,0.0)
julia> x isa Real
trueThey implement their own logic for julia> @which isinf(x)
isinf(d::ForwardDiff.Dual) in ForwardDiff at ~/.julia/packages/ForwardDiff/pDtsf/src/dual.jl:384
julia> @which isnan(x)
isnan(d::ForwardDiff.Dual) in ForwardDiff at ~/.julia/packages/ForwardDiff/pDtsf/src/dual.jl:384
julia> @which isfinite(x)
isfinite(d::ForwardDiff.Dual) in ForwardDiff at ~/.julia/packages/ForwardDiff/pDtsf/src/dual.jl:384 |
|
But I think you are right, this may be not a good approach to fix the invalidations. There could be other packages implementing their own special return types, e.g., some SIMD types. I will look into this later. |
|
I was able to fix the invalidations one level higher. As far as I can tell, this should be save since it is
I suggest the labels |
(cherry picked from commit c2a1650)
This should hopefully fix quite some invalidations coming from Static.jl.
Here is the code:
Since
isnanandisfiniteare documented to returnBools, it appears to be sane to assert that they do here.