Keep exclusions local when printing list type unions - #15926
Open
claytongentry wants to merge 1 commit into
Open
claytongentry wants to merge 1 commit into
claytongentry wants to merge 1 commit into
Conversation
Insert incoming alternatives without copying exclusions from another branch. Assisted-by: Codex:GPT-6
Member
|
Is this a fix for #15837? |
Contributor
Author
|
It's not quite a fix for #15837; I was leaving that one for other maintainers. This is a separate, (so far as I can tell) unreported issue. I believe the cases from that issue still reproduce with this patch. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Assisted-by: Codex:GPT-6
add_to_list_normalize/4can copy exclusions from an existing union alternative onto an incoming alternative that has no exclusions. This changes the meaning of the printed type. In the regression below, the input permits[:b], but every printed alternative excludes it.When
delete_elem/3finds no matching exclusion, the current code recurses with the existing alternative’sninstead of the incoming alternative’s[]. Insert{list, last, []}directly into the accumulator instead. Sincenis necessarily nonempty in this clause, the previous recursive call immediately reached the catch-all clause. Direct insertion preserves that behavior while keeping each alternative’s exclusions separate.The regression uses
bare_intersection/2to retain the structure that needs normalization during printing. It covers both leaking exclusions and incorrectly absorbing the incoming alternative into a later branch, which would lose[:d].