Stripping parameter from parametric types

“stripping the last specified parameter in a parametric type” is an underspecified operation. There’s perhaps several ways of doing it, but it’s slightly arbitrary to care about this super type compared to any other possible super type. As for that, I would probably go with the following implementation, until someone explained why they wanted to do this particular non-sensical operation:

supertypeof(x::T) where {T} =
    (isempty(T.parameters) ? supertype(T) : T.name.wrapper{T.parameters[1:(end - 1)]...})
1 Like