The following
using DiagonalArrays: delta
using TensorAlgebra: contract
contract(delta(2, 2), ("i", "j"), delta(2, 2), ("j", "l"))
Errors with
unless the delta arrays have exactly matching indices. Obviously this makes sense from the perspective that the array would no longer be diagonal, but presumably the type should be promoted up to a sparse or dense array in such cases.