Skip to content

Fix tuple_insert_static crash on non-normalized empty type - #15542

Merged
josevalim merged 2 commits into
elixir-lang:mainfrom
lukaszsamson:ls-tuple_insert_at-crash
Jul 25, 2026
Merged

Fix tuple_insert_static crash on non-normalized empty type#15542
josevalim merged 2 commits into
elixir-lang:mainfrom
lukaszsamson:ls-tuple_insert_at-crash

Conversation

@lukaszsamson

Copy link
Copy Markdown
Contributor

This PR makes a minimal change and instead of matching on none type asserts that static component has tuple and returns none() on everything else. Returning badtuple here would be incorrect. A few lines up the decision was made that we are dealing with a proper tuple

is_proper_tuple? = descr_key?(dynamic, :tuple) and tuple_only?(static)

dynamic component is a tuple, static is a non-normalized empty type, for which tuple_only? returns true

Alternative approach would be to normalize empty list/tuple/map components at construction but that's a bigger refactor I would not attempt

Fixes #15541

Assisted-by: Claude Opus 4.8

@gldubc gldubc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those changes are good, there is no need to refactor for normalization I agree.

@josevalim
josevalim merged commit 17f782e into elixir-lang:main Jul 25, 2026
15 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

tuple_insert_at crash on gradual type

3 participants