mcabbott / AxisKeys.jl

🎹
MIT License
149 stars 28 forks source link

Replace `_maybetail` with `safe_tail` #124

Closed andrewjradcliffe closed 2 years ago

andrewjradcliffe commented 2 years ago

This was motivated by the disappearance of _maybetail from Base, which causes AxisKeys to not be compatible with v1.9. As it happens, safe_tail is identical to _maybetail, thus, it would seem that the latter was eliminated due to redundancy. Inspection of the v1.6 branch of JuliaLang confirms that safe_tail exists in its same form, thus, given the [compat] for this AxisKeys, this seems like a harmless change which enables compatibility with master.

mcabbott commented 2 years ago

Thanks!

Do you know whether the test failures on nightly are new?

andrewjradcliffe commented 2 years ago

The replacement of _maybetail with safe_tail is truly 1-for-1 -- the code of safe_tail is exactly identical to _maybetail. The test failures on nightly are not due to this particular change.

Inspection of the details indicates uncolon changes in Base; looks like

uncolon(inds::Tuple{},    I::Tuple{Colon, Vararg{Any}}) = Slice(OneTo(1))
uncolon(inds::Tuple,      I::Tuple{Colon, Vararg{Any}}) = Slice(inds[1])

in v1.8 becomes

uncolon(::Tuple{}) = Slice(OneTo(1))
uncolon(inds::Tuple) = Slice(inds[1])

in v1.9

I am not sufficiently confident that I know how to fix the uncolon change (well, replicating the v1.8 code within selector.jl always works, but there might be a better way).

mcabbott commented 2 years ago

Ok. Thanks for having a look. Let's merge this then, and return to the rest.