[Chapel Merge] Fix range.chpl__unTranslate()

Branch: refs/heads/master
Revision: c51cba8
Author: vasslitvinov
Log Message:

Merge pull request #17105 from vasslitvinov/fix-chpl__unTranslate

Fix range.chpl__unTranslate()

This removes the following overload:

inline proc range.chpl__unTranslate(i)
{
  if isIntType(i.type) then
return this - i;
  else
return this + abs(i);
}

because the action in the ‘else’ branch is incorrect.
This also updates the other overload:

inline proc range.chpl__unTranslate(i: intIdxType)
  return this - i;

to accept any argument type.

The first overload was added in 44027d0714 to handle calls to
chpl__unTranslate whose argument is not of an index type.
For example, untranslating an int range by a unit or visa versa.
We have not hit the bug because that would require the argument
to be unsigned and not of the index type.

Having a single overload accepting any argument removes the bug
and simplifies the code, while addressing that earlier motivation.

r: @dlongnecke-cray

Modified Files:
M modules/internal/ChapelRange.chpl

Compare: Comparing 81a7a2cdf98f...c51cba8870c8 · chapel-lang/chapel · GitHub