[Chapel Merge] Support `scalar op tuple` operators in which the s

Branch: refs/heads/main
Revision: 7751073
Author: bradcray
Log Message:

Merge pull request #18154 from bradcray/make-tuple-ops-symmetrical

Support scalar op tuple operators in which the scalar's type coerces to the tuple's

[reviewed by @bmcdonald3 ]

In #18104, @npadmana pointed out a long-term issue in which cases like 2 * (1.0, 2.0, 3.0) didn't work even though (1.0, 2.0, 3.0) * 2 did due to the signatures of our 'scalar op tuple' procedures.

Specifically, the first form used a where-clause to indicate that the scalar's type was a subtype of the tuple's element type whereas the second declared the type of the scalar to be the same as the tuple, which was easy to express through a type query and constraint since the tuple argument comes first. The result is that the second form supported coercions while the first did not. The fix to make these symmetrical was to change the where-clause query from isSubtype() to isCoercible(). I remember we were unhappy with this asymmetry when we introduced these operators and I'd like to think that we didn't have isCoercible() at the time, which is why this "fix" wasn't available.

Resolves #18104.

Modified Files:
A test/types/tuple/homog/coerceScalarOpTuple.chpl

A test/types/tuple/homog/coerceScalarOpTuple.good
A test/types/tuple/homog/coerceTupleOpScalar.chpl
A test/types/tuple/homog/coerceTupleOpScalar.good
M modules/internal/ChapelTuple.chpl

Compare: https://github.com/chapel-lang/chapel/compare/b29467b49a30...77510730df4d