julia
7df36ffe - runtime: Normalize the selected union member of an inline `Type{Union{}}`

Commit
1 day ago
runtime: Normalize the selected union member of an inline `Type{Union{}}` A `Type{Union{}}` field or memory element is stored inline with the layout of `typeof(Union{})`, so code that reads its layout must first map the declared type through `normalize_typeofbottom_layout_alias`. The places that pick an isbits-union member by its selector byte skipped that step. When `memoryrefget` is not inlined, or in the interpreter, reading `Union{}` back out of a `Vector{Union{Type{Union{}},Int}}` used the layout of the unnormalized type, which either segfaults or silently returns a wrong value such as `0`. `===` and `hash` on a struct with such a field segfaulted, and `jl_static_show` aborted on any inline `Type{Union{}}` field or element. Add `jl_nth_union_layout_component`, which picks the member and normalizes it, and use it at every place that reads an inline union value, including those that already normalized by hand. Static show now prints the stored value as `Union{}`. Fixes #63683 Assisted-by: Claude Code (Opus 5.5)
Committer
Parents
Loading