[Chapel Merge] Added a const ref overload to the methods first()

Branch: refs/heads/master
Revision: 76b4639
Author: dlongnecke-cray
Log Message:

Merge pull request #17510 from strikeraryu/master

Added a const ref overload to the methods first() and last() using
helpers. Previously the methods did not accept the usage of const
ref intent types.

Resolves #17259