Closed singularitti closed 1 year ago
Thank you for the detailed synopsis of the situation. I appreciate it!
Note that there may be a whole class of bugs related to StaticArrays that I have not tested. I hope not, but I haven't done any tests except on regular matrices and SparseArrays.
Note that it would be nice to include tests with StaticArrays in runtests but I don't know how to do so without adding the StaticArrays dependency. (In the reverse, I am testing matrices made with SparseArrays, but that dependency could probably be dropped.)
PR #93 is great, but requires three small changes to get the runtests to pass. The biggest issue is that I needed FreeUnits
in L169 of UnitfulMatrix.jl. This is a temporary solution, because there are other types of units that are not handled. Issue #88 is probably related.
I tried and failed to update PR #93 (I have not done this before) and instead I have incorporated #93 into #94 which passes tests and passes the StaticArrays code above.
Code example:
The cause is because of this line:
The reason is that you check against
eltype(dims)
is a subtype ofVector
, notAbstractVector
, which caused the checking procedure to return anothing
since nothing is matched.You may want to add an
else
to notify unexpected behavior:Why is
eltype(dims)
not aVector
? While, it was generated by this code:As you can see,
unitrange
was generated twice, while the first statement is overwritten by the second, fora
, i.e.,x::SVector{3}
, this will causeunitrange
to be aSVector
, too. Which is obviously not a subtype ofVector
.You may want to fix it by: