[Chapel Merge] Fix bugs in set composition operators when `parSaf

Branch: refs/heads/master
Revision: 62d7e66
Author: dlongnecke-cray
Log Message:

Merge pull request #17413 from dlongnecke-cray/public-17401

Fix bugs in set composition operators when parSafe=true (#17413)

The composition operators for set declare a result that has a
parSafe value of (lhs.parSafe || rhs.parSafe).

Prior to this PR, the declared return type of these operators omitted
the value of parSafe, which caused it to default to false. This
led to compiler errors when a composition operator was used on a set
with parSafe=true.

Omit a declared return type for the set composition operators. The
return type is now correctly inferred.

Add a test covering all composition operators (|, +, -, &, ^) as well
as their compound assignment variants (|=, +=, -=, &=, ^=). The test
is repeated to cover all combinations of parSafe values for the LHS
and RHS sets.

Define a cast operator for the set type. Currently it requires both
sets to have the same element type. Loosening this restriction (e.g.
for a cast from set of subclass to set of superclass) is possible.
The cast operator was added to keep the compiler from complaining
about assignment between sets with different parSafe values. It is
not documented.

Resolves #17401.

Reviewed by @vasslitvinov and @mppf. Thanks!

TESTING:

  • [x] ALL on linux64 when COMM=none
  • [x] ALL on linux64 when COMM=gasnet
  • [x] Checked updated docs locally

Signed-off-by: David Longnecker dlongnecke-cray@users.noreply.github.com

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

A test/library/standard/Set/setCompositionParSafe.good
A test/library/standard/Set/setInitTypeMismatchError.chpl
A test/library/standard/Set/setInitTypeMismatchError.good
A test/library/standard/Set/setSplitInit.chpl
A test/library/standard/Set/setSplitInit.good
M modules/standard/Set.chpl

Compare: https://github.com/chapel-lang/chapel/compare/ab1b11a13cbb...62d7e66c8439