[Chapel Merge] Document that set operations will favor the LHS an

Branch: refs/heads/main
Revision: 1a96114
Author: bmcdonald3
Link: Document that set operations will favor the LHS and add test to lock in that behavior by bmcdonald3 · Pull Request #18842 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #18842 from bmcdonald3/set-ops

Document that set operations will favor the LHS and add test to lock in that behavior

[ reviewed by @lydia-duncan - thanks ]

In the set module review and the resulting issues, it was decided that we should favor the LHS of a set operation for choosing which element is chosen for the resultant set. This could matter, for example, if the == operator has been overloaded to only compare a subset of the fields on the element type, so the two elements are considered == by the set, so only one of them can be contained in the resultant set, but they are not actually the same objects.

This PR adds documentation for that behavior and adds a test to ensure that remains the case in the future, so that we will not happen to stray from that behavior in the future, which would be a breaking change.

  • [x] paratest

Closes Decide how set operators should decide which operand is chosen · Issue #18653 · chapel-lang/chapel · GitHub (design discussion)

Modified Files:
A test/library/standard/Set/setOperatorOrderTest.chpl

A test/library/standard/Set/setOperatorOrderTest.good
A test/library/standard/Set/setOperatorOrderTest2.chpl
A test/library/standard/Set/setOperatorOrderTest2.good
M modules/standard/Set.chpl

Compare: https://github.com/chapel-lang/chapel/compare/f31182b1e909...1a96114d5502