Files
swift-collections/Tests/_CollectionsTestSupport
Joseph CursioandClaude Opus 5 de23cb86c8 Check the mutating form* twins against their non-mutating originals
formUnion against union, formIntersection against intersection,
subtract against subtracting, and formSymmetricDifference against
symmetricDifference, in both the Self-taking and Sequence-taking
overloads.

Each runs under withHiddenCopies at both sharing states, because a
mutating operation on a shared value is where copy-on-write bugs
live, and the original is checked afterwards to confirm it was not
mutated through the copy.

This is the highest-value law in the checker. The two implementations
should agree by construction, so a divergence is a real bug rather
than a debatable one — and nothing else here would catch a form*
method that is simply wrong: a formUnion that intersects passes every
law in the preceding commit.

Verified by injecting three defects into a stand-in conformance: a
formUnion that intersects, an isStrictSubset that drops strictness,
and a subtracting that returns a stale count. All three are caught,
and an unmodified control passes. The stale-count case is caught only
because contents and count are asserted separately.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 21:14:59 -05:00
..