Skip to content

Fix wrong intersection with union of dynamic()#15340

Merged
josevalim merged 1 commit intoelixir-lang:mainfrom
gldubc:fix-intersection-bug
May 4, 2026
Merged

Fix wrong intersection with union of dynamic()#15340
josevalim merged 1 commit intoelixir-lang:mainfrom
gldubc:fix-intersection-bug

Conversation

@gldubc
Copy link
Copy Markdown
Member

@gldubc gldubc commented May 3, 2026

This fixes a nasty error on intersection which makes it drop the static part systematically when intersecting a type that has %{dynamic: :term} (meaning it's dynamic() or some_static). These special cases do not seem necessary to me (they are handled by the general path). The typechecking example uses matching with self (y = y) to test intersection!

@gldubc gldubc marked this pull request as ready for review May 3, 2026 20:30
@josevalim
Copy link
Copy Markdown
Member

@gldubc we have a similar clause in disjoint? but I assume that one is fine?

@josevalim josevalim merged commit 5858e7c into elixir-lang:main May 4, 2026
15 checks passed
@josevalim
Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

@josevalim josevalim deleted the fix-intersection-bug branch May 4, 2026 08:20
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.

2 participants