Skip to content

🐛 Fix inconsistently frozen SequenceSet#[] result #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

nevans
Copy link
Collaborator

@nevans nevans commented Apr 28, 2025

This maybe isn't actually documented very well (or at all...?) but most SequenceSet transform methods return a frozen result when self is frozen and a mutable result when self is mutable. Except limit which always returns a frozen result. And (before this commit) slice, which inconsistently returned with matching frozen status when the result wasn't empty, but always returned a frozen set when the result was empty.

(Adding these tests exposed a much more significant bug: SequenceSet#xor mutates the receiver crashes when the set is frozen: #457.)

@nevans nevans changed the base branch from sequence-set-slice-exclusive-range-ending-in-zero to master April 28, 2025 22:57
@nevans nevans added the bug Something isn't working label Apr 28, 2025
This maybe isn't actually documented very well (or at all...) but most
SequenceSet transform methods return a frozen result when +self+ is
frozen and a mutable result when +self+ is mutable.  Except +limit+
which always returns a frozen result.  And (before this commit) +slice+,
which inconsistently returned with matching frozen status when the
result wasn't empty, but always returned a frozen set when the result
_was_ empty.

Adding these tests exposed a much more significant bug:
`SequenceSet#xor` mutates the reciever.
@nevans nevans force-pushed the sequence_set/fix-slice-inconsistent-frozen branch from 4918584 to 1e2b599 Compare April 29, 2025 02:45
@nevans nevans merged commit ac7f7b9 into master Apr 29, 2025
37 checks passed
@nevans nevans deleted the sequence_set/fix-slice-inconsistent-frozen branch April 29, 2025 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant