Skip to content

Fix propagation bug in Unsubtyping#8468

Open
tlively wants to merge 1 commit intomainfrom
unsubtyping-fix-propagation
Open

Fix propagation bug in Unsubtyping#8468
tlively wants to merge 1 commit intomainfrom
unsubtyping-fix-propagation

Conversation

@tlively
Copy link
Member

@tlively tlively commented Mar 14, 2026

Unsubtyping has to propagate a subtypesExposedToJS marker from supertypes to subtypes. It previously did this by propagating from supertype to subtype whenever a new subtyping relationship was found. But subtyping trees are not always built from top to bottom. In cases where the newly discovered subtype already had subtypes, the previous propagation scheme would fail to propagate to those transitive subtypes.

Fix the problem by propagating to the full subtype tree rooted at a newly discovered subtype. Use a DFS over the tree and avoid traversing subtrees that have already been marked to avoid introducing possible quadratic behavior.

Unsubtyping has to propagate a `subtypesExposedToJS` marker from supertypes to subtypes. It previously did this by propagating from supertype to subtype whenever a new subtyping relationship was found. But subtyping trees are not always built from top to bottom. In cases where the newly discovered subtype already had subtypes, the previous propagation scheme would fail to propagate to those transitive subtypes.

Fix the problem by propagating to the full subtype tree rooted at a newly discovered subtype. Use a DFS over the tree and avoid traversing subtrees that have already been marked to avoid introducing possible quadratic behavior.
@tlively tlively requested a review from kripken March 14, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant