ChainRules.jl
ChainRules.jl copied to clipboard
Fix type inference failure in norm on structural matrix
This fixes the 1.11 failures on CI.
Not sure its the best way, but it basically boils down to
Julia 1.11 introduced a minor regression in inference of: zero.(Diagonal(Float64[;])) .* 0.0)
This used to infer to Diagonal{Float64} now it infers to Union(Diagonal{Float64}, Matrix{Float64})
Similar to others.
Not sure this is exactly the cleanest or best way but this does fix it.
We also could change it not to test this. But small type inference failures do easily grow into big ones -- union splitting isn't a silver bullet.
I am not stepping up to primary maintainer duties, I am just on leave and thought i would check something and I saw CI was broken. hopefully someone can review this
Apparently this inference failure doesn't happen in julia 1.11 without anything loaded, so it is caused by World Splitting somewhere
CI still fails because of a failure with sortslices, but the norm problem is gone