runtime: Fix missing Type{Union{}} normalization (#62247)
Claude description below. That said, the number of places that need this
normalization is creeping a lot, so I probably want to revisit that, but
this fixes the crashiness for now.
`jl_get_genericmemory_layout` and the genericmemory.c element accessors
performed raw DataType field access on the element type, guarded only by
a compiled-out assert. For an element type in the bottom singleton class
-- `Type{Union{}}`, a TypeEq node laid out as the typeof(Union{})
singleton, cf. normalize_typeofbottom_layout_alias -- this read garbage
and crashed at type instantiation: plain `Vector{Type{Union{}}}`
segfaulted before any element was stored. Normalize the element type in
the layout computation and at each access site, matching the existing
field-layout sites in datatype.c.
The Julia-level mirror `aligned_sizeof` had the same hole: after
`allocatedinline` (which normalizes internally) it calls the
DataType-only layout queries on the raw TypeEq node. Alias the class
there as well. Element storage is then coherent on both sides: the
zero-size singleton layout (`Base.elsize(Vector{Type{Union{}}}) == 0`),
with reads producing the value `Union{}` itself, and a clean MethodError
when attempting to store anything else.
Co-authored-by: Keno Fischer <Keno@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>