Cast of quantities can corrupt the dimensions

In some casts, e.g. from quantity.Symbolic to quantity.Function or quantity.Discrete to quantity.Function, the dimensions are not preserved.