Use standard interface for Test.GenericArray (#30291)
The previous implementation violated the standard AbstractArray
interface and was, in some cases, a source of ambiguities.
Since you have to load `Test` to use `detect_ambiguities`, this
needs fixing.